Table of Contents

Class MailboxScopeResolver

Namespace
MailFathom.Application.Emails.Mailboxes
Assembly
MailFathom.Application.dll

Decides which accounts and folders a mailbox read actually runs against.

public sealed class MailboxScopeResolver
Inheritance
MailboxScopeResolver
Inherited Members

Remarks

Every read model asks the same two questions of a requested scope, and both answers are access decisions rather than query details, which is why they are resolved once here instead of per use case. A read model that answered either one differently would publish mail through the query that got it wrong while the others stayed correct.

The assignment is the third thing settled here, and it is settled twice over. It reaches the resolution that runs before the query — the accounts a request is resolved against are the accounts the caller's user is assigned, so a mailbox nobody assigned them is refused rather than narrowed away — and it also reaches the query itself, as the account term of the predicate and the column every index that predicate is planned against leads with. The two are not alternatives: the resolution is what refuses without disclosing, and the term is what keeps a query from reading past the accounts that survived it. No mail row names a user, so the term is the assigned accounts rather than the user beside them. That is why this type reads the caller-scoped catalog and no other, for both answers: a resolver holding both catalogs would be one substitution away from answering a caller out of the deployment's whole account set.

Constructors

MailboxScopeResolver(ICallerMailAccountCatalog, IMailFolderParticipationReader, IDeploymentMailFolders, MailFolderReferenceResolver)

Initializes the resolver.

Properties

User

Gets the user this unit of work is acting for, which is what decides the posture its content is scanned under.

Methods

IsReadableByTools(IReadOnlyList<MailAccountId>, MailAccountId, MailFolderAlias)

Reports whether a tool may read one email, given the accounts the user in hand was already read to be assigned.

IsReadableByToolsAsync(MailAccountId, MailFolderAlias, CancellationToken)

Reports whether a tool may read one email, given the mailbox it was stored from.

ReadAssignedAccountsAsync(CancellationToken)

Reads the accounts this unit of work may reach, which is what a read that builds no scope narrows by.

ReadableScopeAsync(IReadOnlyList<MailAccountSelector>, IReadOnlyList<MailFolderReference>, JunkMailInclusion, CancellationToken)

Resolves what a request named into the scope a query runs with.