Struct MailFathomPermission
- Namespace
- MailFathom.Domain.Access
- Assembly
- MailFathom.Domain.dll
One named capability MailFathom publishes, which a grant lists and a caller either holds or does not.
[JsonConverter(typeof(MailFathomPermissionJsonConverter))]
[SuppressMessage("Naming", "CA1711:Identifiers should not have incorrect suffix", Justification = "The suffix is reserved for code access security, which .NET removed; permission is the word ADR 0012 fixed for this unit and the word an operator writes in configuration.")]
public readonly record struct MailFathomPermission : IEquatable<MailFathomPermission>
- Implements
- Inherited Members
Remarks
The type is a closed enumeration of values rather than a C# enum, because the name is the identity and it travels outside this process: an operator writes it in configuration, a deployment advertises it in its protected resource metadata document, and an authorization server mints it as a scope so a token can carry it. A member's ordinal would mean nothing to any of the three, and its C# name has to be free to change without moving what an operator already wrote.
The set is closed so that every name a grant can carry corresponds to a check that exists. A name nothing publishes is unknown rather than new, which is what lets startup refuse a misspelling instead of accepting a grant nobody enforces. Adding a member is a configuration-schema change and is made when the capability it names exists, never ahead of it.
A name is mailfathom.<surface>[.<subject>].<verb>, lowercase and dot-separated, and is
always a valid OAuth scope token so the same string can travel in a scope claim. The prefix after
mailfathom. names the Surface the permission belongs to, and the two halves are disjoint: no
permission implies another, and holding one says nothing about holding the next.
Being a struct, default is reachable and is not a permission. It reports itself through IsSpecified, refuses to answer for a name, and is rejected by the JSON converter below; a grant is composed from TryParse(string?, out MailFathomPermission) or from the members themselves, so no undeclared value can reach one.
Properties
- AdminAuditRead
Gets the permission covering the per-account records derived from mail: the audits, the rules history, and the spam classifications.
- AdminCredentialsWrite
Gets the permission covering storing a mailbox refresh token.
- AdminErase
Gets the permission covering erasing the mail stored for a folder an account no longer mirrors.
- AdminOperate
Gets the permission covering asking the deployment to do work it can already do.
- AdminRead
Gets the permission covering the administrative reads that report the deployment's own state and no mail.
- AdminSpend
Gets the permission covering the one operation that starts a provider bill, which is activating the declared embedding model.
- All
Gets every published permission.
- IsSpecified
Gets whether this value names a published permission rather than the unusable struct default.
- MailAsk
Gets the permission covering the tool that answers from mail content by sending it to a model provider.
- MailContactsRead
Gets the permission covering the tools that read the contact book.
- MailContactsWrite
Gets the permission covering the tools that record, amend, and erase a contact.
- MailDraftsWrite
Gets the permission covering writing, editing, and giving up a draft this deployment holds.
- MailFlagsWrite
Gets the permission covering the tool that writes
\Seen,\Flagged, and keywords onto mail this deployment holds.
- MailRead
Gets the permission covering the tools that read the local mailbox copy.
- MailSend
Gets the permission covering asking this deployment to send mail from an account it holds.
- Name
Gets the published name, which is what an operator writes and what a token carries as a scope.
- Surface
Gets the surface this permission belongs to.
Methods
- PublishedFor(ProtectedSurface)
Reports every permission one surface publishes, which is what a grant nobody narrowed reaches.
- ToString()
Returns the fully qualified type name of this instance.
- TryParse(string?, out MailFathomPermission)
Parses an operator-supplied or token-supplied permission name.