api.entities.Asset.Base.Permissions - PolymeshAssociation/polymesh-sdk GitHub Wiki

@polymeshassociation/polymesh-sdk / api/entities/Asset/Base/Permissions

api/entities/Asset/Base/Permissions

Classes

Permissions

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

Handles all Asset Permissions related functionality

Extends

Methods

createGroup()

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

Defined in: 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
Parameter Type
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: 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): Promise<CustomPermissionGroup>

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

Retrieve a Custom Permission Group by its ID

Parameters
Parameter Type Description
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): Promise<KnownPermissionGroup>

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

Retrieve a Known Permission Group by its type

Parameters
Parameter Type Description
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: api/entities/Asset/Base/Permissions/index.ts:132

Retrieve all Permission Groups of this Asset

Returns

Promise<PermissionGroups>

inviteAgent()

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

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

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

Parameters
Parameter Type
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, opts?): Promise<GenericPolymeshTransaction<void, void>>

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

Revoke an agent's permissions over this Asset

Parameters
Parameter Type
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