StrataFrame Security Documentation Send comments on this topic.
Accessing Permissions Programmatically

Glossary Item Box

PermissionInfo Class

The MicroFour.StrataFrame.Security.PermissionInfo class contains all of the information needed to describe a permission that is assigned to a user, including the action to take, and the blocked message if necessary. When you access an assigned permission at runtime, a PermissionInfo object will be returned. The permission info class contains the following properties:

PropertyDescription
ActionThe PermissionAction that determines that action that should be taken for this permission (Grant, Deny, Read-only.)
BlockedMessageOrKeyThe message that will be shown to the end-user if the Action is Deny and the DenyAction property is either Message or MessageKey. If the DenyAction is Message, then this property is the actual message. If the DenyAction is MessageKey, then this property contains the localization key that will be used to retrieve the message.
DenyActionThe specific action to perform if the Action is Deny to inform the end-user that their access is denied. Possible values are NoMessage, Message, MessageKey, or ReplaceEachChar.

CurrentUser.GetPermission()

The MicroFour.StrataFrame.Security.SecurityBasics.CurrentUser contains the GetPermission() method that is used to programmatically retrieve the PermissionInfo for a given permission key. The method accepts a single string parameter that indicates the permission key for which you want to retrieve the PermissionInfo. Once the permission info is retrieved, you can determine the action that should be performed.

Sample – GetPermission() [Visual Basic]
Imports MicroFour.StrataFrame.Security
...
Private Sub CheckMyPermission()
    '-- Retrieve the permission and test it
    If SecurityBasics.CurrentUser.GetPermission("MyPerm").Action = _
        PermissionAction.Grant Then
        
        '-- Enable the control
        Button1.Enabled = True
    Else
        '-- Disable the control
        Button1.Enabled = False
    End If
End Sub

Sample – GetPermission() [C#]
using MicroFour.StrataFrame.Security;
...
private void CheckMyPermission()
{
    //-- Retrieve the permission and test it
    if (SecurityBasics.CurrentUser.GetPermission(@"MyPerm").Action ==
        PermissionAction.Grant)
    {
        //-- Enable the control
        Button1.Enabled = true;
    }
    else
    {
        //-- Disable the control
        Button1.Enabled = false;
    }
}

Determining Permissions

When a user logs into the system, a flat list of his/her permissions is compiled according to the permissions assigned to the user through his/her assigned roles and directly assigned permissions. The permission granted to the user is determined by the hierarchy of the assigned permissions (link). If the permission is not assigned to the user, then the default permission is assigned.