Class RolePermissions
- Namespace
- MailFathom.Domain.Access
- Assembly
- MailFathom.Domain.dll
The list of permissions one role grants — names written out, and patterns reaching whatever is published beneath them — and the stored entries on it that grant nothing in this build.
public sealed record RolePermissions : IEquatable<RolePermissions>
- Inheritance
-
RolePermissions
- Implements
- Inherited Members
Remarks
An entry is a published name or a PermissionSubtree. A name is exactly what somebody wrote. A pattern is kept as written and resolved against the published set whenever it is asked, so a role listing one holds a permission a later release publishes in its reach from that release on — which is what the pattern is for, and why WidensOnUpgrade is something every write giving such a role has to ask about.
Writing is the strict half: a name nothing publishes and a pattern reaching nothing are both refused, because a grant naming a capability that does not exist means nothing and an operator would believe they had made it.
Reading is the forgiving half. A stored name may stop being published, and a stored pattern may come to reach nothing — a later release retired what it reached, or the row was edited in the database — and refusing the role over it would revoke every other entry it lists from everybody who holds it. Such an entry is kept apart in Unpublished instead: reported so somebody can remove it, and granted to nobody.
Properties
- Granted
Gets the published permissions the role grants now — the names it lists and everything its patterns reach — in the order All declares them.
- Patterns
Gets every pattern the role lists, as written and in ordinal order, one reaching nothing in this build included.
- Unpublished
Gets the stored entries that grant nothing in this build, in ordinal order: a name it does not publish, and a pattern reaching nothing it publishes.
- WidensOnUpgrade
Gets whether the role may come to grant more than it grants now without anybody writing to it.
- Written
Gets the entries the role is stored and read back as: each name, then each pattern reaching something, exactly as written.
Methods
- EntriesGranting(MailFathomPermission)
Lists every entry a role can be stored with that grants one permission: its name, and each pattern reaching it.
- GrantedBy(string?)
Reports what one stored entry grants in this build.
- Of(IEnumerable<MailFathomPermission>)
Builds the list a role is written with from names alone.
- Read(IEnumerable<string>)
Reads the entries a stored role lists.
- TryCreate(IEnumerable<string>, out RolePermissions?, out IReadOnlyList<string>)
Builds the list a role is written with from the entries somebody wrote.