• Share
    • Twitter
    • LinkedIn
    • Facebook
    • Email
  • Feedback
  • Improve this Doc

Class RoleController

The RoleController class provides Business Layer methods for Roles.

Inheritance
System.Object
ServiceLocator<IRoleController, RoleController>
RoleController
Implements
IRoleController
Inherited Members
ServiceLocator<IRoleController, RoleController>.Instance
ServiceLocator<IRoleController, RoleController>.Factory
ServiceLocator<IRoleController, RoleController>.SetTestableInstance(IRoleController)
ServiceLocator<IRoleController, RoleController>.ClearInstance()
ServiceLocator<IRoleController, RoleController>.GetFactory()
Namespace: DotNetNuke.Security.Roles
Assembly: DotNetNuke.dll
Syntax
public class RoleController : ServiceLocator<IRoleController, RoleController>, IRoleController

Methods

| Improve this Doc View Source

AddRole(RoleInfo)

Adds a role.

Declaration
public int AddRole(RoleInfo role)
Parameters
Type Name Description
RoleInfo role

The Role to Add.

Returns
Type Description
System.Int32

The Id of the new role.

| Improve this Doc View Source

AddRoleGroup(RoleGroupInfo)

Adds a Role Group.

Declaration
public static int AddRoleGroup(RoleGroupInfo objRoleGroupInfo)
Parameters
Type Name Description
RoleGroupInfo objRoleGroupInfo

The RoleGroup to Add.

Returns
Type Description
System.Int32

The Id of the new role.

| Improve this Doc View Source

AddUserRole(UserInfo, RoleInfo, PortalSettings, DateTime, DateTime, Int32, Boolean)

The RoleController class provides Business Layer methods for Roles.

Declaration
public static void AddUserRole(UserInfo user, RoleInfo role, PortalSettings portalSettings, DateTime effectiveDate, DateTime expiryDate, int userId, bool notifyUser)
Parameters
Type Name Description
UserInfo user
RoleInfo role
PortalSettings portalSettings
DateTime effectiveDate
DateTime expiryDate
System.Int32 userId
System.Boolean notifyUser
| Improve this Doc View Source

AddUserRole(UserInfo, RoleInfo, PortalSettings, RoleStatus, DateTime, DateTime, Boolean, Boolean)

Adds a User to a Role.

Declaration
public static void AddUserRole(UserInfo user, RoleInfo role, PortalSettings portalSettings, RoleStatus status, DateTime effectiveDate, DateTime expiryDate, bool notifyUser, bool isOwner)
Parameters
Type Name Description
UserInfo user

The user to assign.

RoleInfo role

The role to add.

PortalSettings portalSettings

The PortalSettings of the Portal.

RoleStatus status

RoleStatus.

DateTime effectiveDate

The effective Date of the Role membership.

DateTime expiryDate

The expiry Date of the Role membership.

System.Boolean notifyUser

A flag that indicates whether the user should be notified.

System.Boolean isOwner

A flag that indicates whether this user should be one of the group owners.

| Improve this Doc View Source

AddUserRole(Int32, Int32, Int32, DateTime, DateTime)

The RoleController class provides Business Layer methods for Roles.

Declaration
public void AddUserRole(int portalId, int userId, int roleId, DateTime effectiveDate, DateTime expiryDate)
Parameters
Type Name Description
System.Int32 portalId
System.Int32 userId
System.Int32 roleId
DateTime effectiveDate
DateTime expiryDate
| Improve this Doc View Source

AddUserRole(Int32, Int32, Int32, DateTime)

The RoleController class provides Business Layer methods for Roles.

Declaration
public void AddUserRole(int portalId, int userId, int roleId, DateTime expiryDate)
Parameters
Type Name Description
System.Int32 portalId
System.Int32 userId
System.Int32 roleId
DateTime expiryDate
| Improve this Doc View Source

AddUserRole(Int32, Int32, Int32, RoleStatus, Boolean, DateTime, DateTime)

