IsCallerInRole, IsSecurityEnabled Methods Example

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