Occurs before the permissions are loaded and allows filtering the list of user's roles.

Namespace: Novalys.VisualGuard.Security
Assembly: Novalys.VisualGuard.Security (in Novalys.VisualGuard.Security.dll) Version: 2016.0.105.16 (2016.0.105.16)

Syntax

C#
public static event VGPermissionsLoadingEventHandler PermissionsLoading
Visual Basic
Public Shared Event PermissionsLoading As VGPermissionsLoadingEventHandler

Value

Type: Novalys.VisualGuard.Security..::..VGPermissionsLoadingEventHandler

Remarks

The event handler receives an argument of type VGPermissionsLoadingEventArgs containing data related to this event. The PermissionsLoading event allows a user to filter the list of roles granted to the principal or to cancel the authorization (or authentication) process.

Examples

This example display how to use the event PermissionsLoading to allow the user select a roles in the list of granted roles.
Visual Basic Copy imageCopy
Private Sub OnPermissionLoading(ByVal sender As Object, ByVal e As VGPermissionsLoadingEventArgs)
    If e.Roles.Length > 0 Then
        Dim form As New SelectRoleForm
        form.Roles = e.Roles
        If form.ShowDialog() = DialogResult.OK Then
            e.Roles = form.Roles
        Else
            e.Cancel = True
        End If
    End If
End Sub
C# Copy imageCopy
private void OnPermissionLoading (object sender, VGPermissionsLoadingEventArgs args)
{
    if (e.Roles.Length > 0)
        SelectRoleForm form = new SelectRoleForm()
        form.Roles = e.Roles
        if (form.ShowDialog() == DialogResult.OK)
        {
            e.Roles = form.Roles
        }
        else
        {
            e.Cancel = true
        }
    }
}

See Also