Class PlotAccessService
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
dbContextFactoryINpgsqlDbContextFactory
Methods
FetchByCharacterAsync(long, CancellationToken)
Every plot one character has been let into.
public Task<DatabaseResult<List<PlotAccessData>>> FetchByCharacterAsync(long characterID, CancellationToken cancellationToken = default)
Parameters
characterIDlongcancellationTokenCancellationToken
Returns
FetchByPlotAsync(long, CancellationToken)
Everybody with access to one plot.
public Task<DatabaseResult<List<PlotAccessData>>> FetchByPlotAsync(long plotID, CancellationToken cancellationToken = default)
Parameters
plotIDlongcancellationTokenCancellationToken
Returns
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
plotIDsList<long>cancellationTokenCancellationToken
Returns
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
plotIDlongcharacterIDlongpermissionsintgrantedByCharacterIDlongcancellationTokenCancellationToken
Returns
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
plotIDlongcancellationTokenCancellationToken
Returns
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
plotIDlongcharacterIDlongcancellationTokenCancellationToken
Returns
- Task<DatabaseResult<int>>
The number of rows removed: one when they had access, zero when they did not.