Adds a User to a Role.

Declaration
public void AddUserRole(int portalId, int userId, int roleId, RoleStatus status, bool isOwner, DateTime effectiveDate, DateTime expiryDate)
Parameters
Type Name Description
System.Int32 portalId

The Id of the Portal.

System.Int32 userId

The Id of the User.

System.Int32 roleId

The Id of the Role.

RoleStatus status

The status of the Role.

System.Boolean isOwner

If the user is the owner of the Role.

DateTime effectiveDate

The effective Date of the Role membership.

DateTime expiryDate

The expiry Date of the Role membership.

Remarks

Overload adds Effective Date.

| Improve this Doc View Source

CanRemoveUserFromRole(PortalInfo, Int32, Int32)

Determines if the specified user can be removed from a role.

Declaration
public static bool CanRemoveUserFromRole(PortalInfo portalInfo, int userId, int roleId)
Parameters
Type Name Description
PortalInfo portalInfo

A PortalInfo structure representing the current portal.

System.Int32 userId

The Id of the User.

System.Int32 roleId

The Id of the Role that should be checked for removability.

Returns
Type Description
System.Boolean

true if the role can be removed, otherwise false.

Remarks

Roles such as "Registered Users" and "Administrators" can only be removed in certain circumstances.

| Improve this Doc View Source

CanRemoveUserFromRole(PortalSettings, Int32, Int32)

Determines if the specified user can be removed from a role.

Declaration
public static bool CanRemoveUserFromRole(PortalSettings portalSettings, int userId, int roleId)
Parameters
Type Name Description
PortalSettings portalSettings

A PortalSettings structure representing the current portal settings.

System.Int32 userId

The Id of the User that should be checked for role removability.

System.Int32 roleId

The Id of the Role that should be checked for removability.

Returns
Type Description
System.Boolean

true if the role can be removed, otherwise false.

Remarks

Roles such as "Registered Users" and "Administrators" can only be removed in certain circumstances.

| Improve this Doc View Source

ClearRoleCache(Int32)

Clears Roles cache for the passed portal ID and for the default ID (-1) as well.

Declaration
public void ClearRoleCache(int portalId)
Parameters
Type Name Description
System.Int32 portalId

Id of the portal.

| Improve this Doc View Source

DeleteRole(RoleInfo)

Deletes a role.

Declaration
public void DeleteRole(RoleInfo role)
Parameters
Type Name Description
RoleInfo role

The Role to delete.

| Improve this Doc View Source

DeleteRole(Int32, Int32)

The RoleController class provides Business Layer methods for Roles.

Declaration
public void DeleteRole(int roleId, int portalId)
Parameters
Type Name Description
System.Int32 roleId
System.Int32 portalId
| Improve this Doc View Source

DeleteRoleGroup(RoleGroupInfo)

Deletes a Role Group.

Declaration
public static void DeleteRoleGroup(RoleGroupInfo objRoleGroupInfo)
Parameters
Type Name Description
RoleGroupInfo objRoleGroupInfo

The RoleGroup to Delete.

| Improve this Doc View Source

DeleteRoleGroup(Int32, Int32)

Deletes a Role Group.

Declaration
public static void DeleteRoleGroup(int portalID, int roleGroupId)
Parameters
Type Name Description
System.Int32 portalID
System.Int32 roleGroupId
| Improve this Doc View Source

DeleteUserRole(UserInfo, RoleInfo, PortalSettings, Boolean)

Removes a User from a Role.

Declaration
public static bool DeleteUserRole(UserInfo objUser, RoleInfo role, PortalSettings portalSettings, bool notifyUser)
Parameters
Type Name Description
UserInfo objUser

The user to remove.

RoleInfo role

The role to remove the use from.

PortalSettings portalSettings

The PortalSettings of the Portal.

System.Boolean notifyUser

A flag that indicates whether the user should be notified.

Returns
Type Description
System.Boolean

