Platform SDK: Transaction Server

IsCallerInRole, IsSecurityEnabled Methods Example

[This product will work only on Windows NT 4.0 versions and earlier. For Windows 2000 and later, see COM+ (Component Services).]

Dim objContext As ObjectContext
Set objContext = GetObjectContext()

If Not objContext Is Nothing Then
    ' Find out if Security is enabled.
    If objContext.IsSecurityEnabled Then
        ' Find out if the caller is in the right role.
        If Not objContext.IsCallerInRole("Manager") Then
            ' If not, do something appropriate here.
        Else
            ' If so, execute the call normally.
        End If
    Else
    ' If security's not enabled, do something 
    ' appropriate here.
    End If
End If