diff --git a/webapp/packages/core-authentication/src/AppAuthService.ts b/webapp/packages/core-authentication/src/AppAuthService.ts index 7090a62385..0e653faf10 100644 --- a/webapp/packages/core-authentication/src/AppAuthService.ts +++ b/webapp/packages/core-authentication/src/AppAuthService.ts @@ -16,7 +16,7 @@ import { UserInfoResource } from './UserInfoResource.js'; @injectable() export class AppAuthService extends Bootstrap { get authenticated(): boolean { - return this.serverConfigResource.configurationMode || this.userInfoResource.hasAccess; + return this.serverConfigResource.configurationMode || this.userInfoResource.hasAccess(); } get loaders(): ILoadableState[] { @@ -56,7 +56,7 @@ export class AppAuthService extends Bootstrap { await this.userInfoResource.load(); - return !this.serverConfigResource.configurationMode && !this.userInfoResource.hasAccess; + return !this.serverConfigResource.configurationMode && !this.userInfoResource.hasAccess(); } async authUser(): Promise { diff --git a/webapp/packages/core-authentication/src/UserInfoResource.ts b/webapp/packages/core-authentication/src/UserInfoResource.ts index 803037cc6e..0537b2569b 100644 --- a/webapp/packages/core-authentication/src/UserInfoResource.ts +++ b/webapp/packages/core-authentication/src/UserInfoResource.ts @@ -55,18 +55,6 @@ export class UserInfoResource extends CachedDataResource { @@ -94,13 +94,13 @@ export class UserSettingsService extends SettingsSource { private refreshConfig() { this.update(() => { - if (!this.userInfoResource.isAuthenticated) { + if (!this.userInfoResource.isAuthenticated()) { this.clear(); this.lastConfig = null; return; } - if (this.userInfoResource.isData() && this.userInfoResource.data.configurationParameters !== this.lastConfig) { + if (this.userInfoResource.data.configurationParameters !== this.lastConfig) { this.clear(); this.localSettings.clear(); this.lastConfig = this.userInfoResource.data.configurationParameters; @@ -121,7 +121,7 @@ export class UserSettingsService extends SettingsSource { } private getSource() { - if (this.userInfoResource.isAuthenticated) { + if (this.userInfoResource.isAuthenticated()) { return this.settings; } diff --git a/webapp/packages/plugin-authentication/src/AuthenticationService.ts b/webapp/packages/plugin-authentication/src/AuthenticationService.ts index f353e15950..1c9e723787 100644 --- a/webapp/packages/plugin-authentication/src/AuthenticationService.ts +++ b/webapp/packages/plugin-authentication/src/AuthenticationService.ts @@ -67,7 +67,7 @@ export class AuthenticationService extends Bootstrap { this.onLogin = new Executor(); this.onLogout.before(this.navigationService.navigationTask); - this.onLogin.before(this.navigationService.navigationTask, undefined, () => userInfoResource.isAnonymous); + this.onLogin.before(this.navigationService.navigationTask, undefined, () => userInfoResource.isAnonymous()); this.authPromise = null; this.configureAuthProvider = null; diff --git a/webapp/packages/plugin-authentication/src/PluginBootstrap.ts b/webapp/packages/plugin-authentication/src/PluginBootstrap.ts index 11c8786960..e80443375d 100644 --- a/webapp/packages/plugin-authentication/src/PluginBootstrap.ts +++ b/webapp/packages/plugin-authentication/src/PluginBootstrap.ts @@ -28,7 +28,7 @@ export class PluginBootstrap extends Bootstrap { this.menuService.addCreator({ menus: [TOP_NAV_BAR_SETTINGS_MENU], getItems: (context, items) => { - if (this.serverConfigResource.enabledAuthProviders.length > 0 && this.userInfoResource.isAnonymous) { + if (this.serverConfigResource.enabledAuthProviders.length > 0 && this.userInfoResource.isAnonymous()) { return [ ...items, new MenuBaseItem( @@ -42,7 +42,7 @@ export class PluginBootstrap extends Bootstrap { ]; } - if (this.userInfoResource.isAuthenticated) { + if (this.userInfoResource.isAuthenticated()) { return [ ...items, new MenuBaseItem( diff --git a/webapp/packages/plugin-connections/src/ConnectionAuthService.ts b/webapp/packages/plugin-connections/src/ConnectionAuthService.ts index bfff83dc95..71b7f51887 100644 --- a/webapp/packages/plugin-connections/src/ConnectionAuthService.ts +++ b/webapp/packages/plugin-connections/src/ConnectionAuthService.ts @@ -41,7 +41,7 @@ export class ConnectionAuthService extends Dependency { connections: connectionInfoResource.values.filter(connection => connection.connected).map(createConnectionParam), state, }), - state => state === 'before' && userInfoResource.isAnonymous, + state => state === 'before' && userInfoResource.isAnonymous(), ); this.authenticationService.onLogout.before( connectionsManagerService.onDisconnect, diff --git a/webapp/packages/plugin-connections/src/NavNodes/ConnectionFoldersBootstrap.ts b/webapp/packages/plugin-connections/src/NavNodes/ConnectionFoldersBootstrap.ts index f87351ef73..ce69635c20 100644 --- a/webapp/packages/plugin-connections/src/NavNodes/ConnectionFoldersBootstrap.ts +++ b/webapp/packages/plugin-connections/src/NavNodes/ConnectionFoldersBootstrap.ts @@ -126,7 +126,7 @@ export class ConnectionFoldersBootstrap extends Bootstrap { isActionApplicable: (context, action) => { const tree = context.get(DATA_CONTEXT_ELEMENTS_TREE)!; - if (action !== ACTION_NEW_FOLDER || !this.userInfoResource.isAuthenticated || tree.baseRoot !== ROOT_NODE_PATH) { + if (action !== ACTION_NEW_FOLDER || !this.userInfoResource.isAuthenticated() || tree.baseRoot !== ROOT_NODE_PATH) { return false; } diff --git a/webapp/packages/plugin-connections/src/PublicConnectionForm/PublicConnectionFormService.ts b/webapp/packages/plugin-connections/src/PublicConnectionForm/PublicConnectionFormService.ts index ca6492ef29..98424a2a4c 100644 --- a/webapp/packages/plugin-connections/src/PublicConnectionForm/PublicConnectionFormService.ts +++ b/webapp/packages/plugin-connections/src/PublicConnectionForm/PublicConnectionFormService.ts @@ -60,8 +60,9 @@ export class PublicConnectionFormService { executorHandlerFilter( () => !!this.formState && this.optionsPanelService.isOpen(formGetter), async (event, context) => { - if (event === 'before' && !this.userInfoResource.isData()) { + if (event === 'before' && this.userInfoResource.isAnonymous()) { const confirmed = await this.showUnsavedChangesDialog(); + if (!confirmed) { ExecutorInterrupter.interrupt(context); } diff --git a/webapp/packages/plugin-navigation-tree-rm/src/NavNodes/ResourceFoldersBootstrap.ts b/webapp/packages/plugin-navigation-tree-rm/src/NavNodes/ResourceFoldersBootstrap.ts index 3fb8572474..0a5d22b181 100644 --- a/webapp/packages/plugin-navigation-tree-rm/src/NavNodes/ResourceFoldersBootstrap.ts +++ b/webapp/packages/plugin-navigation-tree-rm/src/NavNodes/ResourceFoldersBootstrap.ts @@ -89,7 +89,7 @@ export class ResourceFoldersBootstrap extends Bootstrap { isActionApplicable: context => { const tree = context.get(DATA_CONTEXT_ELEMENTS_TREE); - if (!tree?.baseRoot.startsWith(RESOURCES_NODE_PATH) || !this.userInfoResource.isAuthenticated) { + if (!tree?.baseRoot.startsWith(RESOURCES_NODE_PATH) || !this.userInfoResource.isAuthenticated()) { return false; } diff --git a/webapp/packages/plugin-resource-manager/src/ResourceManagerService.ts b/webapp/packages/plugin-resource-manager/src/ResourceManagerService.ts index 22af72f735..b29ebf0e82 100644 --- a/webapp/packages/plugin-resource-manager/src/ResourceManagerService.ts +++ b/webapp/packages/plugin-resource-manager/src/ResourceManagerService.ts @@ -15,7 +15,7 @@ import { ServerConfigResource } from '@cloudbeaver/core-root'; @injectable() export class ResourceManagerService { get enabled() { - return !!this.serverConfigResource.data?.resourceManagerEnabled && this.userInfoResource.isAuthenticated; + return !!this.serverConfigResource.data?.resourceManagerEnabled && this.userInfoResource.isAuthenticated(); } constructor( diff --git a/webapp/packages/plugin-session-expiration/src/SessionExpireWarningDialog/SessionExpireWarningDialogBootstrap.ts b/webapp/packages/plugin-session-expiration/src/SessionExpireWarningDialog/SessionExpireWarningDialogBootstrap.ts index db49c48472..72f8605814 100644 --- a/webapp/packages/plugin-session-expiration/src/SessionExpireWarningDialog/SessionExpireWarningDialogBootstrap.ts +++ b/webapp/packages/plugin-session-expiration/src/SessionExpireWarningDialog/SessionExpireWarningDialogBootstrap.ts @@ -38,7 +38,7 @@ export class SessionExpireWarningDialogBootstrap extends Bootstrap { } private handleSessionResourceDataUpdate(isValid?: boolean, remainingTime?: number) { - if (!this.serverConfigResource.configurationMode && !this.userInfoResource.hasAccess) { + if (!this.serverConfigResource.configurationMode && !this.userInfoResource.hasAccess()) { return; } diff --git a/webapp/packages/plugin-user-profile/src/UserMenu/UserMenu.tsx b/webapp/packages/plugin-user-profile/src/UserMenu/UserMenu.tsx index d5dc2d0bcb..2d8f9a05ee 100644 --- a/webapp/packages/plugin-user-profile/src/UserMenu/UserMenu.tsx +++ b/webapp/packages/plugin-user-profile/src/UserMenu/UserMenu.tsx @@ -27,7 +27,7 @@ export const UserMenu = observer(function UserMenu() { context.set(DATA_CONTEXT_USER, userInfoResource.data, id); }); - if (!userInfoResource.isData() || !userInfoResource.isAuthenticated) { + if (!userInfoResource.isAuthenticated()) { return null; } diff --git a/webapp/packages/plugin-user-profile/src/UserProfileForm/UserProfileFormBootstrap.ts b/webapp/packages/plugin-user-profile/src/UserProfileForm/UserProfileFormBootstrap.ts index 1ce0941239..260ebe8831 100644 --- a/webapp/packages/plugin-user-profile/src/UserProfileForm/UserProfileFormBootstrap.ts +++ b/webapp/packages/plugin-user-profile/src/UserProfileForm/UserProfileFormBootstrap.ts @@ -27,7 +27,7 @@ export class UserProfileFormBootstrap extends Bootstrap { key: 'account', name: 'plugin_user_profile_account_title', order: 1, - isHidden: () => this.userInfoResource.isAnonymous, + isHidden: () => this.userInfoResource.isAnonymous(), panel: () => UserProfileFormPanel, }); } diff --git a/webapp/packages/plugin-user-profile/src/UserProfileOptionsPanelService.ts b/webapp/packages/plugin-user-profile/src/UserProfileOptionsPanelService.ts index 0e0f820161..5a6c0ff62a 100644 --- a/webapp/packages/plugin-user-profile/src/UserProfileOptionsPanelService.ts +++ b/webapp/packages/plugin-user-profile/src/UserProfileOptionsPanelService.ts @@ -82,7 +82,7 @@ export class UserProfileOptionsPanelService { return; } - if (!this.userInfoResource.isData()) { + if (!this.userInfoResource.hasAccess()) { this.close(true); } }