Table of Contents

Method SetMailAccountOrganizationAsync

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

SetMailAccountOrganizationAsync(Guid, Guid?, CancellationToken)

Moves a mail account into an organization, or out of every organization.

public Task<OrganizationWriteResult> SetMailAccountOrganizationAsync(Guid mailAccountId, Guid? organizationId, CancellationToken cancellationToken)

Parameters

mailAccountId Guid

The mail account being moved.

organizationId Guid?

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

cancellationToken CancellationToken

Cancels the write.

Returns

Task<OrganizationWriteResult>

What the act did, carrying how many of its users stand outside the target where that refused it, or how many it is assigned to where leaving every organization would have left it shared; an account or an organization outside the caller's scope is answered as one the deployment does not hold.

Remarks

Both sides have to be covered, as for SetUserOrganizationAsync(UserId, Guid?, CancellationToken): the account where it sits now, and the organization it is moved into. An account in no organization is covered by the deployment alone, so leaving every organization is the deployment's to write, and it is refused by name before the account is read because it names no organization whose existence a refusal could disclose. A move changes which settings policy governs the account, so the store is told whether the mover holds the permission below the deployment: such a grant may not move the effective settings of an account naming a secret that was not provisioned for one of its users.

Exceptions

PrincipalNotAuthorizedException

Thrown when the caller holds AdminConfigurationWrite at no scope, or moves an account out of every organization without holding it over the whole deployment.