_setPermissions

Sets the CRM permissions of the specified User, controlling what they can do on the CRM.

Parameters

id

The ID of the User.

val

The permission value as a bit field. Possible values are defined below. Multiple permissions are set by adding together their respective permission values.

Admin: Set to 1 to allow the User full access to all areas. Customer Admin: Set to 2 to allow the User full access to customer information instead of limited access. Web Access: Set to 4 to allow the User to log into the web application. Salaries: Set to 8 to allow the User to view and edit user salaries.

Example

This example allows the User full access to customer information and allows them to view and edit user salaries. FM_api('User_setPermissions', ['id' => '123', 'val' => '10']);

Results

On Success

{'ok':1}

On Failure

If the User is not logged in: {'error':'not logged in'}

If the User is not an Administrator: {'error':'only admins can edit user permissions'}

If the User tries to edit their own permissions: {'error':'you cannot edit your own permissions'}

If the main FieldMotion account User is not an Administrator: {'error':'the main FieldMotion account user must have admin access'}

Last updated