OpenMod Docs OpenMod Docs
OpenMod Docs OpenMod Docs
OpenMod .NET Plugin Framework.

Interface IPermissionRoleStore

The service used for storing permission roles.

Namespace: OpenMod.API.Permissions
Assembly: OpenMod.API.dll
Syntax
public interface IPermissionRoleStore

Methods

| Improve this Doc View Source

AddRoleToActorAsync(IPermissionActor, String)

Adds a role to a user.

Declaration
Task<bool> AddRoleToActorAsync(IPermissionActor actor, string roleId)
Parameters
Type Name Description
IPermissionActor actor

The actor to add the role to.

System.String roleId

The roleId to add.

Returns
Type Description
Task<System.Boolean>

true if the role was successfully added or already exists; otherwise, false.

| Improve this Doc View Source

CreateRoleAsync(IPermissionRole)

Creates a new permission role.

Declaration
Task<bool> CreateRoleAsync(IPermissionRole role)
Parameters
Type Name Description
IPermissionRole role

The role to create.

Returns
Type Description
Task<System.Boolean>

true if the role was successfully created; otherwise, false.

| Improve this Doc View Source

DeleteRoleAsync(String)

Deletes a permission role.

Declaration
Task<bool> DeleteRoleAsync(string roleId)
Parameters
Type Name Description
System.String roleId

The roleId to delete.

Returns
Type Description
Task<System.Boolean>

true if the role was successfully deleted or doesn't exist; otherwise, false.

| Improve this Doc View Source

GetAutoAssignedRolesAsync(String, String)

Gets the roles that will be auto assigned for the actor.

Declaration
Task<IReadOnlyCollection<string>> GetAutoAssignedRolesAsync(string actorId, string actorType)
Parameters
Type Name Description
System.String actorId
System.String actorType
Returns
Type Description
Task<IReadOnlyCollection<System.String>>
| Improve this Doc View Source

GetPersistentDataAsync<T>(String, String)

Gets persistent data. T must be serializable.

Declaration
Task<T> GetPersistentDataAsync<T>(string roleId, string key)
Parameters
Type Name Description
System.String roleId
System.String key
Returns
Type Description
Task<T>
Type Parameters
Name Description
T
| Improve this Doc View Source

GetRoleAsync(String)

Gets a permission role.

Declaration
Task<IPermissionRole> GetRoleAsync(string roleId)
Parameters
Type Name Description
System.String roleId
Returns
Type Description
Task<IPermissionRole>

the permission role if found; otherwise, null.

| Improve this Doc View Source

GetRolesAsync()

Gets all permission roles.

Declaration
Task<IReadOnlyCollection<IPermissionRole>> GetRolesAsync()
Returns
Type Description
Task<IReadOnlyCollection<IPermissionRole>>

all permission roles.

| Improve this Doc View Source

GetRolesAsync(IPermissionActor, Boolean)

Gets all roles inherited by the actor.

Declaration
Task<IReadOnlyCollection<IPermissionRole>> GetRolesAsync(IPermissionActor actor, bool inherit = true)
Parameters
Type Name Description
IPermissionActor actor

The actor.

System.Boolean inherit

Defines if the parent roles permissions should be included.

Returns
Type Description
Task<IReadOnlyCollection<IPermissionRole>>

the inherited roles of the actor.

| Improve this Doc View Source

RemoveRoleFromActorAsync(IPermissionActor, String)

Removes a role from a user.

Declaration
Task<bool> RemoveRoleFromActorAsync(IPermissionActor actor, string roleId)
Parameters
Type Name Description
IPermissionActor actor

The actor to add the role to.

System.String roleId

The roleId to remove.

Returns
Type Description
Task<System.Boolean>

true if the role was successfully removed or doesn't exist; otherwise, false.

| Improve this Doc View Source

SavePersistentDataAsync<T>(String, String, T)

Saves persistent data. T must be serializable.

Declaration
Task SavePersistentDataAsync<T>(string roleId, string key, T data)
Parameters
Type Name Description
System.String roleId
System.String key
T data
Returns
Type Description
Task
Type Parameters
Name Description
T
| Improve this Doc View Source

UpdateRoleAsync(IPermissionRole)

Updates a role.

Declaration
Task<bool> UpdateRoleAsync(IPermissionRole role)
Parameters
Type Name Description
IPermissionRole role

The role to update.

Returns
Type Description
Task<System.Boolean>

true if the role exists and could be updated; otherwise, false.

Extension Methods

DisposeHelper.DisposeSyncOrAsync(Object)