SQL - GRANT
The SQL Grant command changes the permission of a role granting the access to one or more resources. It works as opposite to the SQL REVOKE command.
Syntax
GRANT <permission> ON <resource> TO <role>
Where:
- permission can be:
NONE
, no permissionCREATE
, to create the indicated resourceREAD
, to read the indicated resourceUPDATE
, to update the indicated resourceDELETE
, to delete the indicated resourceALL
, all permissions
- resource, the target resource where to change the permissions
database
, as the access to the whole databasedatabase.class
, as the access to the records contained in a class. Use**
to indicate all the classesdatabase.cluster
, as the access to the records contained in a cluster. Use**
to indicate all the clustersdatabase.query
, as the ability to execute query (READ is enought)database.command
, as the ability to execute SQL commands. CREATE is for INSERT, READ is for SELECT, UPDATE for UPDATE and DELETE is for DELETEdatabase.config
, as the ability to access to the configuration. Valid permissions are READ and UPDATEdatabase.hook.record
, as the ability to set hooksserver.admin
, as the ability to access to the server resources
- role, the role name
Examples
Grant the permission to update any records in cluster Account to the role "backoffice".
GRANT UPDATE ON database.cluster.Account TO backoffice
To know more about other SQL commands look at SQL commands.