RemoveUserFromRoles Method
Syntax
Context.Security.RemoveUserFromRoles as L (UserName as C, RoleNames as C)
Arguments
- UserNameCharacter
The name of the user to be removed from the role.
- RoleNamesCharacter
A list of role names from which the user should be removed. Role names are separated by a crlf.
Returns
- resultLogical
Returns .T. if the user was removed from the roles; otherwise .F.
Description
Removes a user from one or more roles.
Discussion
Context.Security.RemoveUserFromRoles() removes a user from one or more roles. Check Context.Security.CallResult.Success before using the return value.
The example below is an excerpt from an A5W page. The example removes the user "[email protected]" from two roles: "Management" and "Staff". The result of the call to RemoveUserFromRoles() is checked before outputting HTML to the page to display a success or failure message:
Example
<%a5 dim userName as C = "[email protected]" dim roles as c =<<%str% Management Staff %str% if (Context.Security.RemoveUserFromRoles(userName, roles)) then ? userName + " removed from roles: <br>" + strtran(roles,crlf(),"<br>") + "<br>" else ? "Error removing user " + userName + " from roles: <br>" + Context.Security.CallResult.Text + "<br>" end if %>