[DOCS] Formatted the privileges API (elastic/x-pack-elasticsearch#2575)
Original commit: elastic/x-pack-elasticsearch@9080eb9535
This commit is contained in:
parent
6957282b50
commit
9c8b5fb98a
|
@ -7,13 +7,41 @@
|
|||
The `has_privileges` API allows you to determine whether the logged in user has
|
||||
a specified list of privileges.
|
||||
|
||||
==== Request
|
||||
|
||||
`GET _xpack/security/user/_has_privileges`
|
||||
|
||||
|
||||
==== Description
|
||||
|
||||
For a list of the privileges that you can specify in this API,
|
||||
see {xpack-ref}/security-privileges.html[Security Privileges].
|
||||
|
||||
A successful call returns a JSON structure that shows whether each specified
|
||||
privilege is assigned to the user.
|
||||
|
||||
|
||||
==== Request Body
|
||||
|
||||
`cluster`:: (list) A list of the cluster privileges that you want to check.
|
||||
|
||||
`index`::
|
||||
`names`::: (list) A list of indices.
|
||||
`privileges`::: (list) A list of the privileges that you want to check for the
|
||||
specified indices.
|
||||
|
||||
==== Authorization
|
||||
|
||||
All users can use this API, but only to determine their own privileges.
|
||||
To check the privileges of other users, you must use the run as feature. For
|
||||
more information, see
|
||||
{xpack-ref}/run-as-privilege.html[Submitting Requests on Behalf of Other Users].
|
||||
|
||||
To check you privileges, submit a GET request to the
|
||||
`_xpack/security/user/_has_privileges` endpoint:
|
||||
|
||||
==== Examples
|
||||
|
||||
The following example checks whether the current user has a specific set of
|
||||
cluster and indices privileges:
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
|
@ -34,8 +62,7 @@ GET _xpack/security/user/_has_privileges
|
|||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
||||
A successful call returns a JSON structure that shows whether each specified
|
||||
privilege is assigned to the user
|
||||
The following example output indicates which privileges the "rdeniro" user has:
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue