cancel
Showing results for 
Search instead for 
Did you mean: 

Check group membership?

gronfelt
Champ in-the-making
Champ in-the-making
Is there any simple way to check if the current user is a member of a specified group?
3 REPLIES 3

gronfelt
Champ in-the-making
Champ in-the-making
Just for the record, this is how I'm solving it now:


var member = false;
var testedGroup = groups.getGroup("nameOfGroup");
var memberlist = testedGroup.getAllUsers();
for (var i in memberlist)
{
  var name1=memberlist[i].getFullName();
  var name2=person.properties.userName;
  if (name1 == name2)
  {
     member=true;
  }
}

The question is if there's a better way?

lista
Star Contributor
Star Contributor
Array getContainerGroups(ScriptNode person) 
Gets the groups that contain the specified authority.

This is a better solution, IMO.
Obviously, you'd then check to see if you group has been returned.

Cheers!

gronfelt
Champ in-the-making
Champ in-the-making
Thank's a lot, I agree that it looks much better.