Skip to main content
Version: 31.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:169

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:94

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:103

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:132

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:78

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

Parameters​

ParameterType

args

InviteExternalAgentParams

opts?

ProcedureOpts

Returns​

Promise<GenericPolymeshTransaction<AuthorizationRequest, AuthorizationRequest>>

Note​

the signing Identity must be an agent of this Asset holding externalAgents.acceptBecomeAgent permission — granted by TxGroup.ExternalAgentManagement or PermissionGroupType.Full. The chain checks this when the target accepts, against the Identity that created the Authorization Request, so an invitation sent without it can never be accepted. If no existing Permission Group matches the requested permissions, externalAgents.createGroupAndAddAuth permission is also required

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:83

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