All methods and paths for this operation:
Determine whether the users associated with the specified user profile IDs have all the requested privileges.
NOTE: The user profile feature is designed only for use by Kibana and Elastic's Observability, Enterprise Search, and Elastic Security solutions. Individual users and external applications should not call this API directly. Elastic reserves the right to change or remove this feature in future releases without prior notice.
read_securityPOST /_security/profile/_has_privileges
{
"uids": [
"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0",
"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1",
"u_does-not-exist_0"
],
"privileges": {
"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" ]
}
]
}
}
resp = client.security.has_privileges_user_profile(
uids=[
"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0",
"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1",
"u_does-not-exist_0"
],
privileges={
"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"
]
}
]
},
)
const response = await client.security.hasPrivilegesUserProfile({
uids: [
"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0",
"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1",
"u_does-not-exist_0",
],
privileges: {
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"],
},
],
},
});
response = client.security.has_privileges_user_profile(
body: {
"uids": [
"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0",
"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1",
"u_does-not-exist_0"
],
"privileges": {
"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"
]
}
]
}
}
)
$resp = $client->security()->hasPrivilegesUserProfile([
"body" => [
"uids" => array(
"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0",
"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1",
"u_does-not-exist_0",
),
"privileges" => [
"cluster" => array(
"monitor",
"create_snapshot",
"manage_ml",
),
"index" => array(
[
"names" => array(
"suppliers",
"products",
),
"privileges" => array(
"create_doc",
),
],
[
"names" => array(
"inventory",
),
"privileges" => array(
"read",
"write",
),
],
),
"application" => array(
[
"application" => "inventory_manager",
"privileges" => array(
"read",
"data:write/inventory",
),
"resources" => array(
"product/1852563",
),
],
),
],
],
]);
curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d '{"uids":["u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0","u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1","u_does-not-exist_0"],"privileges":{"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"]}]}}' "$ELASTICSEARCH_URL/_security/profile/_has_privileges"
client.security().hasPrivilegesUserProfile(h -> h
.privileges(p -> p
.application(a -> a
.application("inventory_manager")
.privileges(List.of("read","data:write/inventory"))
.resources("product/1852563")
)
.cluster(List.of("monitor","create_snapshot","manage_ml"))
.index(List.of(IndexPrivilegesCheck.of(i -> i
.names(List.of("suppliers","products"))
.privileges("create_doc")),IndexPrivilegesCheck.of(i -> i
.names("inventory")
.privileges(List.of("read","write")))))
)
.uids(List.of("u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0","u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1","u_does-not-exist_0"))
);
{
"uids": [
"u_LQPnxDxEjIH0GOUoFkZr5Y57YUwSkL9Joiq-g4OCbPc_0",
"u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1",
"u_does-not-exist_0"
],
"privileges": {
"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" ]
}
]
}
}
{
"has_privilege_uids": ["u_rzRnxDgEHIH0GOUoFkZr5Y27YUwSk19Joiq=g4OCxxB_1"],
"errors": {
"count": 1,
"details": {
"u_does-not-exist_0": {
"type": "resource_not_found_exception",
"reason": "profile document not found"
}
}
}
}