PrivilegedMailboxRequirement
enum PrivilegedMailboxRequirement
What a user must hold to read a privileged mailbox–and, equivalently, who the mailbox’s phantom account fans out to when it’s addressed or participates in a chat. Expressing this as data (rather than writing “is this user a moderator or does this user have role X” by hand at each call site) means the roster expansion and the access check can never drift apart.
-
Declaration
Swift
case accessLevel(UserAccessLevel) -
Declaration
Swift
case role(UserRoleType) -
Satisfied by either holding
role, or having at leastaccessLevel–e.g. the pending Community Support mailbox (#517), which any holder of its role can read, as can any TwitarrTeam-and-above user regardless of role.Declaration
Swift
case roleOrAccessLevel(UserRoleType, UserAccessLevel) -
Whether a user with the given accessLevel/roles may read this mailbox.
Declaration
Swift
func isSatisfied(accessLevel: UserAccessLevel, roles: Set<UserRoleType>) -> Bool -
Convenience overload for callers that already have a
UserCacheData.Declaration
Swift
func isSatisfied(by user: UserCacheData) -> Bool -
All real (non-phantom) users who satisfy this requirement–the roster this mailbox fans out to.
Declaration
Swift
func members(on req: Request) -> [UserCacheData]
View on GitHub