« Back to Product

Documentation

IPS_RoleHasPermission

 bool IPS_RoleHasPermission (string $Role, int $ObjectID, string $Operation) 

Parameters

Role

Name of the role

ObjectID

ID of the object to be checked

Operation

Name of the operation, e.g. VISUALIZATION

Returns

If the role has the permission, TRUE is returned, otherwise FALSE.

Description

The function checks whether the role Role may perform Operation on the object ObjectID. This is the case if the role has a permission with this operation directly for ObjectID or a recursive permission for ObjectID or one of its parent objects (up to the root object with the ID 0). The role @admin always has all permissions.

Only the permissions of the role are taken into account. Whether a user is permitted – by their own permissions or one of their roles – is checked by IPS_UserHasPermission.

The checks are performed in this order: operation ("Cannot verify unsupported operation"), object ("Object #… does not exist"), role ("Role with name '…' does not exist"). The operation must be registered in the system; currently there is the operation VISUALIZATION as soon as a visualization instance exists. The function requires neither administrator permissions nor the RBAC feature in the license.

Example

if (IPS_RoleHasPermission('Residents', 12345, 'VISUALIZATION')) {
    echo 'The role may open the visualization';
}
Any questions?