Table of Contents

Class HytalePermissionProvider

Namespace
Shard.Server.Modules.Permissions.Providers
Assembly
Shard.Server.Modules.dll

Default JSON-backed permission provider. Resolution order is user permission, then user groups in stored order, then unresolved.

public sealed class HytalePermissionProvider : PermissionProvider
Inheritance
HytalePermissionProvider
Implements
Inherited Members

Constructors

HytalePermissionProvider(string, PermissionProviderPriority, string)

public HytalePermissionProvider(string path, PermissionProviderPriority priority = PermissionProviderPriority.Normal, string name = "default")

Parameters

path string
priority PermissionProviderPriority
name string

Properties

Name

The name of the permission provider

public string Name { get; }

Property Value

string

Priority

The priority of the permission provider.

public PermissionProviderPriority Priority { get; }

Property Value

PermissionProviderPriority

Methods

AddUserToGroup(Guid, string)

Add a user to a group

public bool AddUserToGroup(Guid uuid, string group)

Parameters

uuid Guid

The UUID of the user

group string

The group to add the user to

Returns

bool

true if the user was added to the group; otherwise, false.

GetGroupPermissions(string)

Gets all explicitly assigned permissions for a group.

public IReadOnlyDictionary<string, bool> GetGroupPermissions(string group)

Parameters

group string

The 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.

public IReadOnlyList<string> GetUserGroups(Guid uuid)

Parameters

uuid Guid

The UUID of the user

Returns

IReadOnlyList<string>

A read-only list of group names.

GetUserPermissions(Guid)

Gets all explicitly assigned permissions for a user.

public IReadOnlyDictionary<string, bool> GetUserPermissions(Guid uuid)

Parameters

uuid Guid

The 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.

public bool? HasPermission(Guid uuid, string node)

Parameters

uuid Guid

The UUID of the user to check

node string

The permission node to check

Returns

bool?

true if the permission is granted; otherwise, false.

RemoveGroupPermission(string, string)

Removes an explicitly assigned permission from a group

public void RemoveGroupPermission(string group, string node)

Parameters

group string

The group to remove the permission from

node string

The permission node to remove

RemoveUserFromGroup(Guid, string)

Removes a user from a group

public bool RemoveUserFromGroup(Guid uuid, string group)

Parameters

uuid Guid

The UUID of the user

group string

The group to remove the user from

Returns

bool

true if the user was removed from the group; otherwise, false.

RemoveUserPermission(Guid, string)

Removes an explicitly assigned permission

public void RemoveUserPermission(Guid uuid, string node)

Parameters

uuid Guid

The UUID of the user

node string

The permission node to remove

SetGroupPermission(string, string, bool)

Sets a permission for a group

public void SetGroupPermission(string group, string node, bool value)

Parameters

group string

The group to set the permission for

node string

The permission node to set

value bool

The value to set the permission to

SetUserGroups(Guid, IEnumerable<string>)

Replaces the group assigned to a user.

public void SetUserGroups(Guid uuid, IEnumerable<string> groups)

Parameters

uuid Guid

The UUID of the user

groups IEnumerable<string>

The groups the user should belong to

SetUserPermission(Guid, string, bool)

Set or update a permission for a user

public void SetUserPermission(Guid uuid, string node, bool value)

Parameters

uuid Guid

The UUID of the user

node string

The permission node to set

value bool

The value to set the permission to