Skip to content

Commit

Permalink
Cb 4382 anonymous access restricted error (#2302)
Browse files Browse the repository at this point in the history
* CB-4382 fixed anonymous error

* CB-4382 move EAdminPermission to root-resources in order to FeatureResource can import it

* CB-4282 EAdminPermission moved to core-root

* CB-4382 update-ts-references

* СB-4382 removed unneeded deps in packages

* CB-4282 revert needed deps to be present

* CB-4382 reverted popperjs for plugin-data-spreadsheet-new

* CB-4382 TE error fix for fast opening admin server settings

* CB-4382 update yarn lock

---------

Co-authored-by: s.teleshev <[email protected]>
Co-authored-by: Alexey <[email protected]>
Co-authored-by: kseniaguzeeva <[email protected]>
  • Loading branch information
4 people authored Jan 25, 2024
1 parent ba3ca5e commit f41c485
Show file tree
Hide file tree
Showing 58 changed files with 96 additions and 137 deletions.
8 changes: 8 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@
"close": true,
"clear": false
}
},
{
"label": "Update TS references CE",
"type": "shell",
"command": "yarn lerna run update-ts-references --stream",
"options": {
"cwd": "${workspaceFolder}/webapp"
}
}
],
"inputs": [
Expand Down
4 changes: 1 addition & 3 deletions webapp/packages/core-administration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"update-ts-references": "rimraf --glob dist && typescript-resolve-references"
},
"dependencies": {
"@cloudbeaver/core-authentication": "~0.1.0",
"@cloudbeaver/core-data-context": "~0.1.0",
"@cloudbeaver/core-di": "~0.1.0",
"@cloudbeaver/core-events": "~0.1.0",
Expand All @@ -32,8 +31,7 @@
"@cloudbeaver/core-settings": "~0.1.0",
"@cloudbeaver/core-theming": "~0.1.0",
"@cloudbeaver/core-utils": "~0.1.0",
"mobx": "^6.12.0",
"reshadow": "^0.0.1"
"mobx": "^6.12.0"
},
"peerDependencies": {},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
*/
import { computed, makeObservable, observable } from 'mobx';

import { EAdminPermission } from '@cloudbeaver/core-authentication';
import { injectable } from '@cloudbeaver/core-di';
import { NotificationService } from '@cloudbeaver/core-events';
import { Executor, IExecutor } from '@cloudbeaver/core-executor';
import { PermissionsService, ServerConfigResource, SessionPermissionsResource } from '@cloudbeaver/core-root';
import { EAdminPermission, PermissionsService, ServerConfigResource, SessionPermissionsResource } from '@cloudbeaver/core-root';
import { RouterState, ScreenService } from '@cloudbeaver/core-routing';
import { LocalStorageSaveService } from '@cloudbeaver/core-settings';
import { GlobalConstants } from '@cloudbeaver/core-utils';
Expand Down
3 changes: 0 additions & 3 deletions webapp/packages/core-administration/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
"tsBuildInfoFile": "dist/tsconfig.tsbuildinfo"
},
"references": [
{
"path": "../core-authentication/tsconfig.json"
},
{
"path": "../core-data-context/tsconfig.json"
},
Expand Down
3 changes: 2 additions & 1 deletion webapp/packages/core-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"@cloudbeaver/core-ui": "~0.1.0",
"@cloudbeaver/core-version": "~0.1.0",
"mobx-react-lite": "^4.0.5",
"react": "^18.2.0"
"react": "^18.2.0",
"@cloudbeaver/core-utils": "~0.1.0"
},
"peerDependencies": {},
"devDependencies": {
Expand Down
3 changes: 3 additions & 0 deletions webapp/packages/core-app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
},
{
"path": "../core-version/tsconfig.json"
},
{
"path": "../core-utils/tsconfig.json"
}
],
"include": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@
*/
import { injectable } from '@cloudbeaver/core-di';
import { CachedMapResource, isResourceAlias, type ResourceKey, ResourceKeyUtils } from '@cloudbeaver/core-resource';
import { SessionDataResource, SessionPermissionsResource } from '@cloudbeaver/core-root';
import { EAdminPermission, SessionDataResource, SessionPermissionsResource } from '@cloudbeaver/core-root';
import {
AuthProviderConfigurationParametersFragment,
GetAuthProviderConfigurationParametersQueryVariables,
GraphQLService,
} from '@cloudbeaver/core-sdk';

