Class RoleManager
Manage all roles in the
Inheritance
Inherited Members
Namespace: Simplic.Framework.Core
Assembly: Simplic.Framework.Base.dll
Syntax
public class RoleManager
Properties
| Improve this Doc View SourceSingleton
Singleton access to the role manager, because the class is not instanceable
Declaration
public static RoleManager Singleton { get; }
Property Value
Type | Description |
---|---|
RoleManager |
Methods
| Improve this Doc View SourceCreateRole(Role)
Create a new role and save it in the database
Declaration
public Role CreateRole(Role role)
Parameters
Type | Name | Description |
---|---|---|
Role | role | Instance of a role object |
Returns
Type | Description |
---|---|
Role | Saved role object, with a RoleId and ExportId if not set before |
DeleteRole(Role)
Delete a role from the database
Declaration
public void DeleteRole(Role role)
Parameters
Type | Name | Description |
---|---|---|
Role | role | Role model isntance |
DeleteRole(Guid)
Delete a roler from the database
Declaration
public void DeleteRole(Guid role)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | role |
DeleteRoles(IList<Role>)
Delete roles from the database
Declaration
public void DeleteRoles(IList<Role> roles)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<Role> | roles | Roles to delete |
DeleteRoles(IList<Guid>)
Delete roles from the database
Declaration
public void DeleteRoles(IList<Guid> roles)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<System.Guid> | roles | List of roles to delete |
GetRole(Guid)
Get a role from the database
Declaration
public Role GetRole(Guid roleId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | roleId | Id of the role |
Returns
Type | Description |
---|---|
Role | Instance of a role model |
GetRole(String)
Get a role from the database
Declaration
public Role GetRole(string internName)
Parameters
Type | Name | Description |
---|---|---|
System.String | internName | Get role by its intern name |
Returns
Type | Description |
---|---|
Role | Instance of a role model |
ShowNewRoleEditor()
Show the editor for adding new roles
Declaration
public void ShowNewRoleEditor()
ShowRoleEditor(IList<Guid>)
Show the editor for editing a list of roles
Declaration
public void ShowRoleEditor(IList<Guid> roles)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<System.Guid> | roles | List of roles |
UpdateRole(Role)
Update a role in the database
Declaration
public void UpdateRole(Role role)
Parameters
Type | Name | Description |
---|---|---|
Role | role | Instance of the role to update. The role must exists |
UserHasRoleAccess(String, Int32)
Proof whether the current user has access for a role. If no settings are assigned, the method will return false
Declaration
public bool UserHasRoleAccess(string roleName, int userId)
Parameters
Type | Name | Description |
---|---|---|
System.String | roleName | Intern name of the role |
System.Int32 | userId | Id of the user |
Returns
Type | Description |
---|---|
System.Boolean | True if the access is allowed for the current user, false if not and also false if nothing is set. |
UserHasRoleAccessWithDefault(String, Int32)
Proof whether the current user has access for a role. If the method returns null, no settings are set.
Declaration
public bool? UserHasRoleAccessWithDefault(string roleName, int userId)
Parameters
Type | Name | Description |
---|---|---|
System.String | roleName | Intern name of the role |
System.Int32 | userId | Id of the user |
Returns
Type | Description |
---|---|
System.Nullable<System.Boolean> | True if the access is allowed for the current user, false if not and null if for no one. |