Method ProvisionAsync
- Namespace
- MailFathom.Application.Access
- Assembly
- MailFathom.Application.dll
ProvisionAsync(UserId, string, Guid?, CancellationToken)
Records a user this deployment did not hold, under the identifier they are declared with.
Task<UserProvisioningResult> ProvisionAsync(UserId user, string displayName, Guid? organizationId, CancellationToken cancellationToken)
Parameters
userUserIdThe identity the user is declared under, which every mail account of theirs will name.
displayNamestringThe label the user is told apart by.
organizationIdGuid?The organization the user is recorded into, or null to record them in none.
cancellationTokenCancellationTokenCancels the write.
Returns
- Task<UserProvisioningResult>
Provisioned when the deployment holds this user once the write has run, or why it holds no row for them.
Remarks
The answer is what the deployment holds afterwards rather than whether this call was the one that wrote it, so a replica that lost the race to an identical declaration is told the same thing as the one that won. The refusals are the outcomes a caller has to act on: the label is unique across the deployment, and the organization has to stand when the row is written.
The user enters the organization in the statement that records them rather than in a move afterwards, so an administrator scoped to that organization never records somebody who stands, even for a moment, where only the deployment's scope reaches them.
Exceptions
- ArgumentException
Thrown when
usernames nobody,displayNameis null, empty, or white space, ororganizationIdis empty.