WARNING: Version 5.4 of the Elastic Stack has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Privilege APIs
editPrivilege APIs
editThe has_privileges
API allows you to determine whether the logged in user has
a specified list of privileges.
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.
To check you privileges, submit a GET request to the
_xpack/security/user/_has_privileges
endpoint:
GET _xpack/security/user/_has_privileges { "cluster": [ "monitor", "manage" ], "index" : [ { "names": [ "suppliers", "products" ], "privileges": [ "read" ] }, { "names": [ "inventory" ], "privileges" : [ "read", "write" ] } ] }
A successful call returns a JSON structure that shows whether each specified privilege is assigned to the user
{ "username": "rdeniro", "has_all_requested" : false, "cluster" : { "monitor" : true, "manage" : false }, "index" : { "suppliers" : { "read" : true }, "products" : { "read" : true }, "inventory" : { "read" : true, "write" : false } } }