-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extracted-From: prestodb/presto#10904
- Loading branch information
Showing
9 changed files
with
269 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,49 @@ | ||
=========== | ||
CREATE ROLE | ||
=========== | ||
|
||
Synopsis | ||
-------- | ||
|
||
.. code-block:: none | ||
CREATE ROLE role_name | ||
[ WITH ADMIN ( user | USER user | ROLE role | CURRENT_USER | CURRENT_ROLE ) ] | ||
[ IN catalog ] | ||
Description | ||
----------- | ||
|
||
``CREATE ROLE`` creates the specified role in ``catalog`` or in the | ||
current catalog if ``catalog`` is not specified. | ||
|
||
The optional ``WITH ADMIN`` clause causes the role to be created with | ||
the specified user as a role admin. A role admin has permission to drop | ||
or grant a role. If the optional ``WITH ADMIN`` clause is not | ||
specified, the role is created with current user as admin. | ||
|
||
Examples | ||
-------- | ||
|
||
Create role ``admin`` :: | ||
|
||
CREATE ROLE admin; | ||
|
||
Create role ``moderator`` with admin ``bob``:: | ||
|
||
CREATE ROLE moderator WITH ADMIN USER bob; | ||
|
||
Create role ``foo`` in catalog ``bar``:: | ||
|
||
CREATE ROLE foo IN bar; | ||
|
||
Limitations | ||
----------- | ||
|
||
Some connectors do not support role management. | ||
See connector documentation for more details. | ||
|
||
See Also | ||
-------- | ||
|
||
:doc:`drop-role`, :doc:`set-role`, :doc:`grant-roles`, :doc:`revoke-roles` |
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,41 @@ | ||
========= | ||
DROP ROLE | ||
========= | ||
|
||
Synopsis | ||
-------- | ||
|
||
.. code-block:: none | ||
DROP ROLE role_name [ IN catalog ] | ||
Description | ||
----------- | ||
|
||
``DROP ROLE`` drops the specified role in ``catalog`` or in the | ||
current catalog if ``catalog`` is not specified. | ||
|
||
For ``DROP ROLE`` statement to succeed, the user executing it should possess | ||
admin privileges for the given role. | ||
|
||
Examples | ||
-------- | ||
|
||
Drop role ``admin`` :: | ||
|
||
DROP ROLE admin; | ||
|
||
Drop role ``foo`` in catalog ``bar``:: | ||
|
||
DROP ROLE foo IN bar; | ||
|
||
Limitations | ||
----------- | ||
|
||
Some connectors do not support role management. | ||
See connector documentation for more details. | ||
|
||
See Also | ||
-------- | ||
|
||
:doc:`create-role`, :doc:`set-role`, :doc:`grant-roles`, :doc:`revoke-roles` |
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,56 @@ | ||
=========== | ||
GRANT ROLES | ||
=========== | ||
|
||
Synopsis | ||
-------- | ||
|
||
.. code-block:: none | ||
GRANT role [, ...] | ||
TO ( user | USER user | ROLE role) [, ...] | ||
[ GRANTED BY ( user | USER user | ROLE role | CURRENT_USER | CURRENT_ROLE ) ] | ||
[ WITH ADMIN OPTION ] | ||
[ IN catalog ] | ||
Description | ||
----------- | ||
|
||
Grants the specified role(s) to the specified principal(s) in ``catalog`` or | ||
in the current catalog if ``catalog`` is not specified. | ||
|
||
If the ``WITH ADMIN OPTION`` clause is specified, the role(s) are granted | ||
to the users with ``GRANT`` option. | ||
|
||
For the ``GRANT`` statement for roles to succeed, the user executing it either should | ||
be the role admin or should possess the ``GRANT`` option for the given role. | ||
|
||
The optional ``GRANTED BY`` clause causes the role(s) to be granted with | ||
the specified principal as a grantor. If the ``GRANTED BY`` clause is not | ||
specified, the roles are granted with the current user as a grantor. | ||
|
||
Examples | ||
-------- | ||
|
||
Grant role ``bar`` to user ``foo`` :: | ||
|
||
GRANT bar TO USER foo; | ||
|
||
Grant roles ``bar`` and ``foo`` to user ``baz`` and role ``qux`` with admin option :: | ||
|
||
GRANT bar, foo TO USER baz, ROLE qux WITH ADMIN OPTION; | ||
|
||
Grant role ``bar`` to user ``foo`` in catalog ``baz`` :: | ||
|
||
GRANT bar TO USER foo IN baz; | ||
|
||
Limitations | ||
----------- | ||
|
||
Some connectors do not support role management. | ||
See connector documentation for more details. | ||
|
||
See Also | ||
-------- | ||
|
||
:doc:`create-role`, :doc:`drop-role`, :doc:`set-role`, :doc:`revoke-roles` |
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,57 @@ | ||
============ | ||
REVOKE ROLES | ||
============ | ||
|
||
Synopsis | ||
-------- | ||
|
||
.. code-block:: none | ||
REVOKE | ||
[ ADMIN OPTION FOR ] | ||
role [, ...] | ||
FROM ( user | USER user | ROLE role) [, ...] | ||
[ GRANTED BY ( user | USER user | ROLE role | CURRENT_USER | CURRENT_ROLE ) ] | ||
[ IN catalog ] | ||
Description | ||
----------- | ||
|
||
Revokes the specified role(s) from the specified principal(s) in ``catalog`` or | ||
in the current catalog if ``catalog`` is not specified. | ||
|
||
If the ``ADMIN OPTION FOR`` clause is specified, the ``GRANT`` permission is | ||
revoked instead of the role. | ||
|
||
For the ``REVOKE`` statement for roles to succeed, the user executing it either should | ||
be the role admin or should possess the ``GRANT`` option for the given role. | ||
|
||
The optional ``GRANTED BY`` clause causes the role(s) to be revoked with | ||
the specified principal as a revoker. If the ``GRANTED BY`` clause is not | ||
specified, the roles are revoked by the current user as a revoker. | ||
|
||
Examples | ||
-------- | ||
|
||
Revoke role ``bar`` from user ``foo`` :: | ||
|
||
REVOKE bar FROM USER foo; | ||
|
||
Revoke admin option for roles ``bar`` and ``foo`` from user ``baz`` and role ``qux`` :: | ||
|
||
REVOKE ADMIN OPTION FOR bar, foo FROM USER baz, ROLE qux; | ||
|
||
Revoke role ``bar`` from user ``foo`` in catalog ``baz`` :: | ||
|
||
REVOKE bar FROM USER foo IN baz; | ||
|
||
Limitations | ||
----------- | ||
|
||
Some connectors do not support role management. | ||
See connector documentation for more details. | ||
|
||
See Also | ||
-------- | ||
|
||
:doc:`create-role`, :doc:`drop-role`, :doc:`set-role`, :doc:`grant-roles` |
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,37 @@ | ||
======== | ||
SET ROLE | ||
======== | ||
|
||
Synopsis | ||
-------- | ||
|
||
.. code-block:: none | ||
SET ROLE ( role | ALL | NONE ) [ IN catalog ] | ||
Description | ||
----------- | ||
|
||
``SET ROLE`` sets the enabled role for the current session in ``catalog`` | ||
or in the current catalog if ``catalog`` is not specified. | ||
|
||
``SET ROLE role`` enables a single specified role for the current session. | ||
For the ``SET ROLE role`` statement to succeed, the user executing it should | ||
have a grant for the given role. | ||
|
||
``SET ROLE ALL`` enables all roles that the current user has been granted for the | ||
current session. | ||
|
||
``SET ROLE NONE`` disables all the roles granted to the current user for the | ||
current session. | ||
|
||
Limitations | ||
----------- | ||
|
||
Some connectors do not support role management. | ||
See connector documentation for more details. | ||
|
||
See Also | ||
-------- | ||
|
||
:doc:`create-role`, :doc:`drop-role`, :doc:`grant-roles`, :doc:`revoke-roles` |