Struct PermissionSubtree
- Namespace
- MailFathom.Domain.Access
- Assembly
- MailFathom.Domain.dll
A written shorthand for every published permission a wildcard pattern reaches within the name space.
public readonly record struct PermissionSubtree : IEquatable<PermissionSubtree>
- Implements
- Inherited Members
Remarks
It is what an operator writes in a role as mailfathom.admin.* rather than as every name that prefix reaches,
and as mailfathom.*.read rather than as the reading names that sit at two different depths. The syntax is one
* occupying a whole dot-separated segment, standing for one or more consecutive segments, at any position
and more than once; a trailing wildcard is that rule applied to the last segment rather than a form of its own, and
* alone is the pattern reaching every name. There is no partial segment, so mailfathom.mail.c* names
nothing and is left to be refused as the unpublished name it is.
A subtree resolves against All whenever it is asked rather than being frozen when it is parsed, which is what makes it shorthand for the surface rather than for the names published the day it was written: a permission added where a written pattern reaches in a later release reaches a role that already lists the pattern, and everybody that role is assigned to.
What it reaches is the whole published set rather than one protected surface's half, because a pattern with a
wildcard before its last segment can name permissions of both — mailfathom.*.read is the worked example —
and a role may hold names of both.
A role's list is the one place a pattern is accepted, which RolePermissions decides. A credential's list and a token's scopes name permissions exactly: a scope is compared byte for byte at the authorization server, so nothing could mint a pattern, and a configured scope written as one is refused for what it would have granted had it been written in a role.
Being a struct, default is reachable and names no subtree. It reports itself through IsSpecified and refuses to answer for anything else, so a value that never came from TryParse(string?, out PermissionSubtree) cannot be read as one covering everything.
Properties
- IsSpecified
Gets whether this value names a subtree rather than the unusable struct default.
- Written
Gets the value exactly as it was written, which is what a refusal quotes back.
Methods
- CoveredPermissions()
Reports every published permission this subtree reaches, reading the set as it stands now.
- ToString()
Returns the fully qualified type name of this instance.
- TryParse(string?, out PermissionSubtree)
Parses a written value that asks for a subtree rather than for one permission.
- WritingsReaching(MailFathomPermission)
Lists every way a pattern reaching one published permission can be written.