Class HasPrivilegesResponse
java.lang.Object
org.elasticsearch.client.security.HasPrivilegesResponse
Response when checking whether the current user has a defined set of privileges.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
static HasPrivilegesResponse
fromXContent
(org.elasticsearch.xcontent.XContentParser parser) AMap
from application-name + resource-name + privilege-name to access.AMap
from cluster-privilege-name to access.AMap
from index-name + privilege-name to access.The username (principal) of the user for which the privileges check was executed.boolean
true
if the user has every privilege that was checked.boolean
hasApplicationPrivilege
(String applicationName, String resourceName, String privilegeName) boolean
hasClusterPrivilege
(String clusterPrivilegeName) int
hashCode()
boolean
hasIndexPrivilege
(String indexName, String privilegeName)
-
Constructor Details
-
HasPrivilegesResponse
-
-
Method Details
-
fromXContent
public static HasPrivilegesResponse fromXContent(org.elasticsearch.xcontent.XContentParser parser) throws IOException - Throws:
IOException
-
getUsername
The username (principal) of the user for which the privileges check was executed. -
hasAllRequested
public boolean hasAllRequested()true
if the user has every privilege that was checked. Otherwisefalse
. -
hasClusterPrivilege
- Parameters:
clusterPrivilegeName
- The name of a cluster privilege. This privilege must have been specified (verbatim) in thecluster privileges of the request
.- Returns:
true
if the user has the specified cluster privilege.false
if the privilege was checked but it has not been granted to the user.- Throws:
IllegalArgumentException
- if the response did not include a value for the specified privilege name. The response only includes values for privileges that wereincluded in the request
.
-
hasIndexPrivilege
- Parameters:
indexName
- The name of the index to check. This index must have been specified (verbatim) in therequested index privileges
.privilegeName
- The name of the index privilege to check. This privilege must have been specified (verbatim), for the given index, in therequested index privileges
.- Returns:
true
if the user has the specified privilege on the specified index.false
if the privilege was checked for that index and was not granted to the user.- Throws:
IllegalArgumentException
- if the response did not include a value for the specified index and privilege name pair. The response only includes values for indices and privileges that wereincluded in the request
.
-
hasApplicationPrivilege
public boolean hasApplicationPrivilege(String applicationName, String resourceName, String privilegeName) - Parameters:
applicationName
- The name of the application to check. This application must have been specified (verbatim) in therequested application privileges
.resourceName
- The name of the resource to check. This resource must have been specified (verbatim), for the given application in therequested application privileges
.privilegeName
- The name of the privilege to check. This privilege must have been specified (verbatim), for the given application and resource, in therequested application privileges
.- Returns:
true
if the user has the specified privilege on the specified resource in the specified application.false
if the privilege was checked for that application and resource, but was not granted to the user.- Throws:
IllegalArgumentException
- if the response did not include a value for the specified application, resource and privilege triplet. The response only includes values for applications, resources and privileges that wereincluded in the request
.
-
getClusterPrivileges
AMap
from cluster-privilege-name to access. Each requested privilege is included as a key in the map, and the associated value indicates whether the user was granted that privilege.The
hasClusterPrivilege(java.lang.String)
method should be used in preference to directly accessing this map. -
getIndexPrivileges
AMap
from index-name + privilege-name to access. Each requested index is a key in the outer map. Each requested privilege is a key in the inner map. The inner mostBoolean
value indicates whether the user was granted that privilege on that index.The
hasIndexPrivilege(java.lang.String, java.lang.String)
method should be used in preference to directly accessing this map. -
getApplicationPrivileges
AMap
from application-name + resource-name + privilege-name to access. Each requested application is a key in the outer-most map. Each requested resource is a key in the next-level map. The requested privileges form the keys in the inner-most map. TheBoolean
value indicates whether the user was granted that privilege on that resource within that application.The
hasApplicationPrivilege(java.lang.String, java.lang.String, java.lang.String)
method should be used in preference to directly accessing this map. -
equals
-
hashCode
public int hashCode()
-