Visual Guard Class Library Documentation

VGIPrincipal.GetPermission Method (String)

Gets the specified VGIPermission object.

VGIPermission GetPermission(
   String fullname
);

Parameters

fullname
The full name of the permission, including the folder path.

Return Value

The specified VGIPermission object if the permission is granted to the principal. Returns null (Nothing in VB) if the permission is not granted or it does not exist.

Remarks

this method is not case sensitive

Example

The following example gets the permission "My permission" stored in the root of permissions.

[Visual Basic]
Dim myPerm as VGIPermission = VGSecurityManager.Principal.GetPermission("My permission")
If myPerm is Nothing Then
    ' the permission is not granted ...
Else
    Dim myValue as String = CType(myPerm(myValue), String)
End If
[C#]
VGIPermission myPerm = VGSecurityManager.Principal.GetPermission("My permission")
if (myPerm == null)
{
    // the permission is not granted ...
}
Else
{
    string myValue (string)myPerm[myValue];
}

The following example gets the permission "Disable Edition" contained in the folder "Customer".

VGSecurityManager.Principal.GetPermission("\Customers\Disable Edition")

See Also

VGIPrincipal Interface | Novalys.VisualGuard.Security Namespace | VGIPrincipal.GetPermission Overload List