Does a user belong to a Group?

I have to know if a user belongs to a Group(i.e., Administrator):

var myGroups = security.getUserGroups();
	for(var i=1; i <= myGroups.getMaxRowIndex(); i++) {
		if(myGroups.getValue(i, 2) == 'Administrators') {
			//some code here
			break;
		}
	}

Is there a easier way to do this??

No. That’s the way to do it. You could create a global method isUserInGroup() that takes a group name and does that check.

Thanks…

(Feature Request: new method security.isUserInGroup(userID, GroupName) :wink: )