import { EAdminPermission } from './EAdminPermission';

@injectable()
export class AuthConfigurationParametersResource extends CachedMapResource<
string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ import {
type ResourceKeySimple,
ResourceKeyUtils,
} from '@cloudbeaver/core-resource';
import { SessionPermissionsResource } from '@cloudbeaver/core-root';
import { EAdminPermission, SessionPermissionsResource } from '@cloudbeaver/core-root';
import { AdminAuthProviderConfiguration, GetAuthProviderConfigurationsQueryVariables, GraphQLService } from '@cloudbeaver/core-sdk';

import type { AuthProviderConfiguration } from './AuthProvidersResource';
import { EAdminPermission } from './EAdminPermission';

const NEW_CONFIGURATION_SYMBOL = Symbol('new-configuration');

Expand Down
4 changes: 1 addition & 3 deletions webapp/packages/core-authentication/src/AuthRolesResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
*/
import { injectable } from '@cloudbeaver/core-di';
import { CachedDataResource } from '@cloudbeaver/core-resource';
import { SessionPermissionsResource } from '@cloudbeaver/core-root';
import { EAdminPermission, SessionPermissionsResource } from '@cloudbeaver/core-root';
import { GraphQLService } from '@cloudbeaver/core-sdk';

import { EAdminPermission } from './EAdminPermission';

