Options
Menu

Class AbstractPermissionManager<T>

Type parameters

  • T: string

Hierarchy

Index

Methods

addGroupPermissions

  • addGroupPermissions(permissions: StringMapLike<Set<T> | T[]>): Promise<void>
  • Adds the given permissions to any existing permissions for all given groups.

    Parameters

    • permissions: StringMapLike<Set<T> | T[]>

      an object, mapping group Ids to an set of desired permission strings to be added

    Returns Promise<void>

    A resolved promise if successful

addUserPermissions

  • Adds the given permissions to any existing permissions for all given users.

    Parameters

    • permissions: DomainUserMapping<Set<T> | T[]>

      an object, mapping usernames to an set of desired permission strings to be added

    Returns Promise<void>

    A resolved promise if successful

addWorldPermissions

  • addWorldPermissions(permissions: Set<T> | T[]): Promise<void>
  • Adds the given permissions to any existing WORLD permissions.

    Parameters

    • permissions: Set<T> | T[]

      an set of permission strings

    Returns Promise<void>

    A resolved promise if successful

getAllGroupPermissions

  • getAllGroupPermissions(): Promise<Map<string, Set<T>>>
  • Returns the permissions for all groups.

    Returns Promise<Map<string, Set<T>>>

    A promise, which resolves with a map of permission strings per group ID.

getAllUserPermissions

  • Returns the permissions for all users.

    Returns Promise<DomainUserIdMap<Set<T>>>

    A promise, which resolves with a map of permission strings per username.

getGroupPermissions

  • getGroupPermissions(groupId: string): Promise<Set<T>>
  • Returns the permissions for the given group.

    Parameters

    • groupId: string

      an existing group ID

    Returns Promise<Set<T>>

    A promise, which resolves with an set of permission strings

getPermissions

getUserPermissions

  • getUserPermissions(username: string): Promise<Set<T>>
  • Returns the permissions for the given user.

    Parameters

    • username: string

      an existing user's username

    Returns Promise<Set<T>>

    A promise, which resolves with an set of permission strings

getWorldPermissions

  • getWorldPermissions(): Promise<Set<T>>
  • Returns the permissions for WORLD.

    Returns Promise<Set<T>>

    A promise, which resolves with an set of permission strings

removeGroupPermissions

  • removeGroupPermissions(permissions: StringMapLike<Set<T> | T[]>): Promise<void>
  • Removes the given permissions from any of the provided groups' permissions for this chatId.

    Parameters

    • permissions: StringMapLike<Set<T> | T[]>

      An object, mapping group IDs to an set of desired permission strings to be removed

    Returns Promise<void>

    A resolved promise if successful

removeUserPermissions

  • Removes the given permissions from any of the provided users' permissions for this chatId.

    Parameters

    • permissions: DomainUserMapping<Set<T> | T[]>

      An object, mapping usernames to an set of desired permission strings to be removed

    Returns Promise<void>

    A resolved promise if successful

removeWorldPermissions

  • removeWorldPermissions(permissions: Set<T> | T[]): Promise<void>
  • Removes the given permissions from any existing WORLD permissions.

    Parameters

    • permissions: Set<T> | T[]

      an set of permission strings

    Returns Promise<void>

    A resolved promise if successful

resolveSessionPermissions

  • resolveSessionPermissions(): Promise<Set<T>>
  • Returns the resolved permissions for the current user for this target. Resolved means computed from the set of any relevant world, group or user permissions.

    Returns Promise<Set<T>>

setGroupPermissions

  • setGroupPermissions(permissions: StringMapLike<Set<T> | T[]>, replaceAll?: boolean): Promise<void>
  • Sets the given permissions for the given groups.

    Parameters

    • permissions: StringMapLike<Set<T> | T[]>

      an object which maps one or more group IDs to their new set of permissions

    • replaceAll: boolean = false

      Determines if the map passed in represents the entire set of group permissions to set. All permissions for other groups will be removed. The default is false.

    Returns Promise<void>

    A resolved promise if successful

setUserPermissions

  • setUserPermissions(permissions: DomainUserMapping<Set<T> | T[]>, replaceAll?: boolean): Promise<void>
  • Sets the given permissions for the given users

    Parameters

    • permissions: DomainUserMapping<Set<T> | T[]>

      an object which maps one or more usernames to their new set of permissions

    • replaceAll: boolean = false

      Determines if the map passed in represents the entire set of user permissions to set. All permissions for other user will be removed. The default is false.

    Returns Promise<void>

    A resolved promise if successful

setWorldPermissions

  • setWorldPermissions(permissions: Set<T> | T[]): Promise<void>
  • Sets the given permissions for WORLD.

    Parameters

    • permissions: Set<T> | T[]

      an set of permission strings

    Returns Promise<void>

    A resolved promise if successful