PermissionDefinition
Defines a new Permission with which to control access to GraphQL resolvers & REST controllers. Used in conjunction with the Allow decorator (see example below).
Note: To define CRUD permissions, use the CrudPermissionDefinition.
Example
constructor
(config: PermissionDefinitionConfig) => PermissionDefinitionPermission
PermissionReturns the permission defined by this definition, for use in the Allow decorator.
Defines a set of CRUD Permissions for the given name, i.e. a name of 'Wishlist' will create
4 Permissions: 'CreateWishlist', 'ReadWishlist', 'UpdateWishlist' & 'DeleteWishlist'.
Example
- Extends:
PermissionDefinition
constructor
(name: string, descriptionFn?: (operation: 'create' | 'read' | 'update' | 'delete') => string) => CrudPermissionDefinitionCreate
PermissionReturns the 'Create' CRUD permission defined by this definition, for use in the Allow decorator.
Read
PermissionReturns the 'Read' CRUD permission defined by this definition, for use in the Allow decorator.
Update
PermissionReturns the 'Update' CRUD permission defined by this definition, for use in the Allow decorator.
Delete
PermissionReturns the 'Delete' CRUD permission defined by this definition, for use in the Allow decorator.
Defines a set of Read-Write Permissions for the given name, i.e. a name of 'DashboardSavedViews' will create
2 Permissions: 'ReadDashboardSavedViews' and 'WriteDashboardSavedViews'.
Example
- Extends:
PermissionDefinition
constructor
(name: string, descriptionFn?: (operation: 'read' | 'write') => string) => RwPermissionDefinitionRead
PermissionReturns the 'Read' permission defined by this definition, for use in the Allow decorator.
Write
PermissionReturns the 'Write' permission defined by this definition, for use in the Allow decorator.
Configures a PermissionDefinition
name
stringThe name of the permission. By convention this should be UpperCamelCased.
description
stringA description of the permission.
assignable
booleantrueWhether this permission can be assigned to a Role. In general this
should be left as the default true except in special cases.
internal
booleanfalseInternal permissions are not exposed via the API and are reserved for
special use-cases such at the Owner or Public permissions.