GetSecurityClassID

Returns the ID number of an entity’s security class. In other words, this method returns the ID of the security class that has been defined for an entity’s SecurityClass attribute.

Caution!

This method is different than the identically named GetSecurityClassID method of the HsvSecurityAccess object. The HsvSecurityAccess method takes a security class name and returns the corresponding ID; for more information, see GetSecurityClassID.

Syntax

<HsvEntities>.GetSecurityClassID lItemID, plSecurityClassID

Argument

Description

lItemID

Long (ByVal). The member ID of the entity.

plSecurityClassID

Long. Returns the ID number of the security class, or SECURITY_CLASS_NONE if a security class has not been assigned to the entity.

Tip:

Get the label for the returned ID by passing the ID to HsvSecurityAccess.GetSecurityClassLabel. For more information, see GetSecurityClassLabel.

Example

The following function takes an Entity member’s label and returns the label of its security class.

Function getEntSecClass(sMem As String) As String
Dim lSecID As Long, lEntId As Long, cEntities As HsvEntities
Dim cTreeInfo As IHsvTreeInfo, cSecurity As HsvSecurityAccess
Dim sSecClass As String
'g_cMetadata is an HsvMetadata object reference
Set cEntities = g_cMetadata.Entities
Set cTreeInfo = g_cMetadata.Entities
'g_cSession is an HsvSession object reference
Set cSecurity = g_cSession.Security
lEntId = cTreeInfo.GetItemID(sMem)
cEntities.GetSecurityClassID lEntId, lSecID
'if the entity has a security class, return its label
If lSecID > -1 Then
    cSecurity.GetSecurityClassLabel lSecID, sSecClass
    getEntSecClass = sSecClass
'if the entity has no security class, return a blank string
Else
    getEntSecClass = ""
End If
End Function