mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-22 14:17:51 -04:00
This adds the Query Roles API: ``` POST /_security/_query/role GET /_security/_query/role ``` This is similar to the currently existing: * [Query API key API](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-query-api-key.html) * [Query User API](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-query-user.html) Sample request: ``` POST /_security/_query/role { "query": { "bool": { "filter": [ { "terms": { "applications.application": ["app-1", "app-2" ] } } ], "must_not": [ { "match": { "description": { "query": "test match on role description (which is mapped as a text field)" } } } ] } }, "sort": [ "name" ], "search_after": [ "role-name-1" ] } ``` The query supports a subset of query types, including match_all, bool, term, terms, match, ids, prefix, wildcard, exists, range, and simple query string. Currently, the supported fields are: * name * description * metadata * applications.application * applications.resources * applications.privileges The query also supports pagination-related fields (`from`, `size`, `search_after`), analogous to the generic [Search API](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html). The response format is similar to that of the [Query API key](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-query-api-key.html) and [Query User](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-query-user.html) APIs. It contains a **list** of roles, in the sorted order (if specified). Unlike the [Get Roles API](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role.html), the role **name** is an attribute of the element in the list of roles (in the get-roles API case, the role name was the key in the response map, and the value was the rest of the role descriptor). In addition, the element in the list of roles also contains the optional `_sort` field, eg (sample response): ``` { "total": 3, "count": 3, "roles": [ { "name": "LYdz2", "cluster": [], "indices": [], "applications": [ { "application": "ejYWvGQTF", "privileges": [ "pRCfBMgOy", "zDhFtMQfc", "roudxado" ], "resources": [ "nWHEpmgxy", "SOML/hMYrqx", "YIqP/*", "ueEomwsA" ] }, { "application": "ampUW9", "privileges": [ "jDvRtp" ], "resources": [ "99" ] } ], "run_as": [], "metadata": { "nFKc": [ 1, 0 ], "PExF": [], "qlqY": -433239865, "IQXm": [] }, "transient_metadata": { "enabled": true }, "description": "KoLlsEbq", "_sort": [ "LYdz2" ] }, { "name": "oaxW0", "cluster": [], "indices": [], "applications": [ { "application": "*", "privileges": [ "qZYb" ], "resources": [ "tFrSULaKb" ] }, { "application": "aLaEN9", "privileges": [ "fCOc" ], "resources": [ "gozqXtSgE", "UX/JgydeIM", "sjUp", "Ivdz/UAmuNrQAG" ] }, { "application": "rbxyuKIMPAp", "privileges": [ "lluqieFRu", "xKU", "gHlb" ], "resources": [ "99" ] } ], "run_as": [], "metadata": {}, "transient_metadata": { "enabled": true }, "_sort": [ "oaxW0" ] }, { "name": "vWAV1", "cluster": [], "indices": [], "applications": [ { "application": "*", "privileges": [ "kWBWjCAc" ], "resources": [ "hvEtV", "gZJ" ] }, { "application": "avVUV9", "privileges": [ "newZTa", "gQpxNm" ], "resources": [ "99" ] } ], "run_as": [], "metadata": {}, "transient_metadata": { "enabled": true }, "_sort": [ "vWAV1" ] } ] } ``` |
||
---|---|---|
.. | ||
core-rest-tests-with-security | ||
evil-tests | ||
freeze-plugin | ||
full-cluster-restart | ||
kerberos-tests | ||
mixed-tier-cluster | ||
multi-cluster-search-security | ||
multi-node | ||
oidc-op-tests | ||
openldap-tests | ||
password-protected-keystore | ||
reindex-tests-with-security | ||
repository-old-versions | ||
rolling-upgrade | ||
rolling-upgrade-basic | ||
rolling-upgrade-multi-cluster | ||
runtime-fields | ||
saml-idp-tests | ||
security-example-spi-extension | ||
security-setup-password-tests | ||
security-tools-tests | ||
smoke-test-plugins | ||
smoke-test-plugins-ssl | ||
smoke-test-security-with-mustache | ||
src/main/java/org/elasticsearch/xpack/test | ||
third-party | ||
xpack-prefix-rest-compat | ||
build.gradle |