true if the role was deleted, otherwise false.

| Improve this Doc View Source

GetFactory()

Gets the service locator factory.

Declaration
protected override Func<IRoleController> GetFactory()
Returns
Type Description
Func<IRoleController>

A factory function.

Overrides
DotNetNuke.Framework.ServiceLocator<DotNetNuke.Security.Roles.IRoleController, DotNetNuke.Security.Roles.RoleController>.GetFactory()
| Improve this Doc View Source

GetPortalRoles(Int32)

The RoleController class provides Business Layer methods for Roles.

Declaration
public ArrayList GetPortalRoles(int portalId)
Parameters
Type Name Description
System.Int32 portalId
Returns
Type Description
ArrayList
| Improve this Doc View Source

GetRole(Int32, Func<RoleInfo, Boolean>)

Fetch a single role based on a predicate.

Declaration
public RoleInfo GetRole(int portalId, Func<RoleInfo, bool> predicate)
Parameters
Type Name Description
System.Int32 portalId

Id of the portal.

Func<RoleInfo, System.Boolean> predicate

The predicate (criteria) required.

Returns
Type Description
RoleInfo

A RoleInfo object or null.

| Improve this Doc View Source

GetRole(Int32, Int32)

The RoleController class provides Business Layer methods for Roles.

Declaration
public RoleInfo GetRole(int roleId, int portalId)
Parameters
Type Name Description
System.Int32 roleId
System.Int32 portalId
Returns
Type Description
RoleInfo
| Improve this Doc View Source

GetRoleById(Int32, Int32)

Fetch a single role.

Declaration
public RoleInfo GetRoleById(int portalId, int roleId)
Parameters
Type Name Description
System.Int32 portalId

the portal ID.

System.Int32 roleId

the role ID.

Returns
Type Description
RoleInfo

A RoleInfo object or null.

| Improve this Doc View Source

GetRoleByName(Int32, String)

Fetch a role by roleName and portal ID.

Declaration
public RoleInfo GetRoleByName(int portalId, string roleName)
Parameters
Type Name Description
System.Int32 portalId

the portal ID.

System.String roleName

the role name.

Returns
Type Description
RoleInfo

A RoleInfo object or null.

| Improve this Doc View Source

GetRoleGroup(Int32, Int32)

Fetch a single RoleGroup.

Declaration
public static RoleGroupInfo GetRoleGroup(int portalId, int roleGroupId)
Parameters
Type Name Description
System.Int32 portalId

The Id of the Portal.

System.Int32 roleGroupId

Role Group ID.

Returns
Type Description
RoleGroupInfo

A RoleGroupInfo instance or null.

| Improve this Doc View Source

GetRoleGroupByName(Int32, String)

Fetch a single RoleGroup by Name.

Declaration
public static RoleGroupInfo GetRoleGroupByName(int portalId, string roleGroupName)
Parameters
Type Name Description
System.Int32 portalId

The Id of the Portal.

System.String roleGroupName

Role Group Name.

Returns
Type Description
RoleGroupInfo

A RoleGroupInfo instance or null.

| Improve this Doc View Source

GetRoleGroups(Int32)

Gets an ArrayList of RoleGroups.

Declaration
public static ArrayList GetRoleGroups(int portalID)
Parameters
Type Name Description
System.Int32 portalID

The Id of the Portal.

Returns
Type Description
ArrayList

An ArrayList of RoleGroups.

| Improve this Doc View Source

GetRoles()

The RoleController class provides Business Layer methods for Roles.

Declaration
public ArrayList GetRoles()
Returns
Type Description
ArrayList
| Improve this Doc View Source

GetRoles(Int32, Func<RoleInfo, Boolean>)

Get the roles based on a predicate.

Declaration
public IList<RoleInfo> GetRoles(int portalId, Func<RoleInfo, bool> predicate)
Parameters
Type Name Description
System.Int32 portalId

Id of the portal.

Func<RoleInfo, System.Boolean> predicate

