AnsweredAssumed Answered

Get a list of a user's system groups

Question asked by srowsell on Sep 26, 2013
Latest reply on Oct 1, 2013 by srowsell
I have this code:

var userIsSiteManager=false;
var siteId=page.url.templateArgs.site;
var result = remote.call("/api/people/" + stringUtils.urlEncode(user.name) + "?groups=true");
   var grps="";

   if (result.status == 200 && result != "{}")
   {
      var theUser = eval('(' + result + ')');

      var groups = theUser.groups;

      for (var i=0; i < groups.length; i++) {
         if (theUser.groups.itemName == "GROUP_site_"+siteId+"_SiteManager") userIsSiteManager = true;
         }
      }


It works in the sense that the groups array does contain the groups to which the user belongs.  The problem is that it doesn't contain *all* the groups – it doesn't contain the system groups, which is what I'm interested in.  Specifically I want to be able to show a dashlet's contents only if the user is a site manager.

Anyone know how to get the list of system groups?

Outcomes