|
@@ -0,0 +1,121 @@
|
|
|
+[role="xpack"]
|
|
|
+[[security-api-has-privileges-user-profile]]
|
|
|
+=== Has privileges user profile API
|
|
|
+++++
|
|
|
+<titleabbrev>Has privileges user profile</titleabbrev>
|
|
|
+++++
|
|
|
+[[security-api-has-privileges-user-profile]]
|
|
|
+
|
|
|
+beta::[]
|
|
|
+
|
|
|
+Determines whether the users associated with the specified <<user-profile, user profile>> IDs
|
|
|
+have all the requested privileges.
|
|
|
+
|
|
|
+[[security-api-has-privileges-user-profile-request]]
|
|
|
+==== {api-request-title}
|
|
|
+
|
|
|
+`GET /_security/profile/_has_privileges`
|
|
|
+
|
|
|
+`POST /_security/profile/_has_privileges`
|
|
|
+
|
|
|
+[[security-api-has-privileges-user-profile-prereqs]]
|
|
|
+==== {api-prereq-title}
|
|
|
+
|
|
|
+To use this API, you must have the `manage_user_profile` cluster privilege.
|
|
|
+
|
|
|
+[[security-api-has-privileges-user-profile-desc]]
|
|
|
+==== {api-description-title}
|
|
|
+
|
|
|
+This API uses the profile IDs, as returned by <<security-api-activate-user-profile>>,
|
|
|
+to identify the users for which to check the privileges of.
|
|
|
+It is similar to the <<security-api-has-privileges>> API, but unlike it, this API
|
|
|
+checks the privileges of other users, not of the user that's calling it.
|
|
|
+
|
|
|
+See <<security-privileges>> for the list of privileges that can be specified in this API.
|
|
|
+
|
|
|
+A successful call returns the subset list of profile IDs that have **all** the requested privileges.
|
|
|
+
|
|
|
+[[security-api-has-privileges-user-profile-request-body]]
|
|
|
+==== {api-request-body-title}
|
|
|
+
|
|
|
+`uids`:: (list) A list of <<security-api-activate-user-profile-response-body, profile IDs>>. The privileges are checked for associated users of the profiles.
|
|
|
+
|
|
|
+`privileges`:: The object containing all the privileges to be checked.
|
|
|
+`cluster`::: (list) A list of the cluster privileges that you want to check.
|
|
|
+`index`:::
|
|
|
+`names`:::: (list) A list of indices.
|
|
|
+`allow_restricted_indices`:::: (Boolean) This needs to be set to `true` (default
|
|
|
+is `false`) if using wildcards or regexps for patterns that cover restricted
|
|
|
+indices. Implicitly, restricted indices do not match index patterns because
|
|
|
+restricted indices usually have limited privileges and including them in
|
|
|
+pattern tests would render most such tests `false`. If restricted indices are
|
|
|
+explicitly included in the `names` list, privileges will be checked against
|
|
|
+them regardless of the value of `allow_restricted_indices`.
|
|
|
+`privileges`:::: (list) A list of the privileges that you want to check for the
|
|
|
+specified indices.
|
|
|
+`application`:::
|
|
|
+`application`:::: (string) The name of the application.
|
|
|
+`privileges`:::: (list) A list of the privileges that you want to check for the
|
|
|
+specified resources. May be either application privilege names, or the names of
|
|
|
+actions that are granted by those privileges.
|
|
|
+`resources`:::: (list) A list of resource names against which the privileges
|
|
|
+should be checked.
|
|
|
+
|
|
|
+Note that the `privileges` section above is identical to the
|
|
|
+<<security-api-has-privileges-request-body, request body of the other Has Privileges API>>.
|
|
|
+
|
|
|
+[[security-api-has-privileges-user-profile-response-body]]
|
|
|
+==== {api-response-body-title}
|
|
|
+
|
|
|
+A successful has privileges user profile API call returns a JSON structure that contains
|
|
|
+two list fields:
|
|
|
+
|
|
|
+`has_privilege_uids`:: (list) The subset of the requested profile IDs of the users that have
|
|
|
+**all** the requested privileges.
|
|
|
+
|
|
|
+`error_uids`:: (list) The subset of the requested profile IDs for which an error was
|
|
|
+encountered. It does **not** include the missing profile IDs or the profile IDs of
|
|
|
+the users that do not have all the requested privileges. This field is absent if empty.
|
|
|
+
|
|
|
+[[security-api-has-privileges-user-profile-example]]
|
|
|
+==== {api-examples-title}
|
|
|
+
|
|
|
+The following example checks whether the two users associated with the specified profiles have all the
|
|
|
+requested set of cluster, index, and application privileges:
|
|
|
+
|
|
|
+[source,console]
|
|
|
+--------------------------------------------------
|
|
|
+POST /_security/user/_has_privileges
|
|
|
+{
|
|
|
+ "uids": ["u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0", "u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1"],
|
|
|
+ "cluster": [ "monitor", "create_snapshot", "manage_ml" ],
|
|
|
+ "index" : [
|
|
|
+ {
|
|
|
+ "names": [ "suppliers", "products" ],
|
|
|
+ "privileges": [ "create_doc"]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "names": [ "inventory" ],
|
|
|
+ "privileges" : [ "read", "write" ]
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "application": [
|
|
|
+ {
|
|
|
+ "application": "inventory_manager",
|
|
|
+ "privileges" : [ "read", "data:write/inventory" ],
|
|
|
+ "resources" : [ "product/1852563" ]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+}
|
|
|
+--------------------------------------------------
|
|
|
+// TEST[skip:TODO setup and tests will be possible once the profile uid is predictable]
|
|
|
+
|
|
|
+The following example output indicates that only one of the two users has all the privileges:
|
|
|
+
|
|
|
+[source,js]
|
|
|
+--------------------------------------------------
|
|
|
+{
|
|
|
+ "has_privilege_uids": ["u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1"]
|
|
|
+}
|
|
|
+--------------------------------------------------
|
|
|
+// NOTCONSOLE
|