GRANT permission (bSQL) | Blockpoint Docs
Grants permissions on a database or blockchain. For examples, see Examples.
Syntax​
GRANT <database_principal> <permission>
ON <database_object> ;
<permission> ::=
CONTROL
| MANAGEMENT
| AUTH
| ALTER
| WRITE
| INSERT
| AMEND
| DISCONTINUE
| READ
<database_principal> ::=
Database_user
| Database_role
<database_object> ::=
database_name
| database_name.blockchain_name
Arguments​
permission
Specifies the type of permission you wish to grant, for a complete list of permission definitions see Database Roles and Permissions.
database_name
Specifies a database.
blockchain_name
Specifies a blockchain.
Database_user
Specifies a database user.
Database_role
Specifies a database role.
Permissions​
Requires AUTH
permission on the database if specifying permissions for a Database_user. If specifying permissions
for a Database_role the user must be the owner or belong to the ownership role.
Remarks​
The control
permission gives the user total control of the blockchain or database specified and errors if it is coupled
with redundant permissions.
Examples​
Basic Syntax​
Examples in this section demonstrate the basic functionality of the Grant Blockchain statement using the minimum required syntax.
A. Granting CONTROL permission to a role.​
The following example creates a role and then grants CONTROL
permission to the blockchain companies
in the financial
database. This example uses the Financial Demo Database.
CREATE ROLE newrole
GRANT newrole CONTROL ON financial.companies
B. Granting multiple permissions to a role.​
The following example creates a role and then grants AMEND
, DISCONTININUE
, and READ
permissions to the blockchain companies
in the financial
database. This example uses the Financial Demo Database.
CREATE ROLE modifier
GRANT modifier AMEND DISCONTINUE READ ON financial.companies