Table of Contents

Class AccessControlService

Namespace
Shard.Server.Modules.AccessControl
Assembly
Shard.Server.Modules.dll

Runtime in-memory access control with JSON persistence: bans and an optional whitelist, keyed by player UUID. Thread-safe.

public sealed class AccessControlService : IAccessControlService
Inheritance
AccessControlService
Implements
Inherited Members

Constructors

AccessControlService(IPermissionService?, string)

public AccessControlService(IPermissionService? permissions = null, string path = "access_control.json")

Parameters

permissions IPermissionService
path string

Properties

Banned

public IReadOnlyCollection<Guid> Banned { get; }

Property Value

IReadOnlyCollection<Guid>

Whitelisted

public IReadOnlyCollection<Guid> Whitelisted { get; }

Property Value

IReadOnlyCollection<Guid>

Methods

Ban(Guid, string?)

public bool Ban(Guid uuid, string? reason = null)

Parameters

uuid Guid
reason string

Returns

bool

DisableWhitelist()

public void DisableWhitelist()

EnableWhitelist()

public void EnableWhitelist()

IsAllowed(Guid)

Return whether the UUID is allowed to join/play: false if banned; if any whitelisted entries exist then only whitelisted UUIDs (or ops) are allowed.

public Reason IsAllowed(Guid uuid)

Parameters

uuid Guid

Returns

Reason

IsBanned(Guid)

public bool IsBanned(Guid uuid)

Parameters

uuid Guid

Returns

bool

IsWhitelistEnabled()

public bool IsWhitelistEnabled()

Returns

bool

IsWhitelisted(Guid)

public bool IsWhitelisted(Guid uuid)

Parameters

uuid Guid

Returns

bool

Unban(Guid)

public bool Unban(Guid uuid)

Parameters

uuid Guid

Returns

bool

Unwhitelist(Guid)

public void Unwhitelist(Guid uuid)

Parameters

uuid Guid

Whitelist(Guid)

public void Whitelist(Guid uuid)

Parameters

uuid Guid