Table of Contents

Method SetUserOrganizationAsync

Namespace
MailFathom.Application.Access.Organizations
Assembly
MailFathom.Application.dll

SetUserOrganizationAsync(UserId, Guid?, CancellationToken)

Moves a user into an organization, or out of every organization.

public Task<OrganizationWriteResult> SetUserOrganizationAsync(UserId user, Guid? organizationId, CancellationToken cancellationToken)

Parameters

user UserId

The user being moved.

organizationId Guid?

The organization to move them into, or null to leave them in none.

cancellationToken CancellationToken

Cancels the write.

Returns

Task<OrganizationWriteResult>

What the act did, carrying the colliding username where the target already holds one of theirs.

Remarks

Both sides have to be covered: the user where they stand now, and the organization they are moved into. Leaving every organization is a move into what only the deployment's scope covers, so only the deployment's scope writes it, and it is refused by name because it names no organization whose existence a refusal could disclose. A user outside the caller's scope is answered as unknown and an organization outside it as unknown, each the way the write answers one that does not exist.

Exceptions

ArgumentException

Thrown when user names nobody, or organizationId is empty.

PrincipalNotAuthorizedException

Thrown when the caller holds AdminCredentialsWrite at no scope, or moves a user out of every organization without holding it over the whole deployment.