PrivilegedUser

enum PrivilegedUser : String, CaseIterable, Codable
  • Declaration

    Swift

    case TwitarrTeam
  • Declaration

    Swift

    case moderator
  • Declaration

    Swift

    case admin
  • THO

    Declaration

    Swift

    case THO
  • Declaration

    Swift

    case CommunitySupport
  • Usernames that ordinary users can’t register or rename to, case-insensitively. The other privileged names are protected by the username uniqueness check, but CommunitySupport is created by a migration that may run on a database where somebody has already taken the name; validation keeps them from taking it after the fact.

    Declaration

    Swift

    static func isReservedUsername(_ username: String) -> Bool
  • True if the username belongs to a shared-mailbox phantom account (see PrivilegedMailbox.all). Moderator and TwitarrTeam are protected from things like being blocked by their access level, but the CommunitySupport account is only .verified–code that exempts accounts based on accessLevel >= .moderator must also check this, or users could block the team’s shared mailbox and lose its replies.

    Declaration

    Swift

    static func isSharedMailboxAccount(_ username: String) -> Bool
  • Whether name names this account, ignoring case: the check for ?foruser= values, postAs values, and @mention names (without the “@”).

    Declaration

    Swift

    func matches(_ name: String) -> Bool
  • The cached phantom account for this user, or nil if the migration that creates it hasn’t run on this instance.

    Declaration

    Swift

    func cachedUser(on req: Request) -> UserCacheData?
  • Declaration

    Swift

    var queryParam: String { get }
  • Service accounts that can authenticate with passwords via HTTP Basic Auth. These are builtin accounts with known passwords (from environment variables). Note: moderator and TwitarrTeam cannot authenticate as their passwords are randomly generated and discarded. Stored as lowercase for case-insensitive matching.

    Declaration

    Swift

    static let serviceAccountsWithPasswords: Set<String>
  • Case-insensitive match against queryParam (lowercased rawValue).

    Declaration

    Swift

    init?(fromQueryParam raw: String)
  • Whether callerAccessLevel may author this privileged account for the content type.

    Declaration

    Swift

    func canPostAs(from callerAccessLevel: UserAccessLevel, for content: AuthorableContentType) -> Bool