Skip to content

Commit

Permalink
Merge pull request ClickHouse#1561 from ClickHouse/rbac-kb-article
Browse files Browse the repository at this point in the history
KB article: Common RBAC queries for ClickHouse Cloud
  • Loading branch information
justindeguzman authored Nov 30, 2023
2 parents 7c2e088 + 3886a1e commit bf8b580
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions knowledgebase/common-rbac-queries.md
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;
```

0 comments on commit bf8b580

Please sign in to comment.