diff --git a/webapp/packages/core-authentication/.gitignore b/webapp/packages/core-authentication/.gitignore new file mode 100644 index 0000000000..99902db863 --- /dev/null +++ b/webapp/packages/core-authentication/.gitignore @@ -0,0 +1,21 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/lib + +# misc +.DS_Store +.env* + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/webapp/packages/core-authentication/package.json b/webapp/packages/core-authentication/package.json new file mode 100644 index 0000000000..8c5350318e --- /dev/null +++ b/webapp/packages/core-authentication/package.json @@ -0,0 +1,24 @@ +{ + "name": "@cloudbeaver/core-authentication", + "sideEffects": false, + "version": "0.1.0", + "description": "", + "license": "Apache-2.0", + "main": "lib/index.js", + "module": "lib/index.js", + "scripts": { + "prebuild": "rimraf lib/*", + "build": "webpack --config ../../configs/webpack.plugin.config", + "postbuild": "tsc", + "lint": "eslint ./src/ --ext .ts,.tsx", + "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix" + }, + "peerDependencies": { + "@cloudbeaver/core-di": "^0.1.0", + "@cloudbeaver/core-events": "^0.1.0", + "@cloudbeaver/core-root": "^0.1.0", + "@cloudbeaver/core-sdk": "^0.1.0", + "@cloudbeaver/core-utils": "^0.1.0", + "mobx": "^5.x.x" + } +} \ No newline at end of file diff --git a/webapp/packages/plugin-authentication/src/AuthInfoService.ts b/webapp/packages/core-authentication/src/AuthInfoService.ts similarity index 100% rename from webapp/packages/plugin-authentication/src/AuthInfoService.ts rename to webapp/packages/core-authentication/src/AuthInfoService.ts diff --git a/webapp/packages/plugin-authentication/src/AuthProviderService.ts b/webapp/packages/core-authentication/src/AuthProviderService.ts similarity index 100% rename from webapp/packages/plugin-authentication/src/AuthProviderService.ts rename to webapp/packages/core-authentication/src/AuthProviderService.ts diff --git a/webapp/packages/plugin-authentication/src/AuthProvidersResource.ts b/webapp/packages/core-authentication/src/AuthProvidersResource.ts similarity index 100% rename from webapp/packages/plugin-authentication/src/AuthProvidersResource.ts rename to webapp/packages/core-authentication/src/AuthProvidersResource.ts diff --git a/webapp/packages/plugin-authentication/src/Administration/RolesManagerService.ts b/webapp/packages/core-authentication/src/RolesManagerService.ts similarity index 100% rename from webapp/packages/plugin-authentication/src/Administration/RolesManagerService.ts rename to webapp/packages/core-authentication/src/RolesManagerService.ts diff --git a/webapp/packages/plugin-authentication/src/Administration/RolesResource.ts b/webapp/packages/core-authentication/src/RolesResource.ts similarity index 100% rename from webapp/packages/plugin-authentication/src/Administration/RolesResource.ts rename to webapp/packages/core-authentication/src/RolesResource.ts diff --git a/webapp/packages/plugin-authentication/src/Administration/UsersResource.ts b/webapp/packages/core-authentication/src/UsersResource.ts similarity index 96% rename from webapp/packages/plugin-authentication/src/Administration/UsersResource.ts rename to webapp/packages/core-authentication/src/UsersResource.ts index b0426d6c6f..050b73b360 100644 --- a/webapp/packages/plugin-authentication/src/Administration/UsersResource.ts +++ b/webapp/packages/core-authentication/src/UsersResource.ts @@ -17,8 +17,8 @@ import { } from '@cloudbeaver/core-sdk'; import { MetadataMap, uuid } from '@cloudbeaver/core-utils'; -import { AuthInfoService } from '../AuthInfoService'; -import { AuthProviderService } from '../AuthProviderService'; +import { AuthInfoService } from './AuthInfoService'; +import { AuthProviderService } from './AuthProviderService'; const NEW_USER_SYMBOL = Symbol('new-user'); @@ -76,6 +76,10 @@ export class UsersResource extends CachedMapResource { } async loadConnections(userId: string): Promise { + if (this.isNew(userId)) { + return []; + } + const { grantedConnections } = await this.graphQLService.gql.getUserGrantedConnections({ userId }); return grantedConnections; diff --git a/webapp/packages/core-authentication/src/index.ts b/webapp/packages/core-authentication/src/index.ts new file mode 100644 index 0000000000..a5234cb6b3 --- /dev/null +++ b/webapp/packages/core-authentication/src/index.ts @@ -0,0 +1,6 @@ +export * from './AuthInfoService'; +export * from './AuthProviderService'; +export * from './AuthProvidersResource'; +export * from './RolesManagerService'; +export * from './RolesResource'; +export * from './UsersResource'; diff --git a/webapp/packages/core-authentication/tsconfig.json b/webapp/packages/core-authentication/tsconfig.json new file mode 100644 index 0000000000..b0b5e9edfa --- /dev/null +++ b/webapp/packages/core-authentication/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "lib" + }, + "exclude": [ + "node_modules" + ], + "include": ["src/**/*"] +} diff --git a/webapp/packages/core-bootstrap/package.json b/webapp/packages/core-bootstrap/package.json index 9464583915..0ba9946b99 100644 --- a/webapp/packages/core-bootstrap/package.json +++ b/webapp/packages/core-bootstrap/package.json @@ -16,6 +16,7 @@ "dependencies": { "@cloudbeaver/core-administration": "^0.1.0", "@cloudbeaver/core-app": "^0.1.0", + "@cloudbeaver/core-authentication": "^0.1.0", "@cloudbeaver/core-blocks": "^0.1.0", "@cloudbeaver/core-connections": "^0.1.0", "@cloudbeaver/core-di": "^0.1.0", diff --git a/webapp/packages/core-bootstrap/src/manifest.ts b/webapp/packages/core-bootstrap/src/manifest.ts index 99929c8294..fb93fe6ae2 100644 --- a/webapp/packages/core-bootstrap/src/manifest.ts +++ b/webapp/packages/core-bootstrap/src/manifest.ts @@ -21,6 +21,9 @@ import { SettingsMenuService, LogViewerService, LogViewerMenuService, TopNavService, AppScreenService, CoreSettingsService, AdministrationTopAppBarBootstrapService } from '@cloudbeaver/core-app'; +import { + AuthInfoService, AuthProviderService, AuthProvidersResource, RolesManagerService, RolesResource, UsersResource +} from '@cloudbeaver/core-authentication'; import { ConnectionsManagerService, ConnectionInfoResource, @@ -71,6 +74,12 @@ export const coreManifest: PluginManifest = { ProductSettingsService, ProductManagerService, PluginManagerService, + AuthInfoService, + AuthProviderService, + AuthProvidersResource, + RolesManagerService, + RolesResource, + UsersResource, ServerSettingsService, ServerConfigResource, PermissionsResource, diff --git a/webapp/packages/core-connections/package.json b/webapp/packages/core-connections/package.json index 99a88947fa..19a865c328 100644 --- a/webapp/packages/core-connections/package.json +++ b/webapp/packages/core-connections/package.json @@ -14,6 +14,8 @@ "lint-fix": "eslint ./src/ --ext .ts,.tsx --fix" }, "peerDependencies": { + "@cloudbeaver/core-administration": "^0.1.0", + "@cloudbeaver/core-authentication": "^0.1.0", "@cloudbeaver/core-di": "^0.1.0", "@cloudbeaver/core-plugin": "^0.1.0", "@cloudbeaver/core-localization": "^0.1.0", diff --git a/webapp/packages/core-connections/src/Administration/Connections/ConnectionsTable/ConnectionEdit.tsx b/webapp/packages/core-connections/src/Administration/Connections/ConnectionsTable/ConnectionEdit.tsx index ecc04c9736..e711d3a610 100644 --- a/webapp/packages/core-connections/src/Administration/Connections/ConnectionsTable/ConnectionEdit.tsx +++ b/webapp/packages/core-connections/src/Administration/Connections/ConnectionsTable/ConnectionEdit.tsx @@ -24,6 +24,7 @@ import { ConnectionsResource } from '../../ConnectionsResource'; import { ConnectionEditController } from './ConnectionEditController'; import { ConnectionForm } from './ConnectionForm/ConnectionForm'; import { DriverProperties } from './DriverProperties/DriverProperties'; +import { GrantedSubjects } from './GrantedSubjects'; const styles = composes( css` @@ -42,6 +43,10 @@ const styles = composes( SubmittingForm { composes: theme-background-secondary from global; } + + GrantedSubjects { + composes: theme-background-surface from global; + } `, css` custom-connection { @@ -143,6 +148,9 @@ export const ConnectionEdit = observer(function ConnectionEdit({ setLoadProperties(true)} disabled={!controller.driver} > {translate('customConnection_properties')} + + {translate('connections_connection_edit_access')} +