Security Policy



Security in Katzebase is enforced through roles and the membership of accounts in those roles. Roles come in two varieties: administrators and non-administrators.
paperclip Permissions can be granted, denied or revoked individually (READ, WRITE, MANAGE), or all at once with the special ALL permission.


Administrators have unrestricted access to the database: all schemas and data, and every feature, including creating accounts and roles, managing memberships, configuration, and the system procedures that are restricted to administrators. An account that is a member of any role marked IsAdministrator is an administrator. The built-in admin account is a member of the Administrators role.
round-pushpin Accounts, roles and memberships can be viewed by querying the Master schema.
SELECT * FROM Master:Account
SELECT * FROM Master:Role
SELECT * FROM Master:Membership


round-pushpin Creates an account.
CREATE ACCOUNT JohnDoe WITH (Password = '123abc!')

round-pushpin Drops an account.
DROP ACCOUNT JohnDoe


round-pushpin Creates a role.
CREATE ROLE Salespersons

round-pushpin Creates an administrator role.
CREATE ROLE SalesAdmins WITH (IsAdministrator = true)

round-pushpin Adds an account to a role, and removes it again.
ALTER ROLE Salespersons ADD JohnDoe
ALTER ROLE Salespersons REMOVE JohnDoe

round-pushpin Drops a role.
DROP ROLE SalesAdmins


Schema security is enforced by granting or denying permissions to roles.

Permissions are applied from the root down and can be overridden at any level, either by a policy for a specific schema or by another recursive policy.
To determine an account's permissions on a schema, the engine first checks the policies of the schema itself. Any permission that is still undefined is then looked up in the recursive policies of the schema's parent, and so on up to the root, until every permission has a rule.
This way you can deny a permission recursively at one level and then override it with a grant at a lower level.
paperclip These checks are skipped for administrators.

Read permission allows an account to select from a schema and, with Recursive, from the schemas beneath it.
round-pushpin Allows a role to read from the WordList:Word schema.
GRANT READ ON WordList:Word TO Salespersons

round-pushpin Allows a role to read from WordList and every schema beneath it.
GRANT READ ON WordList TO Salespersons WITH (Recursive = true)

round-pushpin Prevents a role from reading from WordList:Word.
DENY READ ON WordList:Word TO Salespersons


Write permission allows an account to insert, update and delete documents. GRANT WRITE and DENY WRITE follow the same conventions as READ.
round-pushpin Allows a role to write to WordList and every schema beneath it.
GRANT WRITE ON WordList TO Salespersons WITH (Recursive = true)


Manage permission allows an account to manage a schema: create, drop, rebuild and analyze indexes, create child schemas, and grant or deny permissions on the schema to other roles.
round-pushpin Allows a role to manage WordList and every schema beneath it.
GRANT MANAGE ON WordList TO Salespersons WITH (Recursive = true)


round-pushpin Grants every permission on a schema.
GRANT ALL ON WordList:Language TO Salespersons


Revoking does not deny a permission; it removes the explicit policy, so the permission is inherited again.
round-pushpin Removes every explicit policy for a role from a schema.
REVOKE ALL ON WordList:Language FROM Salespersons

round-pushpin Removes the explicit MANAGE policy.
REVOKE MANAGE ON WordList FROM Salespersons


  • ShowSchemaPolicy('Schema'): shows the policy that applies to a schema.
  • ShowMySchemaPolicy('Schema'): shows your own permissions on a schema and where each was inherited from.
  • RefreshMyRoles(): reloads your role memberships without logging in again.


Home
The home page
SQL :: Keywords
A breakdown of all of the statements and keywords supported by the query processor.
SQL :: RefreshMyRoles
Reloads the role memberships of the logged in account. Roles are cached at login, so run this after your memberships change instead of logging out and back in. The roles are returned as messages.
SQL :: ShowMySchemaPolicy
Shows the permissions that the logged in account has on a schema, and the role and schema each was inherited from.
SQL :: ShowSchemaPolicy
Shows the security policy that applies to a schema: each permission, whether it is granted or denied, and the role and schema it was inherited from.