« Back to Product

Documentation

IPS_GetRole

 array IPS_GetRole (string $Role) 

Parameters

Role

Name of the role

Returns

The following information is available as key => value pairs:

Index Type Description
RoleName string Name of the role
Permissions array List of the permissions of the role (see permission table)

Permission table

Index Type Description
ObjectID integer ID of the object the permission applies to
Operation string Name of the operation, e.g. VISUALIZATION
Recursive boolean The permission also applies to all objects below ObjectID

Description

The function returns the name and the permissions of the role with the name Role. If the role does not exist, the function fails with "Role with name '…' does not exist".

The role @admin has no entries in Permissions, but still grants all permissions. Whether a role has a specific permission is checked by IPS_RoleHasPermission. The function requires neither administrator permissions nor the RBAC feature in the license.

Example

print_r(IPS_GetRole('Residents'));

/* e.g. returns:
Array
(
    [Permissions] => Array
        (
            [0] => Array
                (
                    [ObjectID] => 12345
                    [Operation] => VISUALIZATION
                    [Recursive] => 
                )

        )

    [RoleName] => Residents
)
*/
Any questions?