@@ -59,24 +59,22 @@ export class DynamicConfigControlledUiSettingsWrapper {
5959 private async checkPermission (
6060 wrapperOptions : SavedObjectsClientWrapperOptions
6161 ) : Promise < boolean > {
62- // If saved object permission is disabled, everyone should be treated as admin here
63-
64- const dynamicConfigServiceStart = await this . dynamicConfig . getStartService ( ) ;
65- const store = dynamicConfigServiceStart . getAsyncLocalStore ( ) ;
66- const client = dynamicConfigServiceStart . getClient ( ) ;
62+ // If saved object permission is disabled, getWorkspaceState will return undefined,everyone should be treated as admin here
63+ if ( getWorkspaceState ( wrapperOptions . request ) . isDashboardAdmin !== false ) return true ;
6764
6865 try {
66+ const dynamicConfigServiceStart = await this . dynamicConfig . getStartService ( ) ;
67+ const store = dynamicConfigServiceStart . getAsyncLocalStore ( ) ;
68+ const client = dynamicConfigServiceStart . getClient ( ) ;
69+
6970 const dynamicConfig = await client . getConfig (
7071 { pluginConfigPath : 'uiSettings' } ,
7172 { asyncLocalStorageContext : store ! }
7273 ) ;
7374
74- // If saved object permission is disabled, getWorkspaceState will return undefined
75- const isDashboardAdmin = getWorkspaceState ( wrapperOptions . request ) . isDashboardAdmin !== false ;
76-
7775 // 1. when globalScopeEditable is false, only dashboard admin can edit global settings
7876 // 2. when globalScopeEditable is true(default), both dashboard admin and non-admin users can edit global settings
79- return isDashboardAdmin || dynamicConfig . globalScopeEditable . enabled ;
77+ return dynamicConfig . globalScopeEditable . enabled ;
8078 } catch ( e ) {
8179 throw new Error (
8280 i18n . translate ( 'core.dynamic.config.controlled.ui.settings.read.invalidate' , {
0 commit comments