Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics > Security API > Methods

Security API: getUserGroups 

Scroll Prev Next More

 

Returns an array with all user groups.

Syntax

Security.getUserGroups()

Arguments

No arguments.

Return value

Returns an array with all user groups.

 

When Dynamic permissions are in effect, users may belong to more than one group. Security.getUserGroups() returns dictionary where keys are user group names and values are true.

Example

This example shows how to print the groups if they include a group named accounts.

 

dynamic groups = Security.getUserGroups();
if( groups["accounts"] ) {
MVCFunctions.print_r (groups);
}

Sample output

{"newgroup":true,"accounts":true,"devs":true,"<Admin>":true}

See also:

Security API: getUserGroup

Security API: getUserName

Security: User group permissions

About Security API