Access
Description
The generate widget is a simplest way to generate images.
Methods
add
Adds access for a resource
Props
Name | Type | Required | Description |
---|---|---|---|
accountId | string | No | The ID of the account to grant access to |
groupId | string | No | The ID of the group to grant access to |
resource | AccessResourceType | Yes | The type of resource to grant access to |
resourceId | string | Yes | The ID of the resource to grant access to |
role | AccessRole | Yes | The role to grant for the resource |
Returns
Promise<void>
Example
await client.access.add({
resource: 'collection',
resourceId: '123',
role: 'reader',
});
can
read
Checks if the current account has read access to a resource
Props
Name | Type | Required | Description |
---|---|---|---|
resource | AccessResourceType | Yes | The type of resource to check access to |
resourceId | string | Yes | The ID of the resource to check access to |
Returns
Promise<boolean>
Example
const hasAccess = await client.access.can.read({
resource: 'collection',
resourceId: '123',
});
write
Checks if the current account has write access to a resource
Props
Same as read
Returns
Same as read
remove
Removes access for a resource
Props
Name | Type | Required | Description |
---|---|---|---|
accountId | string | No | The ID of the account to remove access from |
groupId | string | No | The ID of the group to remove access from |
resource | AccessResourceType | Yes | The type of resource to remove access from |
resourceId | string | Yes | The ID of the resource to remove access from |
role | AccessRole | Yes | The role to remove for the resource |
Returns
Promise<void>
Example
await client.access.remove({
resource: 'collection',
resourceId: '123',
role: 'reader',
});
Types
AccessResourceType
collection
pose
stack
AccessRole
maintainer
reader
writer