Visual Guard Class Library Documentation

VGSecurityManager.LoadSecurity Method (WindowsIdentity)

Loads the permission of the given WindowsIdentity IIdentity.

public static VGAuthorizationState LoadSecurity(
   WindowsIdentity identity
);

Parameters

identity
a WindowsIdentity object representing the user.

Return Value

A VGAuthorizationState representing the state of the authorization

Remarks

If a user has more than one role in the application, you can use the PermissionsLoading event to allow the user to select a role in the granted roles list. By default, Visual Guard will create permission set that will be a union of all permision sets granted to the roles.

Exceptions

Exception Type Condition
VGConfigurationException The configuration file is not valid

or

A problem occurs during the connection to the repository.

or

The version of the repository or the version of the permissions is not supported by the application.

Example

[Visual Basic]
Dim state As VGAuthorizationState
state = VGSecurityManager.LoadSecurity (System.Security.Principal.WindowsIdentity.GetCurrent())
If state.IsFailed Then
    If state.IsUserNotFound Then
        MessageBox.Show("Your are not declared in the security repository")
    ElseIf state.IsUserNotAuthorized Then
        MessageBox.Show("Your are not authorized to log on to this application")
    End If
Else
    Application.Run(New MDIForm)
End If
[C#]
VGAuthorizationState state = VGSecurityManager.LoadSecurity (System.Security.Principal.WindowsIdentity.GetCurrent());
if (state.IsFailed)
{
    if (state.IsUserNotFound)
    {
        MessageBox.Show("Your are not declared in the security repository");
    }
    elseif (state.IsUserNotAuthorized)
    {
        MessageBox.Show("Your are not authorized to log on to this application")
    }
}
else
{
    Application.Run(new MDIForm())
}

See Also

VGSecurityManager Class | Novalys.VisualGuard.Security Namespace | VGSecurityManager.LoadSecurity Overload List | PermissionsLoading