Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fallback to using list auth if details auth fails, remove double…
… cache (#1274) ## Description This implements a fall back to using list authorization if the details authorization returns without access to the main resource. This might happen if - The XACML policy doesn't define a "read" rule - There are no GUI/API actions in the dialog referring to XACML actions the user is granted access to This ensures that dialogs that is visible in the list, also can be viewed in details view, even if the user has isn't authorized for any actions. He/she might still have access to transmissions using authorization attributes (depending on if the authorization attribute refers a subresource or external resource; either having "transmissionread" in the ServiceResource policy, or having "read" on the external resource policy) Also, this removes a redundant double caching of list authorization. This was a leftover after the non-scalable PDP-based authorization. ## Related Issue(s) - #1247 This adresses the principal problem raised in #1247, which is the discrepancy between perceived list and details authorization. We still need to consider if GetAltinnActions should be policy-based, as that will allow us to implement action-property validation in Create/Update commands. This will also let us include all authorized actions in dialog tokens in the `a` (actions) claim, not just the actions referred to in the dialog. ## Verification - [x] **Your** code builds clean without any errors or warnings - [x] Manual testing done (required) - [ ] Relevant automated test added (if you find this hard, leave it and we'll help out) ## Documentation - [ ] Documentation is updated (either in `docs`-directory, Altinnpedia or a separate linked PR in [altinn-studio-docs.](https://github.com/Altinn/altinn-studio-docs), if applicable) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new method to check list authorization for dialogs, enhancing user access control. - Added additional authorization checks for dialogs, allowing users with list access to retrieve dialogs even without main resource access. - **Bug Fixes** - Improved error handling and validation in dialog creation tests, ensuring robust and localized feedback. - **Chores** - Updated caching strategy for search authorization results to improve performance. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
- Loading branch information