Interface IRoleController
Namespace: DotNetNuke.Security.Roles
Assembly: DotNetNuke.dll
Syntax
public interface IRoleController
Methods
| Improve this Doc View SourceAddRole(RoleInfo, Boolean)
Adds a role.
Declaration
int 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. |
AddRole(RoleInfo)
Adds a role.
Declaration
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. |
AddUserRole(Int32, Int32, Int32, RoleStatus, Boolean, DateTime, DateTime)
Adds a User to a Role.
Declaration
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.
ClearRoleCache(Int32)
Clears Roles cache for the passed portal ID and for the default ID (-1) as well.
Declaration
void ClearRoleCache(int portalId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | portalId | Id of the portal. |
DeleteRole(RoleInfo)
Deletes a role.
Declaration
void DeleteRole(RoleInfo role)
Parameters
Type | Name | Description |
---|---|---|
RoleInfo | role | The Role to delete. |
GetRole(Int32, Func<RoleInfo, Boolean>)
Fetch a single role based on a predicate.
Declaration
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. |
GetRoleById(Int32, Int32)
Fetch a single role.
Declaration
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 |
|
GetRoleByName(Int32, String)
Fetch a role by roleName
and portal ID.
Declaration
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 |
|
GetRoles(Int32, Func<RoleInfo, Boolean>)
Get the roles based on a predicate.
Declaration
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. |
GetRoles(Int32)
Obtains a list of roles from the cache (or for the database if the cache has expired).
Declaration
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. |
GetRolesBasicSearch(Int32, Int32, String)
get a list of roles based on progressive search.
Declaration
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. |
GetRoleSettings(Int32)
Gets the settings for a role.
Declaration
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. |
GetUserRole(Int32, Int32, Int32)
Gets a User/Role.
Declaration
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. |
GetUserRoles(UserInfo, Boolean)
Gets a list of UserRoles for the user.
Declaration
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. |
GetUserRoles(Int32, String, String)
Gets a list of UserRoles for the user.
Declaration
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. |
GetUsersByRole(Int32, String)
Get the users in a role (as User objects).
Declaration
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. |
UpdateRole(RoleInfo, Boolean)
Persists a role to the Data Store.
Declaration
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. |
UpdateRole(RoleInfo)
Persists a role to the Data Store.
Declaration
void UpdateRole(RoleInfo role)
Parameters
Type | Name | Description |
---|---|---|
RoleInfo | role | The role to persist. |
UpdateRoleSettings(RoleInfo, Boolean)
Update the role settings.
Declaration
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. |
UpdateUserRole(Int32, Int32, Int32, RoleStatus, Boolean, Boolean)
Updates a Service (UserRole).
Declaration
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. |