Table of Contents

Class PlotAccessService

Namespace
FishMMO.Database.Npgsql.Services
Assembly
FishMMO-DB.dll

Reads and writes who an owner has let into their plot.

public sealed class PlotAccessService : BaseService<PlotAccessEntity>, IPlotAccessService
Inheritance
PlotAccessService
Implements
Inherited Members

Constructors

PlotAccessService(INpgsqlDbContextFactory)

public PlotAccessService(INpgsqlDbContextFactory dbContextFactory)

Parameters

dbContextFactory INpgsqlDbContextFactory

Methods

FetchByCharacterAsync(long, CancellationToken)

Every plot one character has been let into.

public Task<DatabaseResult<List<PlotAccessData>>> FetchByCharacterAsync(long characterID, CancellationToken cancellationToken = default)

Parameters

characterID long
cancellationToken CancellationToken

Returns

Task<DatabaseResult<List<PlotAccessData>>>

FetchByPlotAsync(long, CancellationToken)

Everybody with access to one plot.

public Task<DatabaseResult<List<PlotAccessData>>> FetchByPlotAsync(long plotID, CancellationToken cancellationToken = default)

Parameters

plotID long
cancellationToken CancellationToken

Returns

Task<DatabaseResult<List<PlotAccessData>>>

FetchByPlotsAsync(List<long>, CancellationToken)

Every grant across a set of plots, for populating a scene's foundations in one query.

public Task<DatabaseResult<List<PlotAccessData>>> FetchByPlotsAsync(List<long> plotIDs, CancellationToken cancellationToken = default)

Parameters

plotIDs List<long>
cancellationToken CancellationToken

Returns

Task<DatabaseResult<List<PlotAccessData>>>

GrantAsync(long, long, int, long, CancellationToken)

Grants or replaces one character's permissions on a plot.

public Task<DatabaseResult<int>> GrantAsync(long plotID, long characterID, int permissions, long grantedByCharacterID, CancellationToken cancellationToken = default)

Parameters

plotID long
characterID long
permissions int
grantedByCharacterID long
cancellationToken CancellationToken

Returns

Task<DatabaseResult<int>>

Remarks

Replaces rather than adds. A grant is the whole answer to "what may this person do here", so a re-grant that merged with what was already there could never take a permission away — an owner narrowing a friend's access would watch it succeed and change nothing.

RevokeAllAsync(long, CancellationToken)

Removes everybody's access to a plot.

public Task<DatabaseResult<int>> RevokeAllAsync(long plotID, CancellationToken cancellationToken = default)

Parameters

plotID long
cancellationToken CancellationToken

Returns

Task<DatabaseResult<int>>

Remarks

Run when a plot changes hands. A new owner must not inherit the last one's guest list, and a returning owner must not find people they evicted still holding keys.

RevokeAsync(long, long, CancellationToken)

Removes one character's access to a plot.

public Task<DatabaseResult<int>> RevokeAsync(long plotID, long characterID, CancellationToken cancellationToken = default)

Parameters

plotID long
characterID long
cancellationToken CancellationToken

Returns

Task<DatabaseResult<int>>

The number of rows removed: one when they had access, zero when they did not.