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 associative array 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.

 

$groups = Security::getUserGroups();
if( $groups["accounts"] ) {
print_r($groups);
}

Sample output

Array
(
   [accounts] => 1
   [<Admin>] => 1
)

See also:

Security API: getUserGroup

Security API: getUserName

Security: User group permissions

About Security API

 

Created with Help+Manual 7 and styled with Premium Pack Version 3 © by EC Software