Check user privileges

  • POST also GET /_security/user/{user}/_has_privileges
  • POST also GET /_security/user/_has_privileges
Auth

Determine whether the specified 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.

Read the reference documentation

Path parameters

user string optional

Username

Leave it out to use /_security/user/_has_privileges.

Request body

application object[]
application string required

The name of the application.

privileges string[] required

A list of the privileges that you want to check for the specified resources. It may be either application privilege names or the names of actions that are granted by those privileges

resources string[] required

A list of resource names against which the privileges should be checked.

cluster union anyOf[]

A list of the cluster privileges that you want to check.

Values: all cancel_task create_snapshot cross_cluster_replication cross_cluster_search delegate_pki grant_api_key manage manage_api_key manage_autoscaling manage_behavioral_analytics manage_ccr
index object[]
names union oneOf required

A list of indices.

One of: string[] or string
privileges union anyOf[] required

A list of the privileges that you want to check for the specified indices.

Values: all auto_configure create create_doc create_index cross_cluster_replication cross_cluster_replication_internal delete delete_index index maintenance manage
allow_restricted_indices boolean

This needs to be set to true (default is false) if using wildcards or regexps for patterns that cover restricted indices. Implicitly, restricted indices do not match index patterns because restricted indices usually have limited privileges and including them in pattern tests would render most such tests false. If restricted indices are explicitly included in the names list, privileges will be checked against them regardless of the value of allow_restricted_indices.

Response

application/json
application object required
cluster map string to boolean required
has_all_requested boolean required
index map string to string to boolean required
username string required