forked from ClickHouse/clickhouse-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ClickHouse#1561 from ClickHouse/rbac-kb-article
KB article: Common RBAC queries for ClickHouse Cloud
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
title: Common RBAC queries | ||
description: "Queries to help grant specific permissions to users." | ||
date: 2023-09-28 | ||
--- | ||
|
||
# Common role-based access control (RBAC) queries | ||
|
||
## How do I grant the same permissions as the current user to another user? | ||
|
||
```sql | ||
GRANT CURRENT GRANTS ON *.* TO another_user; | ||
``` | ||
|
||
## How do I grant a specific permission to a user based on the grants of the current user? | ||
|
||
In the below example, `another_user` will be able to perform `SELECT` commands on all of the databases and tables of the current user. | ||
|
||
```sql | ||
GRANT CURRENT GRANTS(SELECT ON *.*) TO another_user; | ||
``` | ||
|
||
## How do I grant a specific permission to a user for a specific database based on the grants of the current user? | ||
|
||
In the below example, `another_user` will be able to perform `INSERT` commands to all tables in `my_database`. | ||
|
||
```sql | ||
GRANT INSERT ON my_database.* TO another_user; | ||
``` | ||
|
||
## How do I give access to all grants for a specific user based on the default user? | ||
|
||
```sql | ||
GRANT default_role TO another_user; | ||
``` |