EnumRolesForPrincipal

Returns the IDs of a user's or group's roles.

Syntax

<HsvSecurityAccess>.EnumRolesForPrincipal bstrUserSID, pvaralRoleIds
ArgumentDescription
bstrUserSIDString (ByVal). The user’s or group's security identifier.
pvaralRoleIdsVariant array. Returns the IDs of the assigned roles. Valid values are listed in Role ID Constants.

The array's subtype is Long.

Example

The following function returns the roles for a given username.

Function GetPrincRolesFromName(sName As String) As Variant
Dim cSecurity As HsvSecurityAccess, vaRoles As Variant
Dim sSId As String
'g_cSession represents an HsvSession instance
Set cSecurity = g_cSession.Security
cSecurity.GetUserSID sName, sSId
cSecurity.EnumRolesForPrincipal sSId, vaRoles
GetPrincRolesFromName = vaRoles
End Function