Security Business Objects
The following business objects are used to provide security services in MM .NET:

Security Business Object Properties and Methods
Here is a description of each object and its commonly used properties and methods.
Note: If you change the names of security tables or fields listed in the Security Tables Help topic, you must change the corresponding table and field name properties in the business objects listed below. Alternately, you can change the corresponding SQL SELECT commands stored in properties of the business object, or simply override a business object method (for example, if you want to run a stored procedure rather than using SQL Pass-through). For details, see the section below "Overriding Security Business Object Data Access Settings" at the bottom of this topic.
mmUser
Properties
- TableName - Name of the Users table
- PrimaryKey - Name of the Primary Key field in the Users table
- DescriptionField - Name of the description field in the Users table
- UserIDField - Name of the User ID field in the Users table
- PasswordField - Name of the Password field in the Users table
- LastNameField - Name of the Last Name field in the Users table
- FirstNameField - Name of the First Name field in the Users table
- FullNameField - Name of the Full Name data column derived by concatenating the Last Name and First Name field
- GetAllUserNamesCmd - SQL SELECT command executed in the GetAllUserNames method
- GetAllUsersCmd - SQL SELECT command executed in the GetAllUsers method
- GetUserByIDAndPasswordCmd - SQL SELECT command executed in the GetUserByIDAndPassword method
- GetUserByIDCmd - SQL SELECT command executed in the GetUserByIDAndPassword method if no password is specified
- GetUserByPKCmd - SQL SELECT command executed in the GetUserByPk method
Methods
- GetAllUserNames - Returns a DataSet containing all user names (with First and Last name concatenated into a single Name field), as well as their associated PKs
- GetAllUsers - Returns a DataSet containing all users
- GetUserByIdAndPassword - Returns the specified user by ID and password
- GetUserByPK - Returns the specified user by PK
mmRole
Properties
- TableName - Name of the Roles table
- PrimaryKey - Name of the Primary Key field in the Roles table
- DescriptionField - Name of the Description field in the Roles table
- UserRolesTable - Name of the User Roles table
- UserRolePKField - Name of the Primary Key field in the User Roles table
- RoleFKField - Name of the Role foreign key field in the User Roles table
- UserFKField - Name of the User foreign key field in the User Roles table
- NonMemberTable - Name of the Non-Member Roles table
- DeleteUserRolesCmd - SQL DELETE command executed in the DeleteUserRoles method
- GetAllRolesCmd - SQL SELECT command executed in the GetAllRoles method
- GetUserNonMemberRolesCmd - SQL SELECT command executed in the GetUserNonMemberRoles method
- GetUserRolesCmd - SQL SELECT command executed in the GetUserRoles method
- GetUserRolesLinkCmd - SQL SELECT command executed in the GetUserRolesLink method
Methods
- AddUserToRole - Adds a user to a specific role
- DeleteUserRoles - Deletes all user roles for the specified userPK
- GetAllRoles - Returns a DataSet containing all roles
- GetRoleByPK - Returns a DataSet containing the specified role
- GetUserNonMemberRoles - Gets all roles for which the specified user is NOT a member
- GetUserRoles - Gets all roles from the Role table for the specified user
- RemoveUserFromRole - Removes a user from a specific role
- UpdateUserRoles - Updates the specified user's roles from the user roles DataTable
mmSecurity
Properties
- TableName - Name of the Security table
- PrimaryKey - Name of the Primary Key field in the Security table
- DescriptionField - Name of the Description field in the Security table
- GetSecurityObjectByPKCmd - SQL SELECT command executed in the GetSecurityObjectByPK method.
Methods
- GetSecurityObjectByPK - Gets the specified Security object by PK
mmUserSecurity
Properties
- TableName - Name of the UserSecurity table
- PrimaryKey - Name of the Primary Key field in the UserSecurity table
- UserFKField - Name of the User foreign key field in the UserSecurity table
- SecurityFKField - Name of the Security Object foreign key field in the UserSecurity table
- AccessLevelField - Name of the Access Level field in the UserSecurity table
- GetAllUserSecurityCmd - SQL SELECT command executed in the GetAllUserSecurity method
- GetUserSecurityByPKCmd - SQL SELECT command executed in the GetUserSecurityByPK method
Methods
- GetAllUserSecurity - Gets all user security records
- GetUserSecurityByPK - Gets all security records for the specified user
- SetUserSecurity - Sets the security access level for the specified user and security PK within the default table of the specified DataSet
mmRoleSecurity
Properties
- TableName - Name of the RoleSecurity table
- PrimaryKey - Name of the Primary Key field in the RoleSecurity table
- RoleFKField - Name of the Role foreign key field in the RoleSecurity table
- SecurityFKField - Name of the Security Object foreign key field in the RoleSecurity table
- AccessLevelField - Name of the Access Level field in the RoleSecurity table
- UserRolesTable - Name of the UserRoles table
- UserFKField - Name of the User foreign key field in the UserRoles table
- GetAllRoleSecurityCmd - SQL SELECT command executed in the GetAllRoleSecurity method.
- GetRolesSecurityByUserCmd - SQL SELECT command executed in the GetRolesSecurityByUser method.
Methods
- GetAllRoleSecurity - Gets all role security records
GetRolesSecurityByUser - Gets all role security for the specified user
SetRoleSecurity - Sets the security access level for the specified role and security PK within the default table of the specified DataSet
mmUserManager
Properties
- UserPK - Stores the current user's PK
- UserID - Stores the current user's ID
- Password - Stores the current user's password
- UserTable - Name of the Users table
- UserPKField - Name of the Primary Key field in the User's table
- UserIDField - Name of the User ID field in the User's table
- PasswordField - Name of the Password field in the User's table
- LanguageFKField - Name of the Language foreign key field (if any) in the User's table
- AuthenticateUserSelectCmd - SQL SELECT command executed in the AuthenticateUser method
- AuthenticateUserNoPwdCmd - SQL SELECT command executed in the AuthenticateUser method if no password is specified
Methods
- AuthenticateUser - Authenticates the specified user
mmSecurityManager
Methods
- GetAccessLevel - There are several overloads of this method that return the access level for a secure object and the current user or a specified user.
- RegisterUser - Registers the specified user as the current user and retrieves/caches all related security records for the user and any of their associated roles. One overload registers the user by ID and Password, the other by user primary key.
Overriding Security Business Object Data Access Settings
At times you may want to override the default table names, fields, and SQL SELECT statements used in the security business objects. This section explains how to do this.To override the name of table or fields used by a security business object, you need to create a subclass of that business object and change your application's Factory class to instantiate your new subclass.
For example, the following steps show how you can change the name of the table and primary key used by the mmUser business object:
- Add a new User class to your project with the following definition:
In C#:
public class User : mmUser { // Constructor public User() { this.TableName = "User"; this.PrimaryKey = "User_PK"; } }And in VB .NET:
Public Class User Inherits mmUser ' Constructor Public Sub New() Me.TableName = "User" Me.PrimaryKey = "User_PK" End Sub End Class - In the Solution Explorer, right-click the Factory.cs or Factory.vb file and add the following override of the CreateUserObject factory method:
In C#:
/// <summary> /// Summary description for CustomFactory. /// </summary> public class Factory : OakLeaf.MM.Main.Windows.Forms.mmFactoryDesktop { /// <summary> /// Creates a new User business object /// </summary> /// <returns>User business object</returns> public override mmUser CreateUserObject() { return new User(); } }And in VB .NET:
Namespace Main ' Application-level Factory Public Class Factory Inherits OakLeaf.MM.Main.Windows.Forms.mmFactoryDesktop ' Creates a new User business object Public Overrides Function CreateUserObject() As mmUser Return New User() End Function End Class End Namespace
Overriding Data Access Methods
If you want to completely override the SELECT statement used by a security business object, you can do so by overriding the object's corresponding SQL SELECT command property. For example, if you want to change the SQL SELECT statement used by the Role object's GetAllRoles method, you would override the corresponding GetAllRolesCmd property Get accessor:In C#:
public class Role : mmRole
{
// Constructor
public Role()
{
}
protected override string GetAllRolesCmd
{
get
{
return "SELECT RolePK, Description FROM Roles";
}
}
}And in VB .NET:
Public Class Role
Inherits mmRole
' Constructor
Public Sub New()
End Sub
Protected Overrides ReadOnly Property GetAllRolesCmd() As String
Get
Return "SELECT RolePK, Description FROM Roles"
End Get
End Property
End Class
© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 04/26/18
Comment or report problem with topic
