GetSecurityClassID

Returns the ID of the security class that has been assigned to an account, given the account’s member ID.

Syntax

<HsvAccounts>.GetSecurityClassID lItemID, plSecurityClassID

Argument

Description

lItemID

Long (ByVal). The account’s member ID.

plSecurityClassID

Long. Returns the ID of the account’s security class , or SECURITY_CLASS_NONE if a security class has not been assigned to the account.

Tip:

To get the label of the security class, pass the ID returned by this argument to the HsvSecurityAccess object’s GetSecurityClassLabel method.

Example

The following example creates a function that takes an account’s label and returns the label of the account’s security class, or a blank string if a security class has not been assigned to the account. IHsvTreeInfo.GetItemID returns the account’s member ID, which is then passed to GetSecurityClassID. If GetSecurityClassID indicates that the account has no security class, a blank string is assigned as the function’s return value; otherwise, HsvSecurityAccess.GetSecurityClassLabel gets the security class’s label, which is then assigned as the function’s return value.

Function getAcctSecLabel(sAcctLabel As String) As String
Dim cAccounts As HsvAccounts, cTreeInfo As IHsvTreeInfo
Dim cSecurityAccess As HsvSecurityAccess
Dim lAcctID As Long, lSecID As Long, sSecLabel As String
Set cAccounts = m_cMetadata.Accounts
Set cTreeInfo = m_cMetadata.Accounts
lAcctID = cTreeInfo.GetItemID(sAcctLabel)
cAccounts.GetSecurityClassID lAcctID, lSecID
If lSecID < 0 Then
  getAcctSecLabel = ""
Else
  Set cSecurityAccess = m_cSession.Security
  cSecurityAccess.GetSecurityClassLabel lSecID, sSecLabel
  getAcctSecLabel = sSecLabel
End If
End Function