IDapperMaticAccessRepository
Namespace: MJCZone.DapperMatic.AspNetCore.Repositories
Assembly: MJCZone.DapperMatic.AspNetCore
Summary
Keeps the policies and tenants edited at runtime through DapperMatic's access endpoints, alongside those given in code and configuration: in memory (the default), in a file, or in a database table.
abstract public
Note: This is an interface that defines a contract. Look for implementing classes in the same or related namespaces.
Contents
Methods (10)
Methods
| Method | Summary |
|---|---|
| GetAsync | Reads every policy and tenant kept. |
| SavePolicyAsync | Adds a policy, or replaces the one of the same name and tenant: a tenant's policies have names of th... |
| DeletePolicyAsync | Removes a policy. |
| SaveTenantAsync | Adds a tenant, or replaces the one of the same id. |
| DeleteTenantAsync | Removes a tenant. |
| SaveWebhookAsync | Adds a webhook, or replaces the one of the same name and tenant. |
| DeleteWebhookAsync | Removes a webhook. |
| SaveServiceAccountAsync | Adds a service account, or replaces the one of the same name and tenant. |
| DeleteServiceAccountAsync | Removes a service account. |
| ReplaceAsync | Replaces everything kept, at once. |
GetAsync
Reads every policy and tenant kept.
Task<DapperMaticAccessDocument> GetAsync(CancellationToken cancellationToken)Parameters
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task<DapperMaticAccessDocument>
The policies and tenants.
SavePolicyAsync
Adds a policy, or replaces the one of the same name and tenant: a tenant's policies have names of their own.
Task SavePolicyAsync(DmPolicy policy, CancellationToken cancellationToken)Parameters
- policy (DmPolicy) - The policy, which has a name, and a tenant if it is one of a tenant's.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task
A task.
DeletePolicyAsync
Removes a policy.
Task<bool> DeletePolicyAsync(
string name,
string tenant,
CancellationToken cancellationToken)Parameters
- name (string) - The policy's name.
- tenant (string) - The tenant it is one of, or null for one of the whole application.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task<bool>
True if it was kept.
SaveTenantAsync
Adds a tenant, or replaces the one of the same id.
Task SaveTenantAsync(
string id,
DapperMaticTenantSettings tenant,
CancellationToken cancellationToken)Parameters
- id (string) - The tenant's id.
- tenant (DapperMaticTenantSettings) - What is known of it.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task
A task.
DeleteTenantAsync
Removes a tenant.
Task<bool> DeleteTenantAsync(string id, CancellationToken cancellationToken)Parameters
- id (string) - The tenant's id.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task<bool>
True if it was kept.
SaveWebhookAsync
Adds a webhook, or replaces the one of the same name and tenant.
Task SaveWebhookAsync(
DapperMaticWebhook webhook,
CancellationToken cancellationToken)Parameters
- webhook (DapperMaticWebhook) - The webhook, which has a name, and a tenant if it is one of a tenant's.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task
A task.
DeleteWebhookAsync
Removes a webhook.
Task<bool> DeleteWebhookAsync(
string name,
string tenant,
CancellationToken cancellationToken)Parameters
- name (string) - The webhook's name.
- tenant (string) - The tenant it is one of, or null for one of the whole application.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task<bool>
True if it was kept.
SaveServiceAccountAsync
Adds a service account, or replaces the one of the same name and tenant.
Task SaveServiceAccountAsync(
DapperMaticServiceAccount account,
CancellationToken cancellationToken)Parameters
- account (DapperMaticServiceAccount) - The account, which has a name, and a tenant if it is one of a tenant's.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task
A task.
DeleteServiceAccountAsync
Removes a service account.
Task<bool> DeleteServiceAccountAsync(
string name,
string tenant,
CancellationToken cancellationToken)Parameters
- name (string) - The account's name.
- tenant (string) - The tenant it is one of, or null for one of the whole application.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task<bool>
True if it was kept.
ReplaceAsync
Replaces everything kept, at once.
Task ReplaceAsync(
DapperMaticAccessDocument document,
CancellationToken cancellationToken)Parameters
- document (DapperMaticAccessDocument) - The policies and tenants to keep.
- cancellationToken (CancellationToken) - The cancellation token.
Returns
Type: Task
A task.