The predicate (criteria) required.

Returns
Type Description
IList<RoleInfo>

A List of RoleInfo objects.

| Improve this Doc View Source

GetRoles(Int32)

Obtains a list of roles from the cache (or for the database if the cache has expired).

Declaration
public IList<RoleInfo> GetRoles(int portalId)
Parameters
Type Name Description
System.Int32 portalId

The id of the portal.

Returns
Type Description
IList<RoleInfo>

The list of roles.

| Improve this Doc View Source

GetRolesBasicSearch(Int32, Int32, String)

get a list of roles based on progressive search.

Declaration
public IList<RoleInfo> GetRolesBasicSearch(int portalId, int pageSize, string filterBy)
Parameters
Type Name Description
System.Int32 portalId

the id of the portal.

System.Int32 pageSize

the number of items to return.

System.String filterBy

the text used to trim data.

Returns
Type Description
IList<RoleInfo>

A list of RoleInfo instances.

| Improve this Doc View Source

GetRolesByGroup(Int32, Int32)

The RoleController class provides Business Layer methods for Roles.

Declaration
public ArrayList GetRolesByGroup(int portalId, int roleGroupId)
Parameters
Type Name Description
System.Int32 portalId
System.Int32 roleGroupId
Returns
Type Description
ArrayList
| Improve this Doc View Source

GetRoleSettings(Int32)

Gets the settings for a role.

Declaration
public IDictionary<string, string> GetRoleSettings(int roleId)
Parameters
Type Name Description
System.Int32 roleId

Id of the role.

Returns
Type Description
IDictionary<System.String, System.String>

A Dictionary of settings.

| Improve this Doc View Source

GetUserRole(Int32, Int32, Int32)

Gets a User/Role.

Declaration
public UserRoleInfo GetUserRole(int portalId, int userId, int roleId)
Parameters
Type Name Description
System.Int32 portalId

The Id of the Portal.

System.Int32 userId

The Id of the user.

System.Int32 roleId

The Id of the Role.

Returns
Type Description
UserRoleInfo

A UserRoleInfo object.

| Improve this Doc View Source

GetUserRoles(UserInfo, Boolean)

Gets a list of UserRoles for the user.

Declaration
public IList<UserRoleInfo> GetUserRoles(UserInfo user, bool includePrivate)
Parameters
Type Name Description
UserInfo user

A UserInfo object representing the user.

System.Boolean includePrivate

Include private roles.

Returns
Type Description
IList<UserRoleInfo>

A list of UserRoleInfo objects.

| Improve this Doc View Source

GetUserRoles(Int32, String, String)

Gets a list of UserRoles for the user.

Declaration
public IList<UserRoleInfo> GetUserRoles(int portalId, string userName, string roleName)
Parameters
Type Name Description
System.Int32 portalId

Id of the portal.

System.String userName

The user to fetch roles for.

System.String roleName

The role to fetch users for.

Returns
Type Description
IList<UserRoleInfo>

A list of UserRoleInfo objects.

| Improve this Doc View Source

GetUsersByRole(Int32, String)

Get the users in a role (as User objects).

Declaration
public IList<UserInfo> GetUsersByRole(int portalId, string roleName)
Parameters
Type Name Description
System.Int32 portalId

Id of the portal (If -1 all roles for all portals are retrieved).

System.String roleName

The role to fetch users for.

Returns
Type Description
IList<UserInfo>

A List of UserInfo objects.

| Improve this Doc View Source

GetUsersByRoleName(Int32, String)

The RoleController class provides Business Layer methods for Roles.

Declaration
public ArrayList GetUsersByRoleName(int portalId, string roleName)
Parameters
Type Name Description
System.Int32 portalId
System.String roleName
Returns
Type Description
ArrayList
| Improve this Doc View Source

SerializeRoleGroups(XmlWriter, Int32)

Serializes the role groups.

