Interface PermissionProvider
- Namespace
- Shard.Server.Modules.Permissions.Providers
- Assembly
- Shard.Server.Modules.dll
Pluggable permission source used by PermissionService. Return null to defer to lower-priority providers.
public interface PermissionProvider
Properties
Name
The name of the permission provider
string Name { get; }
Property Value
Priority
The priority of the permission provider.
PermissionProviderPriority Priority { get; }
Property Value
Methods
AddUserToGroup(Guid, string)
Add a user to a group
bool AddUserToGroup(Guid uuid, string group)
Parameters
Returns
- bool
true if the user was added to the group; otherwise, false.
GetGroupPermissions(string)
Gets all explicitly assigned permissions for a group.
IReadOnlyDictionary<string, bool> GetGroupPermissions(string group)
Parameters
groupstringThe group to get permissions for
Returns
- IReadOnlyDictionary<string, bool>
A read-only dictionary mapping permission nodes to their granted or denied state.
GetUserGroups(Guid)
Gets the groups currently assigned to a user.
IReadOnlyList<string> GetUserGroups(Guid uuid)
Parameters
uuidGuidThe UUID of the user
Returns
- IReadOnlyList<string>
A read-only list of group names.
GetUserPermissions(Guid)
Gets all explicitly assigned permissions for a user.
IReadOnlyDictionary<string, bool> GetUserPermissions(Guid uuid)
Parameters
uuidGuidThe UUID of the user
Returns
- IReadOnlyDictionary<string, bool>
A read-only dictionary mapping permission nodes to their granted or denied state.
HasPermission(Guid, string)
Determines whether a user has a specific permission node or not. Highest priority provider -> Lowest Priority Provider. User permissions are checked before group-inherited permissions.
bool? HasPermission(Guid uuid, string node)
Parameters
Returns
RemoveGroupPermission(string, string)
Removes an explicitly assigned permission from a group
void RemoveGroupPermission(string group, string node)
Parameters
RemoveUserFromGroup(Guid, string)
Removes a user from a group
bool RemoveUserFromGroup(Guid uuid, string group)
Parameters
Returns
- bool
true if the user was removed from the group; otherwise, false.
RemoveUserPermission(Guid, string)
Removes an explicitly assigned permission
void RemoveUserPermission(Guid uuid, string node)
Parameters
SetGroupPermission(string, string, bool)
Sets a permission for a group
void SetGroupPermission(string group, string node, bool value)
Parameters
groupstringThe group to set the permission for
nodestringThe permission node to set
valueboolThe value to set the permission to
SetUserGroups(Guid, IEnumerable<string>)
Replaces the group assigned to a user.
void SetUserGroups(Guid uuid, IEnumerable<string> groups)
Parameters
uuidGuidThe UUID of the user
groupsIEnumerable<string>The groups the user should belong to
SetUserPermission(Guid, string, bool)
Set or update a permission for a user
void SetUserPermission(Guid uuid, string node, bool value)