Step 4. Specifying Default Security Settings
Enabling Security
For security to be enabled, the mmAppBase.SecurityEnabled property must be set to true (it's true by default). You can toggle this flag to turn security for the entire App off and on.Specifying the Default Security Access Level for Controls
The MM .NET default access level for secure controls is "Read Only". This means if you specify a control is secure, but you have not specified an access level for the current user (or their roles), the user has read-only access to the control by default.If you want to change this default behavior, change the setting of the mmAppBase.DefaultSecurityAccessLevel property. You can do this in the constructor of your application object (App.cs or App.vb) as follows:
- In the Solution Explorer, right-click your App.cs or App.vb file, and select View Code from the shortcut menu.
- At the top of the source code file, add the following namespace reference (if it's not already there):
In C#:
using OakLeaf.MM.Main.Security;
And in VB .NET:
Imports OakLeaf.MM.Main.Security
- Add code to the application class constructor that changes the default value:
In C#:
public AppDesktop() { // Change the default security level to Full mmAppBase.DefaultSecurityAccessLevel = mmSecurityAccessLevel.Full; ApplicationName = "My New Application"; this.InitializeComponent(); }And in VB .NET:
Public Sub New() ' Change the default security level to Full mmAppBase.DefaultSecurityAccessLevel = mmSecurityAccessLevel.Full ApplicationName = "My New Application" Me.InitializeComponent() End Sub
The possible values for this property are:
- Full
- None
- ReadOnly
- Unknown
Specifying the Default Role Access
If there is no specified user-level access, MM .NET checks for role level settings. If the user belongs to multiple roles for which access has been specified, MM .NET uses the most privileged access by default. If you want MM .NET to use the least privileged access instead, you must change the application-level UseMostPrivilegedAccess property to false. You can do this by adding the following code in the constructor of your application object (app.cs or app.vb):In C#:
public AppDesktop()
{
// Change the default role access
UseMostPrivilegedRoleAccess = false;
this.InitializeComponent();
}And in VB .NET:
Public Sub New()
' Change the default role access
UseMostPrivilegedRoleAccess = False
Me.InitializeComponent()
End SubSee also:
Step 4. Displaying a Login Form
© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 04/26/18
Comment or report problem with topic
