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.
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. |
<HsvEntities>.GetSecurityClassID lItemID, plSecurityClassIDLong. Returns the ID number of the security class, or SECURITY_CLASS_NONE if a security class has not been assigned to the entity. Get the label for the returned ID by passing the ID to HsvSecurityAccess.GetSecurityClassLabel. For more information, see GetSecurityClassLabel. |
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