UserRoleRemove

You can use the UserRoleRemove function to revoke one or more roles from an Optiva user. This function removes users from security roles and revokes role-based permissions and access rights.

When to use

You can use this function to:

  • Revoke one or more roles from an Optiva user.
  • Automate user role management.

When not to use

You cannot use this function when the access collection security is active.

Syntax

int UserRoleRemove(string UserCode, string LabCode, string RolesList)

Parameters

Parameter Type Required Description
UserCode string Yes The user code or user name that identifies the Optiva user from whom roles will be removed.
LabCode string Yes The lab code that identifies the lab context for the role removal.
RolesList string Yes A single role name or a semicolon-separated list of role names to remove from the user.

Return Value

The application returns a value greater than zero (0) if the operation is successful. Otherwise, the operation fails.

Impact

The user loses the permissions associated with the removed role or roles.

Prerequisites

  • The target user must exist in the system.
  • The specified roles must exist in the system.

Examples

Example 1
Remove a single role from a user.
UserRoleRemove("FSI", "ADMIN");
Example 2
Remove multiple roles from a user.
UserRoleRemove("FSI", "RL_TEST;RL_BDL");