-
Notifications
You must be signed in to change notification settings - Fork 465
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: Implement SHOW PRIVILEGES command (#22393)
This commit implements a SHOW PRIVILEGES command that allow users to display all privileges. The command allows optional filtering on object type or role grantee. Works towards resolving #20452
- Loading branch information
Showing
10 changed files
with
479 additions
and
2 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
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
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,78 @@ | ||
--- | ||
title: "SHOW PRIVILEGES" | ||
description: "`SHOW PRIVILEGES` lists the privileges granted in Materialize." | ||
menu: | ||
main: | ||
parent: 'commands' | ||
|
||
--- | ||
|
||
`SHOW PRIVILEGES` lists the privileges granted as part of [access control](/manage/access-control/) in Materialize. | ||
|
||
## Syntax | ||
|
||
{{< diagram "show-privileges.svg" >}} | ||
|
||
Field | Use | ||
----------------------------------------------------|-------------------------------------------------- | ||
_object_name_ | Only shows privileges for a specific object type. | ||
_role_name_ | Only shows privileges granted directly or indirectly to _role_name_. | ||
|
||
## Examples | ||
|
||
```sql | ||
SHOW PRIVILEGES; | ||
``` | ||
|
||
```nofmt | ||
grantor | grantee | database | schema | name | object_type | privilege_type | ||
-----------+-------------+-------------+--------+-------------+-------------+---------------- | ||
mz_system | PUBLIC | materialize | | public | schema | USAGE | ||
mz_system | PUBLIC | | | default | cluster | USAGE | ||
mz_system | PUBLIC | | | materialize | database | USAGE | ||
mz_system | materialize | materialize | | public | schema | CREATE | ||
mz_system | materialize | materialize | | public | schema | USAGE | ||
mz_system | materialize | | | default | cluster | CREATE | ||
mz_system | materialize | | | default | cluster | USAGE | ||
mz_system | materialize | | | materialize | database | CREATE | ||
mz_system | materialize | | | materialize | database | USAGE | ||
mz_system | materialize | | | | system | CREATECLUSTER | ||
mz_system | materialize | | | | system | CREATEDB | ||
mz_system | materialize | | | | system | CREATEROLE | ||
``` | ||
|
||
```sql | ||
SHOW PRIVILEGES ON SCHEMAS; | ||
``` | ||
|
||
```nofmt | ||
grantor | grantee | database | schema | name | object_type | privilege_type | ||
-----------+-------------+-------------+--------+--------+-------------+---------------- | ||
mz_system | PUBLIC | materialize | | public | schema | USAGE | ||
mz_system | materialize | materialize | | public | schema | CREATE | ||
mz_system | materialize | materialize | | public | schema | USAGE | ||
``` | ||
|
||
```sql | ||
SHOW PRIVILEGES FOR materialize; | ||
``` | ||
|
||
```nofmt | ||
grantor | grantee | database | schema | name | object_type | privilege_type | ||
-----------+-------------+-------------+--------+-------------+-------------+---------------- | ||
mz_system | materialize | materialize | | public | schema | CREATE | ||
mz_system | materialize | materialize | | public | schema | USAGE | ||
mz_system | materialize | | | default | cluster | CREATE | ||
mz_system | materialize | | | default | cluster | USAGE | ||
mz_system | materialize | | | materialize | database | CREATE | ||
mz_system | materialize | | | materialize | database | USAGE | ||
mz_system | materialize | | | | system | CREATECLUSTER | ||
mz_system | materialize | | | | system | CREATEDB | ||
mz_system | materialize | | | | system | CREATEROLE | ||
``` | ||
|
||
## Related pages | ||
|
||
- [GRANT PRIVILEGE](../grant-privilege) | ||
- [REVOKE PRIVILEGE](../revoke-privilege) | ||
- [access control](/manage/access-control/) |
107 changes: 107 additions & 0 deletions
107
doc/user/layouts/partials/sql-grammar/show-privileges.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
Oops, something went wrong.