Allows getting and setting permissions for the various capabilities of Chats. The specific permissions are defined in ChatPermission. Permissions can be assigned per-DomainUser, per-UserGroup, or for everybody (setWorldPermissions).

Generally speaking, more specific permissions override less-specific ones. So a user's explicit permission would override the group's permission which the user is in, which would itself override any world permission for this `Chat`.

### Hierarchy

- ChatPermissionManager

## Index

### Accessors

- chatId

### Methods

- addGroupPermissions
- addUserPermissions
- addWorldPermissions
- getAllGroupPermissions
- getAllUserPermissions
- getGroupPermissions
- getPermissions
- getUserPermissions
- getWorldPermissions
- removeGroupPermissions
- removeUserPermissions
- removeWorldPermissions
- setGroupPermissions
- setUserPermissions
- setWorldPermissions

## Accessors

### chatId

- get chatId(): string

- The Chat ID to which these permissions apply.

  #### Returns string

## Methods

### addGroupPermissions

- addGroupPermissions(permissions: object): Promise<void>
- addGroupPermissions(permissions: Map<string, ChatPermission[]>): Promise<void>

- Adds the given permissions to any existing permissions for this chatId for all given groups.

  #### Parameters

  - ##### permissions: object

    an object, mapping group IDs to an array of desired permission strings to be added

    - ##### [key: string]: ChatPermission[]

  #### Returns Promise<void>

  A promise if successful

- #### Parameters

  - ##### permissions: Map<string, ChatPermission[]>

  #### Returns Promise<void>

### addUserPermissions

- addUserPermissions(permissions: object): Promise<void>
- addUserPermissions(permissions: Map<string, ChatPermission[]>): Promise<void>

- Adds the given permissions to any existing permissions for this chatId for all given users.

  #### Parameters

  - ##### permissions: object

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

    - ##### [key: string]: ChatPermission[]

  #### Returns Promise<void>

  A promise if successful

- #### Parameters

  - ##### permissions: Map<string, ChatPermission[]>

  #### Returns Promise<void>

### addWorldPermissions

- addWorldPermissions(permissions: ChatPermission[]): Promise<void>

- Adds the given permissions to any existing WORLD permissions for this chatId.

  #### Parameters

  - ##### permissions: ChatPermission[]

    an array of permission strings

  #### Returns Promise<void>

  A promise if successful

### getAllGroupPermissions

- getAllGroupPermissions(): Promise<Map<string, ChatPermission[]>>

- Returns the permissions for all groups for this chatId.

  #### Returns Promise<Map<string, ChatPermission[]>>

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

### getAllUserPermissions

- getAllUserPermissions(): Promise<Map<string, ChatPermission[]>>

- Returns the permissions for all users for this chatId.

  #### Returns Promise<Map<string, ChatPermission[]>>

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

### getGroupPermissions

- getGroupPermissions(groupId: string): Promise<ChatPermission[]>

- Returns the permissions for the given group for this chatId.

  #### Parameters

  - ##### groupId: string

    an existing group ID

  #### Returns Promise<ChatPermission[]>

  A promise, which resolves with an array of permission strings

### getPermissions

- getPermissions(): Promise<ChatPermission[]>

- Returns the resolved permissions for the current user for this chatId. Resolved means computed from the set of any relevant `world`, `group` or `user` permissions.

  #### Returns Promise<ChatPermission[]>

### getUserPermissions

- getUserPermissions(username: string): Promise<ChatPermission[]>

- Returns the permissions for the given user for this chatId.

  #### Parameters

  - ##### username: string

    an existing user's username

  #### Returns Promise<ChatPermission[]>

  A promise, which resolves with an array of permission strings

### getWorldPermissions

- getWorldPermissions(): Promise<ChatPermission[]>

- Returns the permissions for WORLD for this chatId.

  #### Returns Promise<ChatPermission[]>

  A promise, which resolves with an array of permission strings

### removeGroupPermissions

- removeGroupPermissions(permissions: object): Promise<void>
- removeGroupPermissions(permissions: Map<string, ChatPermission[]>): Promise<void>

- Removes the given permissions from any of the provided groups' permissions for this chatId.

  #### Parameters

  - ##### permissions: object

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

    - ##### [key: string]: ChatPermission[]

  #### Returns Promise<void>

  A promise if successful

- #### Parameters

  - ##### permissions: Map<string, ChatPermission[]>

  #### Returns Promise<void>

### removeUserPermissions

- removeUserPermissions(permissions: object): Promise<void>
- removeUserPermissions(permissions: Map<string, ChatPermission[]>): Promise<void>

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

  #### Parameters

  - ##### permissions: object

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

    - ##### [key: string]: ChatPermission[]

  #### Returns Promise<void>

  A promise if successful

- #### Parameters

  - ##### permissions: Map<string, ChatPermission[]>

  #### Returns Promise<void>

### removeWorldPermissions

- removeWorldPermissions(permissions: ChatPermission[]): Promise<void>

- Removes the given permissions from any existing WORLD permissions for this chatId.

  #### Parameters

  - ##### permissions: ChatPermission[]

    an array of permission strings

  #### Returns Promise<void>

  A promise if successful

### setGroupPermissions

- setGroupPermissions(permissions: object): Promise<void>
- setGroupPermissions(permissions: Map<string, ChatPermission[]>): Promise<void>

- Sets the given permissions for the given groups for this chatId.

  #### Parameters

  - ##### permissions: object

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

    - ##### [key: string]: ChatPermission[]

  #### Returns Promise<void>

  A promise if successful

- #### Parameters

  - ##### permissions: Map<string, ChatPermission[]>

  #### Returns Promise<void>

### setUserPermissions

- setUserPermissions(permissions: object): Promise<void>
- setUserPermissions(permissions: Map<string, ChatPermission[]>): Promise<void>

- Sets the given permissions for the given users for this chatId.

  #### Parameters

  - ##### permissions: object

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

    - ##### [key: string]: ChatPermission[]

  #### Returns Promise<void>

  A promise if successful

- #### Parameters

  - ##### permissions: Map<string, ChatPermission[]>

  #### Returns Promise<void>

### setWorldPermissions

- setWorldPermissions(permissions: ChatPermission[]): Promise<void>

- Sets the given permissions for WORLD for this chatId.

  #### Parameters

  - ##### permissions: ChatPermission[]

    an array of permission strings

  #### Returns Promise<void>

  A promise if successful