> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-detect-table-modification.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Типовые запросы RBAC

> Запросы, которые помогут grant пользователям определенные разрешения.

{frontMatter.description}

<div id="introduction">
  ## Введение
</div>

Ниже приведены типовые запросы для выдачи пользователям определённых разрешений.

<div id="how-do-i-grant-the-same-permissions-as-the-current-user-to-another-user">
  ## Как выдать другому пользователю те же разрешения, что и текущему пользователю?
</div>

```sql theme={null}
GRANT CURRENT GRANTS ON *.* TO another_user;
```

<div id="how-do-i-grant-a-specific-permission-to-a-user-based-on-the-grants-of-the-current-user">
  ## Как выдать пользователю определённое разрешение на основе привилегий текущего пользователя?
</div>

В приведённом ниже примере `another_user` сможет выполнять команды `SELECT` для всех баз данных и таблиц текущего пользователя.

```sql theme={null}
GRANT CURRENT GRANTS(SELECT ON *.*) TO another_user;
```

<div id="how-do-i-grant-a-specific-permission-to-a-user-for-a-specific-database-based-on-the-grants-of-the-current-user">
  ## Как предоставить пользователю определённое разрешение для конкретной базы данных, исходя из привилегий текущего пользователя?
</div>

В приведённом ниже примере `another_user` сможет выполнять команды `INSERT` для всех таблиц в `my_database`.

```sql theme={null}
GRANT INSERT ON my_database.* TO another_user;
```

<div id="how-do-i-give-access-to-all-grants-for-a-specific-user-based-on-the-default-user">
  ## Как предоставить конкретному пользователю все привилегии пользователя по умолчанию?
</div>

```sql theme={null}
GRANT default_role TO another_user;
```
