Interface ITenants
- Namespace
- GroupeIsa.Neos.Application.MultiTenant
- Assembly
- GroupeIsa.Neos.Application.Abstractions.dll
Provides the functionalities of tenants management.
public interface ITenants
Properties
MultitenancyEnabled
Gets a value indicating whether the multitenancy is enabled.
bool MultitenancyEnabled { get; }
Property Value
Methods
GetAuthenticatedResultAsync()
Gets the authenticated result from tenants authorization.
Task<OnAuthenticatedResult> GetAuthenticatedResultAsync()
Returns
- Task<OnAuthenticatedResult>
The authenticated result.
GetAuthorizedTenantsAsync(string, CancellationToken)
Gets the authorized tenants for a user.
Task<IEnumerable<AuthorizedTenant>> GetAuthorizedTenantsAsync(string userId, CancellationToken cancellationToken = default)
Parameters
userIdstringUser ID.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<IEnumerable<AuthorizedTenant>>
The authorized tenant identifiers.
GetAuthorizedTenantsAsync(CancellationToken)
Gets the authorized tenants for the authenticated user.
Task<IEnumerable<AuthorizedTenant>> GetAuthorizedTenantsAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<IEnumerable<AuthorizedTenant>>
The authorized tenant identifiers.
GetCurrentTenant()
Gets the information about the current tenant.
NeosTenantInfo? GetCurrentTenant()
Returns
- NeosTenantInfo
The current tenant on
nullif there is not current tenant.
GetCurrentTenantIdentifier()
Gets the current tenant identifier.
string GetCurrentTenantIdentifier()
Returns
- string
The current tenant identifier.
IsAuthorizedAsync()
Gets a value indicating whether the authenticated user is authorized for the current tenant.
Task<bool> IsAuthorizedAsync()
Returns
LockTenant()
Locks the tenant to prevent further changes. This method is called when the DbContext is initialized.
void LockTenant()
SetCurrentTenant(NeosTenantInfo)
Sets a tenant in the current scope.
void SetCurrentTenant(NeosTenantInfo neosTenantInfo)
Parameters
neosTenantInfoNeosTenantInfoThe tenant info.
SetCurrentTenantAsync(string)
Sets a tenant in the current scope.
Task<bool> SetCurrentTenantAsync(string tenantId)
Parameters
tenantIdstringThe tenant identifier.