EnumSecurityClassRightsForPrincipal

Returns arrays representing a user's access and email alerting rights to security classes. The arrays have a one-to-one correspondence.

Syntax

<HsvSecurityAccess>.EnumSecurityClassRightsForPrincipal bstrUserSID, pvaralSecurityClassIDs, pvarabstrSecurityClasses, pvaralRights, pvaralEmailAlerting
ArgumentDescription
bstrUserSIDString (ByVal). The user's security identifier.
pvaralSecurityClassIDsVariant array. Returns the IDs of the security classes to which the user has been assigned access rights. The array's subtype is Long.
pvarabstrSecurityClassesVariant array. Returns the names of the security classes. The array's subtype is String.
pvaralRightsVariant array. Returns the user's rights to the security classes. Valid values are represented by the constants in Table 68, Access Rights Constants.

The array's subtype is Long.

pvaralEmailAlertingVariant array. Returns an array of bitmasks that represent user's email alerting rights to the security classes. Valid values for the bits are represented by the enumeration described in E-mail Alerting Constants.

The array's subtype is Long.

Example

The following function returns the names of the security classes to which a user has All access rights.

Function GetUserSecClassesAllAccess(sName As String) As Variant
Dim sSId As String, cSecurity As HsvSecurityAccess, lCounter As Long
Dim vaSecIds, vaSecNames, vaRights, vaAlerts, vaRet()
'g_cSession represents an HsvSession instance
Set cSecurity = g_cSession.Security
cSecurity.GetUserSID sName, sSId
cSecurity.EnumSecurityClassRightsForPrincipal sSId, vaSecIds, _
    vaSecNames, vaRights, vaAlerts
lCounter = -1
If IsArray(vaSecNames) = True Then
    For i = LBound(vaSecNames) To UBound(vaSecNames)
        If vaRights(i) = HFM_ACCESS_RIGHTS_ALL Then
            lCounter = lCounter + 1
            ReDim Preserve vaRet(lCounter)
            vaRet(lCounter) = vaSecNames(i)
        End If
    Next i
End If
GetUserSecClassesAllAccess = vaRet
End Function