Class ModulePermissionController
ModulePermissionController provides the Business Layer for Module Permissions.
Inheritance
Namespace: DotNetNuke.Security.Permissions
Assembly: DotNetNuke.dll
Syntax
public class ModulePermissionController : object
Methods
| Improve this Doc View SourceCanAdminModule(ModuleInfo)
Returns a flag indicating whether the current user can administer a module.
Declaration
public static bool CanAdminModule(ModuleInfo module)
Parameters
Type | Name | Description |
---|---|---|
ModuleInfo | module | The page. |
Returns
Type | Description |
---|---|
System.Boolean | A flag indicating whether the user has permission. |
CanDeleteModule(ModuleInfo)
Returns a flag indicating whether the current user can delete a module.
Declaration
public static bool CanDeleteModule(ModuleInfo module)
Parameters
Type | Name | Description |
---|---|---|
ModuleInfo | module | The page. |
Returns
Type | Description |
---|---|
System.Boolean | A flag indicating whether the user has permission. |
CanEditModuleContent(ModuleInfo)
Returns a flag indicating whether the current user can edit module content.
Declaration
public static bool CanEditModuleContent(ModuleInfo module)
Parameters
Type | Name | Description |
---|---|---|
ModuleInfo | module | The page. |
Returns
Type | Description |
---|---|
System.Boolean | A flag indicating whether the user has permission. |
CanExportModule(ModuleInfo)
Returns a flag indicating whether the current user can export a module.
Declaration
public static bool CanExportModule(ModuleInfo module)
Parameters
Type | Name | Description |
---|---|---|
ModuleInfo | module | The page. |
Returns
Type | Description |
---|---|
System.Boolean | A flag indicating whether the user has permission. |
CanImportModule(ModuleInfo)
Returns a flag indicating whether the current user can import a module.
Declaration
public static bool CanImportModule(ModuleInfo module)
Parameters
Type | Name | Description |
---|---|---|
ModuleInfo | module | The page. |
Returns
Type | Description |
---|---|
System.Boolean | A flag indicating whether the user has permission. |
CanManageModule(ModuleInfo)
Returns a flag indicating whether the current user can manage a module's settings.
Declaration
public static bool CanManageModule(ModuleInfo module)
Parameters
Type | Name | Description |
---|---|---|
ModuleInfo | module | The page. |
Returns
Type | Description |
---|---|
System.Boolean | A flag indicating whether the user has permission. |
CanViewModule(ModuleInfo)
Returns a flag indicating whether the current user can view a module.
Declaration
public static bool CanViewModule(ModuleInfo module)
Parameters
Type | Name | Description |
---|---|---|
ModuleInfo | module | The page. |
Returns
Type | Description |
---|---|
System.Boolean | A flag indicating whether the user has permission. |
DeleteModulePermissionsByUser(UserInfo)
DeleteModulePermissionsByUser deletes a user's Module Permission in the Database.
Declaration
public static void DeleteModulePermissionsByUser(UserInfo user)
Parameters
Type | Name | Description |
---|---|---|
UserInfo | user | The user. |
GetModulePermissions(Int32, Int32)
GetModulePermissions gets a ModulePermissionCollection.
Declaration
public static ModulePermissionCollection GetModulePermissions(int moduleId, int tabId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | moduleId | The ID of the module. |
System.Int32 | tabId | The ID of the tab. |
Returns
Type | Description |
---|---|
ModulePermissionCollection | A ModulePermissionCollection with the module permissions, or an empty ModulePermissionCollection if the module wasn't found. |
HasModuleAccess(SecurityAccessLevel, String, ModuleInfo)
Determines if user has the necessary permissions to access an item with the designated AccessLevel.
Declaration
public static bool HasModuleAccess(SecurityAccessLevel accessLevel, string permissionKey, ModuleInfo moduleConfiguration)
Parameters
Type | Name | Description |
---|---|---|
SecurityAccessLevel | accessLevel | The SecurityAccessLevel required to access a portal module or module action. |
System.String | permissionKey | If Security Access is Edit the permissionKey is the actual "edit" permission required. |
ModuleInfo | moduleConfiguration | The ModuleInfo object for the associated module. |
Returns
Type | Description |
---|---|
System.Boolean | A boolean value indicating if the user has the necessary permissions. |
Remarks
Every module control and module action has an associated permission level. This function determines whether the user represented by UserName has sufficient permissions, as determined by the PortalSettings and ModuleSettings, to access a resource with the designated AccessLevel.
HasModulePermission(ModulePermissionCollection, String)
HasModulePermission checks whether the current user has a specific Module Permission.
Declaration
public static bool HasModulePermission(ModulePermissionCollection modulePermissions, string permissionKey)
Parameters
Type | Name | Description |
---|---|---|
ModulePermissionCollection | modulePermissions | The Permissions for the Module. |
System.String | permissionKey | The Permission to check. |
Returns
Type | Description |
---|---|
System.Boolean | true if the current user has the requested permission, otherwise false. |
Remarks
If you pass in a comma delimited list of permissions (eg "ADD,DELETE", this will return true if the user has any one of the permissions.
ImplicitRoles(Int32)
Returns a list with all roles with implicit permissions on Modules.
Declaration
public static IEnumerable<RoleInfo> ImplicitRoles(int portalId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | portalId | The Portal Id where the Roles are. |
Returns
Type | Description |
---|---|
IEnumerable<RoleInfo> | A List with the implicit roles. |
SaveModulePermissions(ModuleInfo)
SaveModulePermissions updates a Module's permissions.
Declaration
public static void SaveModulePermissions(ModuleInfo module)
Parameters
Type | Name | Description |
---|---|---|
ModuleInfo | module | The Module to update. |