Skip to content

[Dashboards] Write-restricted dashboards UI#233552

Merged
SiddharthMantri merged 119 commits intoelastic:security/read-only-dashboardsfrom
kowalczyk-krzysztof:feat/read-only-dashboards-sharedux-ui
Nov 13, 2025
Merged

[Dashboards] Write-restricted dashboards UI#233552
SiddharthMantri merged 119 commits intoelastic:security/read-only-dashboardsfrom
kowalczyk-krzysztof:feat/read-only-dashboards-sharedux-ui

Conversation

@kowalczyk-krzysztof
Copy link
Copy Markdown
Member

@kowalczyk-krzysztof kowalczyk-krzysztof commented Aug 30, 2025

Summary

This PR adds the ability to set and change editing permission on dashboards. This action can be performed when creating a new dashboard or when changing an existing one.

Saved objects have a new optional property accessControl which has owner and accessMode properties. accessMode can either be default or write_restricted.
To enable this feature, a saved object needs to pass supportsAccessControl: true during registration.

Only admins and dashboard owner (the author, unless changed) are able to change access mode. Existing dashboards won't have accessControl until you change it.
For new dashboards accessControl is added during creation. owner is inferred from createdBy and accessMode depends on the option you select in save dashboard modal.

Dashboards existing prior to this feature being added will behave as if they are fully editable (accessMode: default).

Screenshot 2025-09-04 at 17 41 18

The only way in the UI to change accessMode is in the share modal.

Screenshot 2025-09-04 at 17 42 47

Closes: https://github.com/elastic/kibana-team/issues/1582

Testing

This PR has a dependency on another PR, which is not yet merged in. You need to pull in branch from this PR to test the changes locally.

Feature flag

The feature is behind a feature flag, disabled by default. To enable, add this to your config file:

savedObjects.enableAccessControl: true

@kowalczyk-krzysztof kowalczyk-krzysztof self-assigned this Aug 30, 2025
@kowalczyk-krzysztof kowalczyk-krzysztof added backport:skip This PR does not require backporting release_note:feature Makes this part of the condensed release notes Team:SharedUX Platform AppEx-SharedUX (formerly Global Experience) t// labels Aug 30, 2025
@kowalczyk-krzysztof kowalczyk-krzysztof force-pushed the feat/read-only-dashboards-sharedux-ui branch 8 times, most recently from b2e358b to efc24fe Compare August 31, 2025 23:27
@kowalczyk-krzysztof kowalczyk-krzysztof changed the title [Dashboards] Read Only dashboards UI [Dashboards] Write-restricted dashboards UI Aug 31, 2025
@kowalczyk-krzysztof kowalczyk-krzysztof force-pushed the feat/read-only-dashboards-sharedux-ui branch 11 times, most recently from 5db9bfb to 9a836d1 Compare September 2, 2025 23:04
@kowalczyk-krzysztof kowalczyk-krzysztof force-pushed the feat/read-only-dashboards-sharedux-ui branch from 9a836d1 to 13b3038 Compare September 3, 2025 09:08
@kowalczyk-krzysztof kowalczyk-krzysztof force-pushed the feat/read-only-dashboards-sharedux-ui branch 2 times, most recently from 8f9b88e to dcc3d83 Compare September 3, 2025 09:33
Copy link
Copy Markdown
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the changes in a017792 are needed. In src/platform/plugins/shared/dashboard/server/api/create/create.ts, you can just call core.savedObjects.isAccessControlEnabled() directly.

@kowalczyk-krzysztof
Copy link
Copy Markdown
Member Author

kowalczyk-krzysztof commented Nov 11, 2025

I don't think the changes in a017792 are needed. In src/platform/plugins/shared/dashboard/server/api/create/create.ts, you can just call core.savedObjects.isAccessControlEnabled() directly.

Unfortunately not. The method doesn't exist on CoreRequestHandlerContext['savedObjects']. It exists only on CoreSetup['savedObjects'] so I have to pass it down as an argument.

Flag implementation details PR: #235659

@nreese
Copy link
Copy Markdown
Contributor

nreese commented Nov 11, 2025

Unfortunately not. The method doesn't exist on CoreRequestHandlerContext['savedObjects']. It exists only on CoreSetup['savedObjects'] so I have to pass it down as an argument.

Could isAccessControlEnabled be added to CoreRequestHandlerContext['savedObjects']? That seems like a cleaner solution then prop drilling.

@kowalczyk-krzysztof
Copy link
Copy Markdown
Member Author

Could isAccessControlEnabled be added to CoreRequestHandlerContext['savedObjects']? That seems like a cleaner solution then prop drilling.

@jeramysoucy @SiddharthMantri Could you answer this? Would it be possible to implement this?

@SiddharthMantri
Copy link
Copy Markdown
Contributor

SiddharthMantri commented Nov 12, 2025

CoreRequestHandlerContext['savedObjects']?

Although not directly available on the savedObjects request context, you should be able to call it via the type registry (which is available) as follows:

cost coreContext = await context.core;
const isAccessControlEnabled = coreContext.savedObjects.typeRegistry.isAccessControlEnabled();

Does that work for this use case?

@kowalczyk-krzysztof
Copy link
Copy Markdown
Member Author

CoreRequestHandlerContext['savedObjects']?

Although not directly available on the savedObjects request context, you should be able to call it via the type registry (which is available) as follows:

cost coreContext = await context.core;
const isAccessControlEnabled = coreContext.savedObjects.typeRegistry.isAccessControlEnabled();

Does that work for this use case?

Yes this works here. Thanks.

@nreese I updated the implementation.

@kowalczyk-krzysztof kowalczyk-krzysztof changed the base branch from main to security/read-only-dashboards November 13, 2025 19:54
@kowalczyk-krzysztof kowalczyk-krzysztof marked this pull request as ready for review November 13, 2025 19:55
@SiddharthMantri SiddharthMantri merged commit 64b6801 into elastic:security/read-only-dashboards Nov 13, 2025
11 of 12 checks passed
@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Nov 13, 2025

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] Serverless AI4DSOC - Security Solution Cypress Tests / AI4dSoC Navigation renders pages within links correctly should show the correct page for visible links when navigating should show the correct page for visible links when navigating

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
dashboard 776 784 +8

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/content-management-access-control-public - 42 +42
@kbn/content-management-access-control-server - 6 +6
navigation 58 59 +1
total +49

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
dashboard 663.3KB 674.5KB +11.2KB
eventAnnotationListing 205.9KB 205.5KB -452.0B
filesManagement 103.0KB 102.6KB -452.0B
graph 372.5KB 372.0KB -452.0B
maps 3.1MB 3.1MB -452.0B
visualizations 343.2KB 342.8KB -452.0B
total +9.0KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
dashboard 10 11 +1

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
navigation 11.5KB 11.5KB +36.0B
share 53.8KB 54.1KB +248.0B
total +284.0B
Unknown metric groups

API count

id before after diff
@kbn/content-management-access-control-public - 42 +42
@kbn/content-management-access-control-server - 6 +6
navigation 61 62 +1
total +49

History

cc @kowalczyk-krzysztof

@kowalczyk-krzysztof kowalczyk-krzysztof deleted the feat/read-only-dashboards-sharedux-ui branch November 14, 2025 13:09
@kowalczyk-krzysztof kowalczyk-krzysztof restored the feat/read-only-dashboards-sharedux-ui branch November 27, 2025 13:01
@kowalczyk-krzysztof kowalczyk-krzysztof deleted the feat/read-only-dashboards-sharedux-ui branch December 10, 2025 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:SharedUX Platform AppEx-SharedUX (formerly Global Experience) t//

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants