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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic HasPrivilegesResponsefromXContent(org.elasticsearch.xcontent.XContentParser parser) AMapfrom application-name + resource-name + privilege-name to access.AMapfrom cluster-privilege-name to access.AMapfrom index-name + privilege-name to access.The username (principal) of the user for which the privileges check was executed.booleantrueif the user has every privilege that was checked.booleanhasApplicationPrivilege(String applicationName, String resourceName, String privilegeName) booleanhasClusterPrivilege(String clusterPrivilegeName) inthashCode()booleanhasIndexPrivilege(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()trueif 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:
trueif the user has the specified cluster privilege.falseif 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:
trueif the user has the specified privilege on the specified index.falseif 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:
trueif the user has the specified privilege on the specified resource in the specified application.falseif 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
AMapfrom 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
AMapfrom 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 mostBooleanvalue 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
AMapfrom 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. TheBooleanvalue 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()
-