VGSecurityManagerLoadSecurity Method (String)
|
Loads the permissions of a user identified by the user name.
Namespace:
Novalys.VisualGuard.Security
Assembly:
Novalys.VisualGuard.Security (in Novalys.VisualGuard.Security.dll) Version: 2019.1.831.19 (2019.1.0831.19)
Syntax public static VGAuthorizationState LoadSecurity(
string name
)
Public Shared Function LoadSecurity (
name As String
) As VGAuthorizationState
Parameters
- name
- Type: SystemString
the name of the user.
Return Value
Type:
VGAuthorizationStateA
VGAuthorizationState representing the state of the authorization
Exceptions Exception | Condition |
---|
NotSupportedException | the repository does not support Visual Guard authentication mode. |
ArgumentNullException | name is null. |
ArgumentException | The name is longer than 64 characters The name is empty. |
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.
|
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.
This method check authorization only for Visual Guard user, do not use this method for database or Windows user
Examples VGAuthorizationState state = VGSecurityManager.LoadSecurity ("myUserName");
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())
}
Dim state As VGAuthorizationState
state = VGSecurityManager.LoadSecurity ("myUserName")
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
See Also