feat: authorization dataset tiles - #2450
Conversation
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The
canViewBlocksemantics for undefined vs emptyauthorization(defaulting to#allbut treating[]as deny-all) are non-obvious; consider making this behavior explicit in the type/usage or using clearer sentinel values (e.g.['#none']) to reduce configuration mistakes. - Filtering
sortedDatasetViewin the component viadatasetView$on everyuserGroups$emission couples authorization logic tightly to the UI; consider moving this filtering into a selector or a dedicated service to keep the component lean and make the logic easier to reuse and test.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `canViewBlock` semantics for undefined vs empty `authorization` (defaulting to `#all` but treating `[]` as deny-all) are non-obvious; consider making this behavior explicit in the type/usage or using clearer sentinel values (e.g. `['#none']`) to reduce configuration mistakes.
- Filtering `sortedDatasetView` in the component via `datasetView$` on every `userGroups$` emission couples authorization logic tightly to the UI; consider moving this filtering into a selector or a dedicated service to keep the component lean and make the logic easier to reuse and test.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
a2e8a12 to
c91d271
Compare
Junjiequan
left a comment
There was a problem hiding this comment.
I left few comments, would to hear you back what you think
c91d271 to
3d03bee
Compare
…flag - Add showRestrictedTilesIndicator configuration flag to DatasetDetailComponentConfig - Display lock_outline icon on tile headers when section has restricted access - Icon only shown when flag is enabled and section.authorization is defined - Icon not shown for sections with authorization including '#all' - Add CSS styling for the restricted indicator - Update JSON schema for admin UI configuration Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
- Add 'Restricted Tiles Indicator' subsection to Overview - Document how the lock icon feature works - Add showRestrictedTilesIndicator to configuration keys table - Add to TypeScript interface documentation - Add to JSON Form Schema documentation - Add to Admin Interface Configuration - Add FAQ entry about showing lock icons - Update file references in Appendix B - Update last updated date Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
…faulting to #all - Use immutable approach with map() instead of forEach() - Add authorization field with default value ['#all'] for sections without it - Preserve all existing section properties with spread syntax - Create new arrays for fields sorting to avoid mutation Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
…tests - Extract baseCustomization array to avoid duplication - Create authTestConfigNoIndicator with showRestrictedTilesIndicator: false - Create authTestConfigWithIndicator with showRestrictedTilesIndicator: true - Update 'No restricted access indicator' section to use no-indicator config - Update 'Show restricted access indicator' section to use with-indicator config Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
…tests - Add assertion to verify lock icons do NOT appear when feature is disabled - Add assertions to verify lock icons appear on restricted tiles when enabled - Add assertions to verify lock icons do NOT appear on public tiles (with #all) - Tests cover admin, archiveManager, and guest user scenarios Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
…to detaset_tile_access
|
After a discussion with @Junjiequan , I will change the PR as follow:
This solution is backward compatible with current configurations. Regarding the lock icon, two entries in configuration will be added:
Documentation and jsonForms configuration will be updated accordingly |
…to detaset_tile_access
There was a problem hiding this comment.
Pull request overview
Adds group-based visibility filtering and restricted-access indicators to customized dataset-detail tiles.
Changes:
- Filters tiles using user access groups and per-tile authorization.
- Adds lock indicators, configuration, and shared header styling.
- Adds end-to-end coverage and feature documentation.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/styles.scss |
Registers the new header palette. |
src/assets/theme.json |
Defines header-5 colors. |
src/assets/config.json |
Adds indicator defaults. |
src/app/theme.ts |
Adds light-theme header colors. |
src/app/state-management/models/index.ts |
Extends tile configuration. |
src/app/datasets/dataset-detail/dataset-detail-dynamic/dataset-detail-dynamic.component.ts |
Implements authorization filtering. |
src/app/datasets/dataset-detail/dataset-detail-dynamic/dataset-detail-dynamic.component.scss |
Styles lock indicators. |
src/app/datasets/dataset-detail/dataset-detail-dynamic/dataset-detail-dynamic.component.html |
Renders filtered tiles and indicators. |
src/app/datasets/dataset-detail/dataset-detail-dynamic/_dataset-detail-dynamic-theme.scss |
Applies shared tile-header styling. |
src/app/app-config.service.ts |
Loads indicator configuration. |
src/app/app-config.service.spec.ts |
Updates configuration fixtures. |
src/app/admin/schema/frontend.config.jsonforms.json |
Adds tile authorization controls. |
docs/dataset-detail-block-authorization.md |
Documents the feature. |
cypress/support/commands.js |
Changes attachment fixture uploads. |
cypress/fixtures/testData.js |
Adds a test image. |
cypress/e2e/datasets/datasets-detail-dynamic.cy.js |
Updates dynamic-view tests. |
cypress/e2e/datasets/datasets-detail-dynamic-tile-authorization.cy.js |
Adds authorization scenarios. |
CI/e2e/frontend.config.e2e.json |
Configures authorization test tiles. |
Suppressed comments (3)
docs/dataset-detail-block-authorization.md:584
- This example omits
visible: false; an empty authorization array makes the block public, so the stated result is the opposite of the runtime behavior.
"authorization": [],
"source": "attachments"
docs/dataset-detail-block-authorization.md:628
- The implementation and new end-to-end tests allow unauthenticated users to see sections with empty or missing authorization, while this table and the note below say unauthenticated users see no blocks. Document unrestricted and restricted cases separately so deployed behavior is clear.
| Not authenticated | Any | No (requires authentication) |
docs/dataset-detail-block-authorization.md:108
- This documents global
datasetDetailComponent.authorization, but the PR implements authorization only onCustomizationItem:DatasetDetailComponentConfighas no such field, the admin schema has no global authorization property, andshowTilenever reads one. Remove the global-authorization sections and examples (or implement the feature) so administrators are not given nonfunctional configuration.
The authorization can be configured at **two levels**:
#### Level 1: Global Dataset Detail Component Authorization (NEW)
Added to `datasetDetailComponent` object itself:
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…t/frontend into detaset_tile_access
Description
Adds tile-level authorization to dataset detail page for fine-grained access control based on user group memberships.
Motivation
Enables administrators to control which user groups can view specific blocks/tiles in dataset details. Allows hiding s
ensitive metadata, creating group-specific views, and complying with data governance policies while maintaining backwa
rd compatibility.
Fixes:
authorizationfield in admin dashboard JSONForms schema from root level to individual customization itemsChanges:
authorization?: string[]toCustomizationIteminterfaceDatasetDetailDynamicComponentto filter tiles based on user access groups withcanViewBlock()methodheader-5color theme for consistent tile header stylingdatasetViewfrom static array to Observable reacting to user group changesTests included
Documentation
docs/dataset-detail-block-authorization.mdofficial documentation info
Documentation file:
docs/dataset-detail-block-authorization.md(812 lines, comprehensive)Backend version
AI contribution
Summary by Sourcery
Introduce tile-level authorization for dataset detail tiles based on user access groups and update styling to use a new shared tile header theme.
New Features:
Enhancements:
Documentation: