Skip to content

Commit

Permalink
fix: correct the entity lists permission prop types (#747)
Browse files Browse the repository at this point in the history
All the `can***` props in the entity list component should accept
the permission check functions in both the synchronous version
and asynchronous version
  • Loading branch information
nekolab authored Aug 31, 2023
1 parent da241a7 commit 965840a
Show file tree
Hide file tree
Showing 29 changed files with 247 additions and 231 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,35 +110,35 @@ Note: the default value is usually sufficient unless the app needs to support mu

#### `canCreate`

- type: `Function as PropType<() => Promise<boolean>>`
- type: `Function as PropType<() => boolean | Promise<boolean>>`
- required: `false`
- default: `async () => true`

An asynchronous function, that returns a boolean, that evaluates if the user can create a new entity.
A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can create a new entity.

#### `canDelete`

- type: `Function as PropType<(row: object) => Promise<boolean>>`
- type: `Function as PropType<(row: object) => boolean | Promise<boolean>>`
- required: `false`
- default: `async () => true`

An asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity.
A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity.

#### `canEdit`

- type: `Function as PropType<(row: object) => Promise<boolean>>`
- type: `Function as PropType<(row: object) => boolean | Promise<boolean>>`
- required: `false`
- default: `async () => true`

An asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity.
A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity.

#### `canRetrieve`

- type: `Function as PropType<(row: object) => Promise<boolean>>`
- type: `Function as PropType<(row: object) => boolean | Promise<boolean>>`
- required: `false`
- default: `async () => true`

An asynchronous function, that returns a boolean, that evaluates if the user can retrieve (view details) a given entity.
A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can retrieve (view details) a given entity.

### Events

Expand Down
20 changes: 10 additions & 10 deletions packages/entities/entities-certificates/docs/certificate-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,43 +116,43 @@ Note: the default value is usually sufficient unless the app needs to support mu

#### `canCreate`

- type: `Function as PropType<() => Promise<boolean>>`
- type: `Function as PropType<() => boolean | Promise<boolean>>`
- required: `false`
- default: `async () => true`

An asynchronous function, that returns a boolean, that evaluates if the user can create a new entity.
A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can create a new entity.

#### `canDelete`

- type: `Function as PropType<(row: object) => Promise<boolean>>`
- type: `Function as PropType<(row: object) => boolean | Promise<boolean>>`
- required: `false`
- default: `async () => true`

An asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity.
A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity.

#### `canEdit`

- type: `Function as PropType<(row: object) => Promise<boolean>>`
- type: `Function as PropType<(row: object) => boolean | Promise<boolean>>`
- required: `false`
- default: `async () => true`

An asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity.
A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity.

#### `canCreateSni`

- type: `Function as PropType<() => Promise<boolean>>`
- type: `Function as PropType<() => boolean | Promise<boolean>>`
- required: `false`
- default: `async () => true`

An asynchronous function, that returns a boolean, that evaluates if the user can create a new SNI entity.
A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can create a new SNI entity.

#### `canRetrieve`

- type: `Function as PropType<(row: object) => Promise<boolean>>`
- type: `Function as PropType<(row: object) => boolean | Promise<boolean>>`
- required: `false`
- default: `async () => true`

An asynchronous function, that returns a boolean, that evaluates if the user can retrieve (view details) a given entity.
A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can retrieve (view details) a given entity.

### Events

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,27 +190,27 @@ const props = defineProps({
type: String,
default: '',
},
/** An asynchronous function, that returns a boolean, that evaluates if the user can create a new entity */
/** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can create a new entity */
canCreate: {
type: Function as PropType<() => Promise<boolean>>,
type: Function as PropType<() => boolean | Promise<boolean>>,
required: false,
default: async () => true,
},
/** An asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity */
/** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity */
canDelete: {
type: Function as PropType<(row: EntityRow) => Promise<boolean>>,
type: Function as PropType<(row: EntityRow) => boolean | Promise<boolean>>,
required: false,
default: async () => true,
},
/** An asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity */
/** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity */
canEdit: {
type: Function as PropType<(row: EntityRow) => Promise<boolean>>,
type: Function as PropType<(row: EntityRow) => boolean | Promise<boolean>>,
required: false,
default: async () => true,
},
/** An asynchronous function, that returns a boolean, that evaluates if the user can retrieve (view details) a given entity */
/** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can retrieve (view details) a given entity */
canRetrieve: {
type: Function as PropType<(row: EntityRow) => Promise<boolean>>,
type: Function as PropType<(row: EntityRow) => boolean | Promise<boolean>>,
required: false,
default: async () => true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,33 +218,33 @@ const props = defineProps({
type: String,
default: '',
},
/** An asynchronous function, that returns a boolean, that evaluates if the user can create a new entity */
/** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can create a new entity */
canCreate: {
type: Function as PropType<() => Promise<boolean>>,
type: Function as PropType<() => boolean | Promise<boolean>>,
required: false,
default: async () => true,
},
/** An asynchronous function, that returns a boolean, that evaluates if the user can create a new SNI entity */
/** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can create a new SNI entity */
canCreateSni: {
type: Function as PropType<() => Promise<boolean>>,
type: Function as PropType<() => boolean | Promise<boolean>>,
required: false,
default: async () => true,
},
/** An asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity */
/** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity */
canDelete: {
type: Function as PropType<(row: EntityRow) => Promise<boolean>>,
type: Function as PropType<(row: EntityRow) => boolean | Promise<boolean>>,
required: false,
default: async () => true,
},
/** An asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity */
/** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity */
canEdit: {
type: Function as PropType<(row: EntityRow) => Promise<boolean>>,
type: Function as PropType<(row: EntityRow) => boolean | Promise<boolean>>,
required: false,
default: async () => true,
},
/** An asynchronous function, that returns a boolean, that evaluates if the user can retrieve (view details) a given entity */
/** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can retrieve (view details) a given entity */
canRetrieve: {
type: Function as PropType<(row: EntityRow) => Promise<boolean>>,
type: Function as PropType<(row: EntityRow) => boolean | Promise<boolean>>,
required: false,
default: async () => true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,27 +99,27 @@ Note: the default value is usually sufficient unless the app needs to support mu

#### `canCreate`

- type: `Function as PropType<() => Promise<boolean>>`
- type: `Function as PropType<() => boolean | Promise<boolean>>`
- required: `false`
- default: `async () => true`

An asynchronous function, that returns a boolean, that evaluates if the user can create a new entity.
A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can create a new entity.

#### `canDelete`

- type: `Function as PropType<(row: object) => Promise<boolean>>`
- type: `Function as PropType<(row: object) => boolean | Promise<boolean>>`
- required: `false`
- default: `async () => true`

An asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity.
A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity.

#### `canEdit`

- type: `Function as PropType<(row: object) => Promise<boolean>>`
- type: `Function as PropType<(row: object) => boolean | Promise<boolean>>`
- required: `false`
- default: `async () => true`

An asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity.
A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity.

### Events

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,21 +231,21 @@ const props = defineProps({
type: String,
default: '',
},
/** An asynchronous function, that returns a boolean, that evaluates if the user can create a new entity */
/** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can create a new entity */
canCreate: {
type: Function as PropType<() => Promise<boolean>>,
type: Function as PropType<() => boolean | Promise<boolean>>,
required: false,
default: async () => true,
},
/** An asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity */
/** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity */
canDelete: {
type: Function as PropType<(row: EntityRow) => Promise<boolean>>,
type: Function as PropType<(row: EntityRow) => boolean | Promise<boolean>>,
required: false,
default: async () => true,
},
/** An asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity */
/** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity */
canEdit: {
type: Function as PropType<(row: EntityRow) => Promise<boolean>>,
type: Function as PropType<(row: EntityRow) => boolean | Promise<boolean>>,
required: false,
default: async () => true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,37 +122,37 @@ Note: the default value is usually sufficient unless the app needs to support mu

#### `canCreate`

- type: `Function as PropType<() => Promise<boolean>>`
- type: `Function as PropType<() => boolean | Promise<boolean>>`
- required: `false`
- default: `async () => true`

An asynchronous function, that returns a boolean, that evaluates if the user can create a new entity.
A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can create a new entity.
Note: When ConsumerGroupList config specifies a `consumerId` the `canCreate` permission is applied to the action of adding the consumer to another consumer group instead of creating a new consumer group.

#### `canDelete`

- type: `Function as PropType<(row: object) => Promise<boolean>>`
- type: `Function as PropType<(row: object) => boolean | Promise<boolean>>`
- required: `false`
- default: `async () => true`

An asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity.
A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity.
Note: When ConsumerGroupList config specifies a `consumerId` the `canDelete` permission is applied to the action of exiting from a consumer group instead of deleting a consumer group.

#### `canEdit`

- type: `Function as PropType<(row: object) => Promise<boolean>>`
- type: `Function as PropType<(row: object) => boolean | Promise<boolean>>`
- required: `false`
- default: `async () => true`

An asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity.
A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity.

#### `canRetrieve`

- type: `Function as PropType<(row: object) => Promise<boolean>>`
- type: `Function as PropType<(row: object) => boolean | Promise<boolean>>`
- required: `false`
- default: `async () => true`

An asynchronous function, that returns a boolean, that evaluates if the user can retrieve (view details) a given entity.
A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can retrieve (view details) a given entity.

### Events

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,27 +227,27 @@ const props = defineProps({
type: String,
default: '',
},
/** An asynchronous function, that returns a boolean, that evaluates if the user can create a new entity */
/** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can create a new entity */
canCreate: {
type: Function as PropType<() => Promise<boolean>>,
type: Function as PropType<() => boolean | Promise<boolean>>,
required: false,
default: async () => true,
},
/** An asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity */
/** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity */
canDelete: {
type: Function as PropType<(row: EntityRow) => Promise<boolean>>,
type: Function as PropType<(row: EntityRow) => boolean | Promise<boolean>>,
required: false,
default: async () => true,
},
/** An asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity */
/** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity */
canEdit: {
type: Function as PropType<(row: EntityRow) => Promise<boolean>>,
type: Function as PropType<(row: EntityRow) => boolean | Promise<boolean>>,
required: false,
default: async () => true,
},
/** An asynchronous function, that returns a boolean, that evaluates if the user can retrieve (view details) a given entity */
/** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can retrieve (view details) a given entity */
canRetrieve: {
type: Function as PropType<(row: EntityRow) => Promise<boolean>>,
type: Function as PropType<(row: EntityRow) => boolean | Promise<boolean>>,
required: false,
default: async () => true,
},
Expand Down
16 changes: 8 additions & 8 deletions packages/entities/entities-consumers/docs/consumer-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,37 +122,37 @@ Note: the default value is usually sufficient unless the app needs to support mu

#### `canCreate`

- type: `Function as PropType<() => Promise<boolean>>`
- type: `Function as PropType<() => boolean | Promise<boolean>>`
- required: `false`
- default: `async () => true`

An asynchronous function, that returns a boolean, that evaluates if the user can create a new entity.
A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can create a new entity.
Note: When ConsumerList config specifies a `consumerGroupId` the `canCreate` permission is applied to the action of adding a consumer to a consumer group instead of creating a new consumer.

#### `canDelete`

- type: `Function as PropType<(row: object) => Promise<boolean>>`
- type: `Function as PropType<(row: object) => boolean | Promise<boolean>>`
- required: `false`
- default: `async () => true`

An asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity.
A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity.
Note: When ConsumerList config specifies a `consumerGroupId` the `canDelete` permission is applied to the action of removing a consumer from a consumer group instead of deleting a consumer.

#### `canEdit`

- type: `Function as PropType<(row: object) => Promise<boolean>>`
- type: `Function as PropType<(row: object) => boolean | Promise<boolean>>`
- required: `false`
- default: `async () => true`

An asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity.
A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity.

#### `canRetrieve`

- type: `Function as PropType<(row: object) => Promise<boolean>>`
- type: `Function as PropType<(row: object) => boolean | Promise<boolean>>`
- required: `false`
- default: `async () => true`

An asynchronous function, that returns a boolean, that evaluates if the user can retrieve (view details) a given entity.
A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can retrieve (view details) a given entity.

### Events

Expand Down
Loading

0 comments on commit 965840a

Please sign in to comment.