| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 | --:api: has-privileges:request: HasPrivilegesRequest:response: HasPrivilegesResponse--[role="xpack"][id="{upid}-{api}"]=== Has Privileges API[id="{upid}-{api}-request"]==== Has Privileges RequestThe +{request}+ supports checking for any or all of the following privilege types:* Cluster Privileges* Index Privileges* Application PrivilegesPrivileges types that you do not wish to check my be passed in as +null+, but as leastone privilege must be specified.["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-request]--------------------------------------------------include::../execution.asciidoc[][id="{upid}-{api}-response"]==== Has Privileges ResponseThe returned +{response}+ contains the following properties`username`::The username (userid) of the current user (for whom the "has privileges"check was executed)`hasAllRequested`::`true` if the user has all of the privileges that were specified in the+{request}+. Otherwise `false`.`clusterPrivileges`::A `Map<String,Boolean>` where each key is the name of one of the clusterprivileges specified in the request, and the value is `true` if the userhas that privilege, and `false` otherwise.+The method `hasClusterPrivilege` can be used to retrieve this informationin a more fluent manner. This method throws an `IllegalArgumentException`if the privilege was not included in the response (which will be the caseif the privilege was not part of the request).`indexPrivileges`::A `Map<String, Map<String, Boolean>>` where each key is the name of anindex (as specified in the +{request}+) and the value is a `Map` fromprivilege name to a `Boolean`. The `Boolean` value is `true` if the userhas that privilege on that index, and `false` otherwise.+The method `hasIndexPrivilege` can be used to retrieve this informationin a more fluent manner. This method throws an `IllegalArgumentException`if the privilege was not included in the response (which will be the caseif the privilege was not part of the request).`applicationPrivileges`::A `Map<String, Map<String, Map<String, Boolean>>>>` where each key is thename of an application (as specified in the +{request}+).For each application, the value is a `Map` keyed by resource name, witheach value  being another `Map` from privilege name to a `Boolean`.The `Boolean` value is `true` if the user has that privilege on that resource for that application, and `false` otherwise.+The method `hasApplicationPrivilege` can be used to retrieve this information in a more fluent manner. This method throws an`IllegalArgumentException` if the privilege was not included in theresponse (which will be the case if the privilege was not part of therequest).["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests-file}[{api}-response]--------------------------------------------------<1> `hasMonitor` will be `true` if the user has the `"monitor"`    cluster privilege.<2> `hasWrite` will be `true` if the user has the `"write"`    privilege on the `"logstash-2018-10-05"` index.<3> `hasRead` will be `true` if the user has the `"read"`    privilege on all possible indices that would match    the `"logstash-2018-*"` pattern.
 |