Class HasPrivilegesResponse

java.lang.Object
org.elasticsearch.client.security.HasPrivilegesResponse

public final class HasPrivilegesResponse extends Object
Response when checking whether the current user has a defined set of privileges.
  • Constructor Details

  • Method Details

    • fromXContent

      public static HasPrivilegesResponse fromXContent(org.elasticsearch.xcontent.XContentParser parser) throws IOException
      Throws:
      IOException
    • getUsername

      public 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. Otherwise false.
    • hasClusterPrivilege

      public boolean hasClusterPrivilege(String clusterPrivilegeName) throws IllegalArgumentException
      Parameters:
      clusterPrivilegeName - The name of a cluster privilege. This privilege must have been specified (verbatim) in the cluster 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 were included in the request.
    • hasIndexPrivilege

      public boolean hasIndexPrivilege(String indexName, String privilegeName)
      Parameters:
      indexName - The name of the index to check. This index must have been specified (verbatim) in the requested index privileges.
      privilegeName - The name of the index privilege to check. This privilege must have been specified (verbatim), for the given index, in the requested 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 were included 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 the requested application privileges.
      resourceName - The name of the resource to check. This resource must have been specified (verbatim), for the given application in the requested application privileges.
      privilegeName - The name of the privilege to check. This privilege must have been specified (verbatim), for the given application and resource, in the requested 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 were included in the request.
    • getClusterPrivileges

      public Map<String,Boolean> getClusterPrivileges()
      A Map 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 Map<String,Map<String,Boolean>> getIndexPrivileges()
      A Map 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 most Boolean 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 Map<String,Map<String,Map<String,Boolean>>> getApplicationPrivileges()
      A Map 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. The Boolean 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(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object