Class HasPrivilegesResponse
- java.lang.Object
-
- org.elasticsearch.client.security.HasPrivilegesResponse
-
public final class HasPrivilegesResponse extends java.lang.Object
Response when checking whether the current user has a defined set of privileges.
-
-
Constructor Summary
Constructors Constructor Description HasPrivilegesResponse(java.lang.String username, boolean hasAllRequested, java.util.Map<java.lang.String,java.lang.Boolean> clusterPrivileges, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Boolean>> indexPrivileges, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Boolean>>> applicationPrivileges)
-
Method Summary
Modifier and Type Method Description boolean
equals(java.lang.Object o)
static HasPrivilegesResponse
fromXContent(XContentParser parser)
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Boolean>>>
getApplicationPrivileges()
AMap
from application-name + resource-name + privilege-name to access.java.util.Map<java.lang.String,java.lang.Boolean>
getClusterPrivileges()
AMap
from cluster-privilege-name to access.java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Boolean>>
getIndexPrivileges()
AMap
from index-name + privilege-name to access.java.lang.String
getUsername()
The username (principal) of the user for which the privileges check was executed.boolean
hasAllRequested()
true
if the user has every privilege that was checked.boolean
hasApplicationPrivilege(java.lang.String applicationName, java.lang.String resourceName, java.lang.String privilegeName)
boolean
hasClusterPrivilege(java.lang.String clusterPrivilegeName)
int
hashCode()
boolean
hasIndexPrivilege(java.lang.String indexName, java.lang.String privilegeName)
-
-
-
Constructor Detail
-
HasPrivilegesResponse
public HasPrivilegesResponse(java.lang.String username, boolean hasAllRequested, java.util.Map<java.lang.String,java.lang.Boolean> clusterPrivileges, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Boolean>> indexPrivileges, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Boolean>>> applicationPrivileges)
-
-
Method Detail
-
fromXContent
public static HasPrivilegesResponse fromXContent(XContentParser parser) throws java.io.IOException
- Throws:
java.io.IOException
-
getUsername
public java.lang.String 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
public boolean hasClusterPrivilege(java.lang.String clusterPrivilegeName) throws java.lang.IllegalArgumentException
- 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:
java.lang.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
public boolean hasIndexPrivilege(java.lang.String indexName, java.lang.String privilegeName)
- 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:
java.lang.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(java.lang.String applicationName, java.lang.String resourceName, java.lang.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:
java.lang.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
public java.util.Map<java.lang.String,java.lang.Boolean> 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
public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Boolean>> 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
public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Boolean>>> 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
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-