SetRolesForUser

Specifies one or more roles for a given user. This method overwrites any previously assigned roles for the user.

Syntax

<HsvSecurityAccess>.SetRolesForUser bstrUserSid, varalRoleIds

Argument

Description

bstrUserSid

String (ByVal). The user’s security identifier.

varalRoleIds

Long array (ByVal). The IDs of the roles. For a list of valid role IDs, see Role ID Constants.

Example

The following example assigns the specified roles to a given username. The user’s security identifier is obtained with GetUserSID.

Sub assignRolesUsername(sName As String, laRoles() As Long)
Dim cSecurity As HsvSecurityAccess, sID As String
'g_cSession is an HsvSystemInfo object reference
Set cSecurity = g_cSession.Security
cSecurity.GetUserSID sName, sID
cSecurity.SetRolesForUser sID, laRoles
End Sub