Table of Contents

Method IsReadableByToolsAsync

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

IsReadableByToolsAsync(MailAccountId, MailFolderAlias, CancellationToken)

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

public Task<bool> IsReadableByToolsAsync(MailAccountId accountId, MailFolderAlias folderAlias, CancellationToken cancellationToken)

Parameters

accountId MailAccountId

The account the email was read from.

folderAlias MailFolderAlias

The folder the email was read from.

cancellationToken CancellationToken

Cancels the read of the user's assignments.

Returns

Task<bool>

true when the user in hand is assigned that account and a mapping admits that folder to tools.

Remarks

This is ReadableScopeAsync(IReadOnlyList<MailAccountSelector>, IReadOnlyList<MailFolderReference>, JunkMailInclusion, CancellationToken) asked about one email instead of about a query, and it exists because several reads reach an email by its identifier and build no scope at all. Both questions are answered from the same catalog here, so an account this caller is not assigned cannot be reachable by identifier while it is unreachable by name. The folder is a different matter until #2330 moves this read: it asks the mapping in the settings the work's own scope was prepared with, while a scope reads the account's settings columns, so a folder a write withheld stays readable here for up to one convergence interval of the commit on every replica but the one that wrote it, while it is already out of every scope. It is a mapping being asked to admit the folder rather than a list being asked whether it names it, so an email stored under an alias no mapping names is unreadable by the same answer that withholds a mapped folder. A caller that may not read the email is told it was not found rather than refused, for the reason an account this deployment no longer serves is: a refusal would confirm the identifier exists.

Exceptions

PrincipalNotAuthorizedException

Thrown when the work in hand is acting for no user, which is a refusal rather than the false a caller with nothing readable is answered with.