GetSecurityClassID

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

Syntax

<HsvScenarios>.GetSecurityClassID lItemID, plSecurityClassID

Argument

Description

lItemID

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

plSecurityClassID

Long. Returns the ID of the scenario’s security class, or -1 if a security class has not been assigned to the scenario.

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 a scenario’s label and returns the label of the scenario’s security class, or a blank string if a security class has not been assigned to the scenario. IHsvTreeInfo.GetItemID returns the scenario’s member ID, which is then passed to GetSecurityClassID. If GetSecurityClassID indicates that the scenario 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 getScenSecLabel(sScenLabel As String) As String
Dim cScenarios As HsvScenarios, cTreeInfo As IHsvTreeInfo
Dim cSecurityAccess As HsvSecurityAccess
Dim lScenID As Long, lSecID As Long, sSecLabel As String
Set cScenarios = m_cMetadata.Scenarios
Set cTreeInfo = m_cMetadata.Scenarios
lScenID = cTreeInfo.GetItemID(sScenLabel)
cScenarios.GetSecurityClassID lScenID, lSecID
If lSecID < 0 Then
  getScenSecLabel = ""
Else
  Set cSecurityAccess = m_cSession.Security
  cSecurityAccess.GetSecurityClassLabel lSecID, sSecLabel
  getScenSecLabel = sSecLabel
End If
End Function