Skip to main content
Version: 29.0.x

Class: Permissions

Defined in: src/api/entities/Asset/Base/Permissions/index.ts:37

Handles all Asset Permissions related functionality

Extends​

Methods​

createGroup()​

createGroup(args: CreateGroupParams, opts?: ProcedureOpts): Promise<GenericPolymeshTransaction<CustomPermissionGroup, CustomPermissionGroup>>

Defined in: src/api/entities/Asset/Base/Permissions/index.ts:63

Create a Permission Group for this Asset. Identities can be assigned to Permission Groups as agents. Agents assigned to a Permission Group have said group's permissions over the Asset

Parameters​

ParameterType

args

CreateGroupParams

opts?

ProcedureOpts

Returns​

Promise<GenericPolymeshTransaction<CustomPermissionGroup, CustomPermissionGroup>>

Note​

this method is of type ProcedureMethod, which means you can call createGroup.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it


getAgents()​

getAgents(): Promise<AgentWithGroup[]>

Defined in: src/api/entities/Asset/Base/Permissions/index.ts:163

Retrieve a list of agents (Identities which have permissions over the Asset) and their respective Permission Groups

Returns​

Promise<AgentWithGroup[]>


getGroup()​

Call Signature​

getGroup(args: object): Promise<CustomPermissionGroup>

Defined in: src/api/entities/Asset/Base/Permissions/index.ts:88

Retrieve a Custom Permission Group by its ID

Parameters​
ParameterTypeDescription

args

{ id: BigNumber; }

‐

args.id

BigNumber

Permission Group identifier

Returns​

Promise<CustomPermissionGroup>

Promise that resolves to the Custom Permission Group

Throws​

if there is no Permission Group with the passed ID

Call Signature​

getGroup(args: object): Promise<KnownPermissionGroup>

Defined in: src/api/entities/Asset/Base/Permissions/index.ts:97

Retrieve a Known Permission Group by its type

Parameters​
ParameterTypeDescription

args

{ type: PermissionGroupType; }

‐

args.type

PermissionGroupType

The Known Permission Group type

Returns​

Promise<KnownPermissionGroup>

Promise that resolves to the Known Permission Group


getGroups()​

getGroups(): Promise<PermissionGroups>

Defined in: src/api/entities/Asset/Base/Permissions/index.ts:126

Retrieve all Permission Groups of this Asset

Returns​

Promise<PermissionGroups>


inviteAgent()​

inviteAgent(args: InviteExternalAgentParams, opts?: ProcedureOpts): Promise<GenericPolymeshTransaction<AuthorizationRequest, AuthorizationRequest>>

Defined in: src/api/entities/Asset/Base/Permissions/index.ts:72

Invite an Identity to be an agent with permissions over this Asset

Parameters​

ParameterType

args

InviteExternalAgentParams

opts?

ProcedureOpts

Returns​

Promise<GenericPolymeshTransaction<AuthorizationRequest, AuthorizationRequest>>

Note​

this will create an Authorization Request which has to be accepted by the target Identity. An Account or Identity can fetch its pending Authorization Requests by calling authorizations.getReceived. Also, an Account or Identity can directly fetch the details of an Authorization Request by calling authorizations.getOne

Note​

this method is of type ProcedureMethod, which means you can call inviteAgent.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it


removeAgent()​

removeAgent(args: RemoveExternalAgentParams, opts?: ProcedureOpts): Promise<GenericPolymeshTransaction<void, void>>

Defined in: src/api/entities/Asset/Base/Permissions/index.ts:77

Revoke an agent's permissions over this Asset

Parameters​

ParameterType

args

RemoveExternalAgentParams

opts?

ProcedureOpts

Returns​

Promise<GenericPolymeshTransaction<void, void>>

Note​

this method is of type ProcedureMethod, which means you can call removeAgent.checkAuthorization on it to see whether the signing Account and Identity have the required roles and permissions to run it