-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Improve dashboard admin UI settings implementation #10869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -101,6 +101,8 @@ export class UiSettingsService | |
| // Use uiSettings.defaults from the config file | ||
| this.validateAndUpdateConfiguredDefaults(config.uiSettingsConfig.defaults); | ||
|
|
||
| this.register(getAIFeaturesSetting()); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious, does the order matter?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is just a minor improvement as for settings we should define what exists before we define how to control access to it |
||
|
|
||
| const permissionControlledUiSettingsWrapper = new PermissionControlledUiSettingsWrapper( | ||
| config.savedObjectsConfig.permission.enabled | ||
| ); | ||
|
|
@@ -111,8 +113,6 @@ export class UiSettingsService | |
| permissionControlledUiSettingsWrapper.wrapperFactory | ||
| ); | ||
|
|
||
| this.register(getAIFeaturesSetting()); | ||
|
|
||
| return { | ||
| register: this.register.bind(this), | ||
| }; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -201,8 +201,16 @@ export class AdvancedSettingsComponent extends Component< | |
| value: setting[1].userValue, | ||
| isCustom: config.isCustom(setting[0]), | ||
| isOverridden: config.isOverridden(setting[0]), | ||
| // Setting is permission controlled if: | ||
| // 1. It has DASHBOARD_ADMIN scope (string or array) AND | ||
| // 2. Current user is NOT a dashboard admin | ||
| // This prevents non-admin users from modifying admin-only settings | ||
| isPermissionControlled: | ||
| all[setting[0]].scope === UiSettingScope.DASHBOARD_ADMIN && !isDashboardAdmin, | ||
| ((typeof all[setting[0]].scope === 'string' && | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would be nice to add a comment to describe the logic, it's hard to read |
||
| all[setting[0]].scope === UiSettingScope.DASHBOARD_ADMIN) || | ||
| (Array.isArray(all[setting[0]].scope) && | ||
| (all[setting[0]].scope || []).includes(UiSettingScope.DASHBOARD_ADMIN))) && | ||
| !isDashboardAdmin, | ||
| userSettingsEnabled, | ||
| }); | ||
| }) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the order matter? If yes, would be nice to add a comment or unit test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to maintain the existing logic hierarchy that the admin-level configurations should has higher privilege level as initiatively admin setting > user settings > workspace settings > global settings.