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, re-scoping their password credentials with them.

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>

Written, UnknownUser, UnknownOrganization, AssignmentsOutsideOrganization carrying how many of their accounts stand outside the target, UsernameTaken carrying the colliding username where it could be read, or RecordLeftInvalid carrying what the target's settings policy would leave their record without.

Remarks

Nothing is unassigned on the administrator's behalf: a user assigned an account the target would not admit stays where they are. A move changes which settings policy governs the user, so the same commit writes the endpoint switches their record resolves to under the target's policy and moves their record's version, which is what has every replica compose them again; and nothing is rewritten on the record itself to make a move pass.

Exceptions

ArgumentException

Thrown when user names nobody.