@injectable()
export class AuthRolesResource extends CachedDataResource<string[]> {
constructor(private readonly graphQLService: GraphQLService, sessionPermissionsResource: SessionPermissionsResource) {
Expand Down
3 changes: 1 addition & 2 deletions webapp/packages/core-authentication/src/UsersResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ import {
type ResourceKeySimple,
ResourceKeyUtils,
} from '@cloudbeaver/core-resource';
import { ServerConfigResource, SessionPermissionsResource } from '@cloudbeaver/core-root';
import { EAdminPermission, ServerConfigResource, SessionPermissionsResource } from '@cloudbeaver/core-root';
import { AdminConnectionGrantInfo, AdminUserInfo, AdminUserInfoFragment, GetUsersListQueryVariables, GraphQLService } from '@cloudbeaver/core-sdk';

import { AUTH_PROVIDER_LOCAL_ID } from './AUTH_PROVIDER_LOCAL_ID';
import { AuthInfoService } from './AuthInfoService';
import { AuthProviderService } from './AuthProviderService';
import { EAdminPermission } from './EAdminPermission';
import type { IAuthCredentials } from './IAuthCredentials';

const NEW_USER_SYMBOL = Symbol('new-user');
Expand Down
1 change: 0 additions & 1 deletion webapp/packages/core-authentication/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ export * from './UserInfoResource';
export * from './UserMetaParametersResource';
export * from './UsersResource';
export * from './TeamMetaParametersResource';
export * from './EAdminPermission';
export * from './AUTH_SETTINGS_GROUP';
export * from './PasswordPolicyService';
2 changes: 1 addition & 1 deletion webapp/packages/core-blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"mobx": "^6.12.0",
"mobx-react-lite": "^4.0.5",
"react": "^18.2.0",
"reakit": "~1.x.x",
"reakit": "~1.3.11",
"reakit-utils": "^0.15.2",
"reshadow": "^0.0.1"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,6 @@ export function useResource<
return true;
}

if (this.isError()) {
return true;
}

return this.resource.isLoaded(propertiesRef.key, propertiesRef.includes);
},
get loading(): boolean {
Expand Down Expand Up @@ -461,7 +457,7 @@ export function useResource<

useEffect(() => {
refObj.use(loadKey);
if (canLoad && !result.isError()) {
if (canLoad) {
result.load();
}
}, [canLoad, loadKey]);
Expand Down
3 changes: 1 addition & 2 deletions webapp/packages/core-blocks/src/useAdministrationSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
* Licensed under the Apache License, Version 2.0.
* you may not use this file except in compliance with the License.
*/
import { EAdminPermission } from '@cloudbeaver/core-authentication';
import { ServerConfigResource } from '@cloudbeaver/core-root';
import { EAdminPermission, ServerConfigResource } from '@cloudbeaver/core-root';

import { useResource } from './ResourcesHooks/useResource';
import { usePermission } from './usePermission';
Expand Down
6 changes: 3 additions & 3 deletions webapp/packages/core-bootstrap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@
"@cloudbeaver/core-view": "~0.1.0",
"mobx": "^6.12.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"reshadow": "^0.0.1"
"react-dom": "^18.2.0"
},
"peerDependencies": {},
"devDependencies": {
"@types/react": "^18.2.42",
"typescript": "^5.3.2"
"typescript": "^5.3.2",
"typescript-plugin-css-modules": "^5.0.2"
}
}
8 changes: 3 additions & 5 deletions webapp/packages/core-notifications/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,15 @@
"dependencies": {
"@cloudbeaver/core-blocks": "~0.1.0",
"@cloudbeaver/core-di": "~0.1.0",
"@cloudbeaver/core-dialogs": "~0.1.0",
"@cloudbeaver/core-events": "~0.1.0",
"mobx": "^6.12.0",
"mobx-react-lite": "^4.0.5",
"react": "^18.2.0",
"reakit": "~1.x.x",
"reshadow": "^0.0.1"
"reakit": "~1.3.11"
},
"peerDependencies": {},
"devDependencies": {
"@types/react": "^18.2.42",
"typescript": "^5.3.2"
"typescript": "^5.3.2",
"typescript-plugin-css-modules": "^5.0.2"
}
}
3 changes: 0 additions & 3 deletions webapp/packages/core-notifications/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
{
"path": "../core-di/tsconfig.json"
},
{
"path": "../core-dialogs/tsconfig.json"
},
{
"path": "../core-events/tsconfig.json"
}
Expand Down
1 change: 0 additions & 1 deletion webapp/packages/core-resource-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
},
"dependencies": {
"@cloudbeaver/core-administration": "~0.1.0",
"@cloudbeaver/core-authentication": "~0.1.0",
"@cloudbeaver/core-di": "~0.1.0",
"@cloudbeaver/core-executor": "~0.1.0",
"@cloudbeaver/core-navigation-tree": "~0.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,15 @@
import type { PermissionInfo } from '@cloudbeaver/core-administration';
import { injectable } from '@cloudbeaver/core-di';
import { CachedDataResource } from '@cloudbeaver/core-resource';
import { ServerConfigResource } from '@cloudbeaver/core-root';
import { EAdminPermission, SessionPermissionsResource } from '@cloudbeaver/core-root';
import { GraphQLService } from '@cloudbeaver/core-sdk';

@injectable()
export class ProjectPermissionsResource extends CachedDataResource<PermissionInfo[]> {
constructor(private readonly graphQLService: GraphQLService, serverConfigResource: ServerConfigResource) {
constructor(private readonly graphQLService: GraphQLService, permissionsResource: SessionPermissionsResource) {
super(() => []);

this.sync(
serverConfigResource,
() => {},
() => {},
);
permissionsResource.require(this, EAdminPermission.admin).outdateResource(this);
}

protected async loader(): Promise<PermissionInfo[]> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import { runInAction } from 'mobx';

import type { AdminObjectGrantInfo } from '@cloudbeaver/core-administration';
import { EAdminPermission } from '@cloudbeaver/core-authentication';
import { injectable } from '@cloudbeaver/core-di';
import { ProjectInfoResource } from '@cloudbeaver/core-projects';
import {
Expand All @@ -19,7 +18,7 @@ import {
resourceKeyList,
ResourceKeyUtils,
} from '@cloudbeaver/core-resource';
import { SessionPermissionsResource } from '@cloudbeaver/core-root';
import { EAdminPermission, SessionPermissionsResource } from '@cloudbeaver/core-root';
import { GraphQLService, RmProject, RmProjectPermissions, RmSubjectProjectPermissions } from '@cloudbeaver/core-sdk';
import { isArraysEqual } from '@cloudbeaver/core-utils';

Expand Down
3 changes: 0 additions & 3 deletions webapp/packages/core-resource-manager/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
{
"path": "../core-administration/tsconfig.json"
},
{
"path": "../core-authentication/tsconfig.json"
},
{
"path": "../core-di/tsconfig.json"
},
Expand Down
11 changes: 4 additions & 7 deletions webapp/packages/core-root/src/FeaturesResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,17 @@ import { injectable } from '@cloudbeaver/core-di';
import { CachedDataResource } from '@cloudbeaver/core-resource';
import { GraphQLService, WebFeatureSet } from '@cloudbeaver/core-sdk';

import { ServerConfigResource } from './ServerConfigResource';
import { EAdminPermission } from './EAdminPermission';
import { SessionPermissionsResource } from './SessionPermissionsResource';

export type ApplicationFeature = WebFeatureSet;

@injectable()
export class FeaturesResource extends CachedDataResource<ApplicationFeature[]> {
constructor(private readonly graphQLService: GraphQLService, serverConfigResource: ServerConfigResource) {
constructor(private readonly graphQLService: GraphQLService, permissionsResource: SessionPermissionsResource) {
super(() => []);

this.sync(
serverConfigResource,
() => {},
() => {},
);
permissionsResource.require(this, EAdminPermission.admin).outdateResource(this);
}

protected async loader(): Promise<ApplicationFeature[]> {
Expand Down
1 change: 1 addition & 0 deletions webapp/packages/core-root/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export * from './SessionResource';
export * from './ServerService';
export * from './ServerSettingsService';
export * from './SessionActionService';
export * from './EAdminPermission';
export * from './SessionDataResource';
export * from './SessionSettingsService';
export * from './SessionExpireService';
Expand Down
2 changes: 1 addition & 1 deletion webapp/packages/core-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"react": "^18.2.0",
"react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1",
"reakit": "~1.x.x",
"reakit": "~1.3.11",
"reshadow": "^0.0.1"
},
"peerDependencies": {},
Expand Down
6 changes: 3 additions & 3 deletions webapp/packages/core-view/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
"mobx": "^6.12.0",
"mobx-react-lite": "^4.0.5",
"react": "^18.2.0",
"react-hotkeys-hook": "^4.4.1",
"reshadow": "^0.0.1"
"react-hotkeys-hook": "^4.4.1"
},
"peerDependencies": {},
"devDependencies": {
"@types/react": "^18.2.42",
"typescript": "^5.3.2"
"typescript": "^5.3.2",
"typescript-plugin-css-modules": "^5.0.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { observer } from 'mobx-react-lite';
import { useCallback } from 'react';

import { AdministrationScreenService } from '@cloudbeaver/core-administration';
import { EAdminPermission } from '@cloudbeaver/core-authentication';
import { usePermission } from '@cloudbeaver/core-blocks';
import { useService } from '@cloudbeaver/core-di';
import { EAdminPermission } from '@cloudbeaver/core-root';
import type { ScreenComponent } from '@cloudbeaver/core-routing';

import { Administration } from '../Administration/Administration';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import { observer } from 'mobx-react-lite';
import { useCallback } from 'react';

import { AdministrationItemService, AdministrationScreenService } from '@cloudbeaver/core-administration';
import { EAdminPermission } from '@cloudbeaver/core-authentication';
import { Translate, usePermission, useResource } from '@cloudbeaver/core-blocks';
import { useService } from '@cloudbeaver/core-di';
import { SessionPermissionsResource } from '@cloudbeaver/core-root';
import { EAdminPermission, SessionPermissionsResource } from '@cloudbeaver/core-root';

import { Administration } from '../../Administration/Administration';
import { WizardStepper } from './WizardStepper';
Expand Down
3 changes: 1 addition & 2 deletions webapp/packages/plugin-administration/src/PluginBootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
import { lazy } from 'react';

import { AdministrationScreenService } from '@cloudbeaver/core-administration';
import { EAdminPermission } from '@cloudbeaver/core-authentication';
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
import { PermissionsService } from '@cloudbeaver/core-root';
import { PermissionsService, EAdminPermission } from '@cloudbeaver/core-root';
import { ScreenService } from '@cloudbeaver/core-routing';
import { DATA_CONTEXT_MENU, MenuBaseItem, MenuService } from '@cloudbeaver/core-view';
import { TOP_NAV_BAR_SETTINGS_MENU } from '@cloudbeaver/plugin-settings-menu';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"mobx": "^6.12.0",
"mobx-react-lite": "^4.0.5",
"react": "^18.2.0",
"reshadow": "^0.0.1"
"reshadow": "^0.0.1",
"reakit": "~1.3.11"
},
"peerDependencies": {},
"devDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions webapp/packages/plugin-codemirror6/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
"@lezer/highlight": "^1.2.0",
"mobx-react-lite": "^4.0.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"reshadow": "^0.0.1"
"react-dom": "^18.2.0"
},
"peerDependencies": {},
"devDependencies": {
Expand Down
Loading

0 comments on commit f41c485

Please sign in to comment.