Granting Authorization Access to Namespaces
Table 3-1 Namespace Privileges and Permissions
Privilege | Description |
---|---|
|
Grant permission to a user or to a role to create or drop any namespace.
|
|
Grant permission to a user or to a role to create, drop or evolve tables in a specific namespace. You can evolve tables to update table definitions, add or remove fields, or change field properties, such as a default value. You may even add a particular kind of column, like an IDENTITY column, to increment some value automatically. Only tables that already exist in the store are candidates for table evolution. For more details, see Alter Table.
|
|
Grant permission to a user or to a role to create or drop an index in a specific namespace.
|
|
Grant permission to a role to read, insert, or delete items in a specific namespace.
|
|
Helper label for granting or revoking permissions to all DDL privileges for a specific namespace to a user or role.
|
Grant privileges on a namespace
GRANT {Namespace-scoped privileges} ON NAMESPACE namespace_name TO <User|Role>
Namespace-scoped privileges ::= namespace_privilege [, namespace_privilege]
where,
-
namespace_privilege
The namespace privilege that can be granted to a user or a role. For more information on the applicable privileges, see the Privilege column in the Namespace Privileges and Permissions table.
-
namespace_name
The namespace that the user wishes to access.
-
<User|Role>
The name of the KVStore user or the role of a user.
GRANT READ_IN_NAMESPACE ON NAMESPACE ns1 TO Kate
Note:
The label MODIFY_IN_NAMESPACE can be used as a helper for granting or revoking permissions to all DDL privileges for a specific namespace to a user or role.Revoke privileges on a namespace
REVOKE {Namespace-scoped privileges} ON NAMESPACE namespace_name FROM <User|Role>
Namespace-scoped privileges ::= namespace_privilege [, namespace_privilege]
where,
-
namespace_privilege
The namespace privilege that can be revoked from a user or a role. For more information on the applicable privileges, see the Privilege column in the Namespace Privileges and Permissions table.
-
namespace_name
The namespace that the user wishes to access.
-
<User|Role>
The name of the KVStore user or the role of a user.
REVOKE READ_IN_NAMESPACE ON NAMESPACE ns1 FROM Kate
Note:
The label MODIFY_IN_NAMESPACE can be used as a helper for granting or revoking permissions to all DDL privileges for a specific namespace to a user or role.- Creation of a namespace and a table.
- Revocation of the privilege to create any other new tables in the namespace, but allow the table to be dropped.
CREATE NAMESPACE IF NOT EXISTS ns1
GRANT MODIFY_IN_NAMESPACE ON NAMESPACE ns1 TO usersRole
CREATE TABLE ns1:t (id INTEGER, name STRING, primary key (id))
INSERT INTO ns1:t VALUES (1, 'Smith')
SELECT * FROM ns1:t
REVOKE CREATE_TABLE_IN_NAMESPACE ON NAMESPACE ns1 FROM usersRole
DROP NAMESPACE ns1 CASCADE
Note:
You can save all of the above commands as a sql script and execute it in a single command. If you want to execute any of the above commands outside of a SQL prompt, remove the semi colon at the end.