Skip to main content

Access

Description

The generate widget is a simplest way to generate images.

Methods

add

Adds access for a resource

Props

NameTypeRequiredDescription
accountIdstringNoThe ID of the account to grant access to
groupIdstringNoThe ID of the group to grant access to
resourceAccessResourceTypeYesThe type of resource to grant access to
resourceIdstringYesThe ID of the resource to grant access to
roleAccessRoleYesThe 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

NameTypeRequiredDescription
resourceAccessResourceTypeYesThe type of resource to check access to
resourceIdstringYesThe 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

NameTypeRequiredDescription
accountIdstringNoThe ID of the account to remove access from
groupIdstringNoThe ID of the group to remove access from
resourceAccessResourceTypeYesThe type of resource to remove access from
resourceIdstringYesThe ID of the resource to remove access from
roleAccessRoleYesThe role to remove for the resource

Returns

Promise<void>

Example

await client.access.remove({
resource: 'collection',
resourceId: '123',
role: 'reader',
});

Types

AccessResourceType

  • collection
  • stack

AccessRole

  • maintainer
  • reader
  • writer