elasticsearch/docs/reference/rest-api/security/get-user-privileges.asciidoc
James Rodewig 255c9a7f95
[DOCS] Move x-pack docs to docs/reference dir (#99209)
**Problem:**
For historical reasons, source files for the Elasticsearch Guide's security, watcher, and Logstash API docs are housed in the `x-pack/docs` directory. This can confuse new contributors who expect Elasticsearch Guide docs to be located in `docs/reference`. 

**Solution:**
- Move the security, watcher, and Logstash API doc source files to the `docs/reference` directory
- Update doc snippet tests to use security

Rel: https://github.com/elastic/platform-docs-team/issues/208
2023-09-12 14:53:41 -04:00

72 lines
1.5 KiB
Text

[role="xpack"]
[[security-api-get-user-privileges]]
=== Get user privileges API
++++
<titleabbrev>Get user privileges</titleabbrev>
++++
Retrieves the <<security-privileges,security privileges>> for the logged in
user.
[[security-api-get-user-privileges-request]]
==== {api-request-title}
`GET /_security/user/_privileges`
[[security-api-get-user-privileges-prereqs]]
==== {api-prereq-title}
* 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 <<run-as-privilege>>.
[[security-api-get-user-privileges-desc]]
==== {api-description-title}
To check whether a user has a specific list of privileges, use the
<<security-api-has-privileges,has privileges API>>.
[[security-api-get-user-privileges-example]]
==== {api-examples-title}
[source,console]
--------------------------------------------------
GET /_security/user/_privileges
--------------------------------------------------
[source,console-result]
--------------------------------------------------
{
"cluster" : [
"all"
],
"global" : [ ],
"indices" : [
{
"names" : [
"*"
],
"privileges" : [
"all"
],
"allow_restricted_indices" : true
}
],
"applications" : [
{
"application" : "*",
"privileges" : [
"*"
],
"resources" : [
"*"
]
}
],
"run_as" : [
"*"
]
}
--------------------------------------------------
// TESTRESPONSE[s/: false/: true/]