Declaration
public static void SerializeRoleGroups(XmlWriter writer, int portalID)
Parameters
Type Name Description
XmlWriter writer

An XmlWriter.

System.Int32 portalID

The Id of the Portal.

| Improve this Doc View Source

UpdateRole(RoleInfo, Boolean)

Persists a role to the Data Store.

Declaration
public void UpdateRole(RoleInfo role, bool addToExistUsers)
Parameters
Type Name Description
RoleInfo role

The role to persist.

System.Boolean addToExistUsers

Add this role on all exist users if auto assignment is true.

| Improve this Doc View Source

UpdateRole(RoleInfo)

The RoleController class provides Business Layer methods for Roles.

Declaration
public void UpdateRole(RoleInfo role)
Parameters
Type Name Description
RoleInfo role
| Improve this Doc View Source

UpdateRoleGroup(RoleGroupInfo, Boolean)

The RoleController class provides Business Layer methods for Roles.

Declaration
public static void UpdateRoleGroup(RoleGroupInfo roleGroup, bool includeRoles)
Parameters
Type Name Description
RoleGroupInfo roleGroup
System.Boolean includeRoles
| Improve this Doc View Source

UpdateRoleGroup(RoleGroupInfo)

Updates a Role Group.

Declaration
public static void UpdateRoleGroup(RoleGroupInfo roleGroup)
Parameters
Type Name Description
RoleGroupInfo roleGroup

The RoleGroup to Update.

| Improve this Doc View Source

UpdateRoleSettings(RoleInfo, Boolean)

Update the role settings.

Declaration
public void UpdateRoleSettings(RoleInfo role, bool clearCache)
Parameters
Type Name Description
RoleInfo role

The Role.

System.Boolean clearCache

A flag that indicates whether the cache should be cleared.

| Improve this Doc View Source

UpdateUserRole(Int32, Int32, Int32, RoleStatus, Boolean, Boolean)

Updates a Service (UserRole).

Declaration
public void UpdateUserRole(int portalId, int userId, int roleId, RoleStatus status, bool isOwner, bool cancel)
Parameters
Type Name Description
System.Int32 portalId

The Id of the Portal.

System.Int32 userId

The Id of the User.

System.Int32 roleId

The Id of the Role.

RoleStatus status

The status of the Role.

System.Boolean isOwner

If the user is the owner of the Role.

System.Boolean cancel

A flag that indicates whether to cancel (delete) the user-role.

| Improve this Doc View Source

UpdateUserRole(Int32, Int32, Int32, Boolean)

The RoleController class provides Business Layer methods for Roles.

Declaration
public void UpdateUserRole(int portalId, int userId, int roleId, bool cancel)
Parameters
Type Name Description
System.Int32 portalId
System.Int32 userId
System.Int32 roleId
System.Boolean cancel
| Improve this Doc View Source

UpdateUserRole(Int32, Int32, Int32)

The RoleController class provides Business Layer methods for Roles.

Declaration
public void UpdateUserRole(int portalId, int userId, int roleId)
Parameters
Type Name Description
System.Int32 portalId
System.Int32 userId
System.Int32 roleId

Explicit Interface Implementations

| Improve this Doc View Source

IRoleController.AddRole(RoleInfo, Boolean)

Adds a role.

Declaration
int IRoleController.AddRole(RoleInfo role, bool addToExistUsers)
Parameters
Type Name Description
RoleInfo role

The Role to Add.

System.Boolean addToExistUsers

Add this role on all exist users if auto assignment is true.

Returns
Type Description
System.Int32

The Id of the new role.

| Improve this Doc View Source

IRoleController.UpdateRole(RoleInfo)

Persists a role to the Data Store.

Declaration
void IRoleController.UpdateRole(RoleInfo role)
Parameters
Type Name Description
RoleInfo role

The role to persist.

Implements

IRoleController

Extension Methods

JsonExtensionsWeb.ToJson(Object)
  • View Source
Back to top by the community, for the community... #DNNCMS