getDBAccess

Syntax

getDBAccess(dbUrl)

Arguments

dbUrl is a string indicating the database URL.

Details

Allow users to get a detailed view of users and groups with privileges of the specified database.

Note: This function can only be invoked by administrators or by users with DB_OWNER or DB_MANAGE privileges of the database.

Return value: A table with the following columns:

  • name: The user or group name.
  • type: User or group.
  • DB_READ, DB_INSERT, DB_UPDATE, DB_DELETE, DBOBJ_CREATE, DBOBJ_DELETE, DB_MANAGE: The specific privileges. The states can be ALLOW, DENY, or NONE. For more information on user access privileges, please refer to User Access Control.

Examples

User1 with the DB_OWNER privilege creates the database dfs://testDB with following settings:

  • Grants DB_READ privilege to user2.
  • Denies DB_INSERT privilege to user3.
  • Grants DBOBJ_CREATE privilege to group1.

Use getDBAccess to view the permission set of testDB.

login(`user1, `123456)
getDBAccess("dfs://testDB")
Output:
name type DB_READ DB_INSERT DB_UPDATE DB_DELETE DBOBJ_CREATE DBOBJ_DELETE DB_MANAGE
group1 group NONE NONE NONE NONE ALLOW NONE NONE
user3 user NONE DENY NONE NONE NONE NONE NONE
user2 user ALLOW NONE NONE NONE NONE NONE NONE
admin user ALLOW ALLOW ALLOW ALLOW ALLOW ALLOW ALLOW

Related functions: getTableAccess