kibana/dev_docs
Elena Shostak 2ff384b02a
[9.0] [Authz] Added allOf and anyOf nested conditions (#215516) (#217051)
# Backport

This will backport the following commits from `main` to `9.0`:
- [[Authz] Added allOf and anyOf nested conditions
(#215516)](https://github.com/elastic/kibana/pull/215516)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Elena
Shostak","email":"165678770+elena-shostak@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-04-03T12:28:17Z","message":"[Authz]
Added allOf and anyOf nested conditions (#215516)\n\n##
Summary\n\nCurrently, our `requiredPrivileges` structure supports
`allRequired` and\n`anyRequired` for defining authorization logic.
However, there is [a\nneed
to\nsupport](https://github.com/elastic/kibana/pull/205335#issuecomment-2569275302)\nmore
complex scenarios as `(privilege1 AND privilege2) OR (privilege3\nAND
privilege4)`\n\nTo achieve `anyRequired` has been extended to allow
defining multiple\nAND conditions evaluated with OR
logic:\n```ts\nsecurity: {\n authz: {\n requiredPrivileges: [{\n
anyRequired: [\n { allOf: ['privilege1', 'privilege2'] }, \n { allOf:
['privilege3', 'privilege4'] }\n ] \n }\n ]\n }\n}\n```\n\n`allRequired`
now also supports scenarios `(privilege1 OR privilege2)\nAND (privilege3
OR privilege4)`\n```ts\nsecurity: {\n authz: {\n requiredPrivileges:
[{\n allRequired: [\n { anyOf: ['privilege1', 'privilege2'] }, \n {
anyOf: ['privilege3', 'privilege4'] }\n ] \n }\n ]\n }\n}\n```\n\n>
[!IMPORTANT]\n> We expect to have unique privileges in `anyOf` or
`allOf` conditions,\nassuming that most complex conditions can be
simplified by boolean\nalgebra laws (OR/AND distributive etc).\n\n\n###
Checklist\n\n-
[x]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n__Closes:
https://github.com/elastic/kibana/issues/210977__\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"ed058086e27c2b6f5015647b446304608d6b14a9","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Security","enhancement","release_note:skip","Feature:Security/Authorization","backport:prev-minor","backport:version","v9.1.0","v8.19.0"],"title":"[Authz]
Added allOf and anyOf nested
conditions","number":215516,"url":"https://github.com/elastic/kibana/pull/215516","mergeCommit":{"message":"[Authz]
Added allOf and anyOf nested conditions (#215516)\n\n##
Summary\n\nCurrently, our `requiredPrivileges` structure supports
`allRequired` and\n`anyRequired` for defining authorization logic.
However, there is [a\nneed
to\nsupport](https://github.com/elastic/kibana/pull/205335#issuecomment-2569275302)\nmore
complex scenarios as `(privilege1 AND privilege2) OR (privilege3\nAND
privilege4)`\n\nTo achieve `anyRequired` has been extended to allow
defining multiple\nAND conditions evaluated with OR
logic:\n```ts\nsecurity: {\n authz: {\n requiredPrivileges: [{\n
anyRequired: [\n { allOf: ['privilege1', 'privilege2'] }, \n { allOf:
['privilege3', 'privilege4'] }\n ] \n }\n ]\n }\n}\n```\n\n`allRequired`
now also supports scenarios `(privilege1 OR privilege2)\nAND (privilege3
OR privilege4)`\n```ts\nsecurity: {\n authz: {\n requiredPrivileges:
[{\n allRequired: [\n { anyOf: ['privilege1', 'privilege2'] }, \n {
anyOf: ['privilege3', 'privilege4'] }\n ] \n }\n ]\n }\n}\n```\n\n>
[!IMPORTANT]\n> We expect to have unique privileges in `anyOf` or
`allOf` conditions,\nassuming that most complex conditions can be
simplified by boolean\nalgebra laws (OR/AND distributive etc).\n\n\n###
Checklist\n\n-
[x]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n__Closes:
https://github.com/elastic/kibana/issues/210977__\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"ed058086e27c2b6f5015647b446304608d6b14a9"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/215516","number":215516,"mergeCommit":{"message":"[Authz]
Added allOf and anyOf nested conditions (#215516)\n\n##
Summary\n\nCurrently, our `requiredPrivileges` structure supports
`allRequired` and\n`anyRequired` for defining authorization logic.
However, there is [a\nneed
to\nsupport](https://github.com/elastic/kibana/pull/205335#issuecomment-2569275302)\nmore
complex scenarios as `(privilege1 AND privilege2) OR (privilege3\nAND
privilege4)`\n\nTo achieve `anyRequired` has been extended to allow
defining multiple\nAND conditions evaluated with OR
logic:\n```ts\nsecurity: {\n authz: {\n requiredPrivileges: [{\n
anyRequired: [\n { allOf: ['privilege1', 'privilege2'] }, \n { allOf:
['privilege3', 'privilege4'] }\n ] \n }\n ]\n }\n}\n```\n\n`allRequired`
now also supports scenarios `(privilege1 OR privilege2)\nAND (privilege3
OR privilege4)`\n```ts\nsecurity: {\n authz: {\n requiredPrivileges:
[{\n allRequired: [\n { anyOf: ['privilege1', 'privilege2'] }, \n {
anyOf: ['privilege3', 'privilege4'] }\n ] \n }\n ]\n }\n}\n```\n\n>
[!IMPORTANT]\n> We expect to have unique privileges in `anyOf` or
`allOf` conditions,\nassuming that most complex conditions can be
simplified by boolean\nalgebra laws (OR/AND distributive etc).\n\n\n###
Checklist\n\n-
[x]\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\nwas
added for features that require explanation or tutorials\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n__Closes:
https://github.com/elastic/kibana/issues/210977__\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"ed058086e27c2b6f5015647b446304608d6b14a9"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/217050","number":217050,"state":"OPEN"}]}]
BACKPORT-->

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-04-04 13:13:40 +02:00
..
assets Developer documentation for designing feature privileges (#166716) 2023-09-27 13:43:55 +02:00
contributing SKA: Update repository structure documentation (#208691) 2025-01-29 13:34:00 -06:00
getting_started SKA: Update broken references and URLs (#206836) 2025-01-28 03:32:48 +00:00
key_concepts [9.0] [Authz] Added allOf and anyOf nested conditions (#215516) (#217051) 2025-04-04 13:13:40 +02:00
lens [Lens] fit line charts by default (#196184) 2024-10-21 15:05:02 +02:00
operations [EuiProvider / Functional tests] Check for EuiProvider Dev Warning (#189018) 2024-08-26 15:08:32 -05:00
shared_ux [Screenshotting] Organize dev docs for screenshotting/chromium (#198100) 2024-10-30 11:55:12 -05:00
tutorials [9.0] [FIPS][Cloud][Build] Add FIPS cloud image. Convert base image to Wolfi. (#213163) (#216203) 2025-03-28 12:33:58 -05:00
api_welcome.mdx SKA: Update broken references and URLs (#206836) 2025-01-28 03:32:48 +00:00
kibana_server_core_components.mdx Clean up dev docs (#124271) 2022-02-03 10:09:10 -05:00
nav-kibana-dev.docnav.json Adding fips docs to nav (#206935) 2025-01-17 01:38:28 +01:00