Access Control
Tokenization support includes an access control feature that supports both role-based and ownership-based control mechanisms.
Token Admin
or Token Minter
. With
ownership-based control, you can restrict users from accessing assets that they do not
own. With ownership-based access control, specific methods can be called by the users
who own the assets, such as the Token Owner
or Account
Owner
. For specific information on access control for methods, see the
individual entries for the methods documented in the following topics:
- Token Admin
Token Admin
users can be assigned when a token chaincode is deployed. TheToken Admin
user information is saved in the state database. AToken Admin
user can grant and removeToken Admin
privileges for other users. AToken Admin
user cannot remove their ownToken Admin
privileges. AToken Admin
user can assign theOrg Admin
, minter, burner, or notary role to any user.- Org Admin
- The extended Token Taxonomy Framework methods support the
Org Admin
role. AToken Admin
user can assign theOrg Admin
role to any user.Org Admin
users have administrative privileges, but only within their organization. They can create accounts or see account balances, but only for users in their organization.Org Admin
users who have a minter, burner, or notary role can assign that role to other users in their organization. - Token Minter
- A user who is assigned the minter role is a
Token Minter
, and can mint tokens. - Token Burner
- A user who is assigned the burner role is a
Token Burner
, and can burn tokens. - Token Notary
- A user who is assigned the notary role is a
Token Notary
. AToken Notary
acts as a third party in transactions between payers and payees. AToken Notary
can either trigger the completion of a token transfer from a payer to a payee, or can instead return the tokens to the payer's account. - Vault Manager
- A user who is assigned the vault role is the
Vault Manager
. TheVault Manager
can unlock a locked NFT. The vault role is applicable only for the extended ERC-721 and ERC-1155 standards. Assigning the vault role to a user is a prerequisite for locking NFTs. Only one user per chaincode can be assigned the vault role.
Role-based access control and ownership-based access control are also combined in some methods. For example, role-based access control lets a user with the minter role create tokens. With ownership-based access control, a non-fungible token owner can modify the custom properties of a token, but cannot modify the token metadata. When a user with the minter role creates a non-fungible token (NFT), they become the owner of the NFT. As the owner of that NFT, they can modify the custom properties (for an art collection token, the token price is a custom property). After the token creator transfers the NFT to another user, the second user becomes the owner, and the user who created the token is no longer the owner of the token. Because of ownership-based access control, the new owner can now update a custom property value, but the previous owner no longer can. Because of role-based access control, the previous owner can still mint an NFT, but the new user cannot.
You can also write your own access control functions, or disable access control. The automatically generated code that controls access is shown in the following examples.
await this.Ctx.<Token Standard>Auth.checkAuthorization(...)
auth, err := t.Ctx.<Token Standard>Auth.CheckAuthorization(...)
Note:
To remove the automatically generated access control function, remove the previous line of code from your TypeScript or Go project.