Reacting to Groups in Mindtouch


/ Published in: Other
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // -- User Groups
  2. var groups = [ xml.text(gname) foreach var gname in wiki.api(site.api.."/users/"..user.id)['//groupname'] ];
  3.  
  4. // -- PUblic Groups to check against
  5. var pug = ['Public', 'Corp-US Citizen', 'Corp-US Person'];
  6.  
  7. // -- Search for pub user
  8. var pub = true;
  9. foreach (var y in groups where pub )
  10. {
  11. let pub = list.contains(pug,y);
  12. }
  13.  
  14. // check the public/non-public status of the user
  15. if (pub == TRUE)
  16. {
  17. // User is Public
  18. "you are a public user";
  19. }
  20. else
  21. {
  22. // user is NOT public
  23. // be awesome
  24. "you are NOT a public user";
  25. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.