mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 15:53:27 +00:00
[PM-11450] Move organization-user domain to admin-console lib (#10785)
- move organization-user files from libs/common/src/admin-console into libs/admin-console/src/common - add barrel files and update imports to use barrel files - rename OrganizationUserService to OrganizationUserApiService - rename OrganizationUserServiceImplementation to DefaultOrganizationUserApiService
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import {
|
||||
OrganizationUserApiService,
|
||||
OrganizationUserConfirmRequest,
|
||||
} from "@bitwarden/admin-console/common";
|
||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||
import { OrganizationUserService } from "@bitwarden/common/admin-console/abstractions/organization-user/organization-user.service";
|
||||
import { OrganizationUserConfirmRequest } from "@bitwarden/common/admin-console/abstractions/organization-user/requests";
|
||||
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
|
||||
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
||||
|
||||
@@ -10,7 +12,7 @@ export class ConfirmCommand {
|
||||
constructor(
|
||||
private apiService: ApiService,
|
||||
private cryptoService: CryptoService,
|
||||
private organizationUserService: OrganizationUserService,
|
||||
private organizationUserApiService: OrganizationUserApiService,
|
||||
) {}
|
||||
|
||||
async run(object: string, id: string, cmdOptions: Record<string, any>): Promise<Response> {
|
||||
@@ -42,7 +44,7 @@ export class ConfirmCommand {
|
||||
if (orgKey == null) {
|
||||
throw new Error("No encryption key for this organization.");
|
||||
}
|
||||
const orgUser = await this.organizationUserService.getOrganizationUser(
|
||||
const orgUser = await this.organizationUserApiService.getOrganizationUser(
|
||||
options.organizationId,
|
||||
id,
|
||||
);
|
||||
@@ -54,7 +56,7 @@ export class ConfirmCommand {
|
||||
const key = await this.cryptoService.rsaEncrypt(orgKey.key, publicKey);
|
||||
const req = new OrganizationUserConfirmRequest();
|
||||
req.key = key.encryptedString;
|
||||
await this.organizationUserService.postOrganizationUserConfirm(
|
||||
await this.organizationUserApiService.postOrganizationUserConfirm(
|
||||
options.organizationId,
|
||||
id,
|
||||
req,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { firstValueFrom } from "rxjs";
|
||||
|
||||
import { OrganizationUserApiService } from "@bitwarden/admin-console/common";
|
||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||
import { SearchService } from "@bitwarden/common/abstractions/search.service";
|
||||
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
|
||||
import { OrganizationUserService } from "@bitwarden/common/admin-console/abstractions/organization-user/organization-user.service";
|
||||
import { EventType } from "@bitwarden/common/enums";
|
||||
import { ListResponse as ApiListResponse } from "@bitwarden/common/models/response/list.response";
|
||||
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
||||
@@ -35,7 +35,7 @@ export class ListCommand {
|
||||
private collectionService: CollectionService,
|
||||
private organizationService: OrganizationService,
|
||||
private searchService: SearchService,
|
||||
private organizationUserService: OrganizationUserService,
|
||||
private organizationUserApiService: OrganizationUserApiService,
|
||||
private apiService: ApiService,
|
||||
private eventCollectionService: EventCollectionService,
|
||||
) {}
|
||||
@@ -211,7 +211,7 @@ export class ListCommand {
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await this.organizationUserService.getAllUsers(options.organizationId);
|
||||
const response = await this.organizationUserApiService.getAllUsers(options.organizationId);
|
||||
const res = new ListResponse(
|
||||
response.data.map((r) => {
|
||||
const u = new OrganizationUserResponse();
|
||||
|
||||
@@ -71,7 +71,7 @@ export class OssServeConfigurator {
|
||||
this.serviceContainer.collectionService,
|
||||
this.serviceContainer.organizationService,
|
||||
this.serviceContainer.searchService,
|
||||
this.serviceContainer.organizationUserService,
|
||||
this.serviceContainer.organizationUserApiService,
|
||||
this.serviceContainer.apiService,
|
||||
this.serviceContainer.eventCollectionService,
|
||||
);
|
||||
@@ -114,7 +114,7 @@ export class OssServeConfigurator {
|
||||
this.confirmCommand = new ConfirmCommand(
|
||||
this.serviceContainer.apiService,
|
||||
this.serviceContainer.cryptoService,
|
||||
this.serviceContainer.organizationUserService,
|
||||
this.serviceContainer.organizationUserApiService,
|
||||
);
|
||||
this.restoreCommand = new RestoreCommand(this.serviceContainer.cipherService);
|
||||
this.shareCommand = new ShareCommand(
|
||||
|
||||
@@ -4,6 +4,10 @@ import * as path from "path";
|
||||
import * as jsdom from "jsdom";
|
||||
import { firstValueFrom } from "rxjs";
|
||||
|
||||
import {
|
||||
OrganizationUserApiService,
|
||||
DefaultOrganizationUserApiService,
|
||||
} from "@bitwarden/admin-console/common";
|
||||
import {
|
||||
InternalUserDecryptionOptionsServiceAbstraction,
|
||||
AuthRequestService,
|
||||
@@ -16,12 +20,10 @@ import {
|
||||
import { EventCollectionService as EventCollectionServiceAbstraction } from "@bitwarden/common/abstractions/event/event-collection.service";
|
||||
import { EventUploadService as EventUploadServiceAbstraction } from "@bitwarden/common/abstractions/event/event-upload.service";
|
||||
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction";
|
||||
import { OrganizationUserService } from "@bitwarden/common/admin-console/abstractions/organization-user/organization-user.service";
|
||||
import { PolicyApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/policy/policy-api.service.abstraction";
|
||||
import { ProviderApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/provider/provider-api.service.abstraction";
|
||||
import { OrganizationApiService } from "@bitwarden/common/admin-console/services/organization/organization-api.service";
|
||||
import { OrganizationService } from "@bitwarden/common/admin-console/services/organization/organization.service";
|
||||
import { OrganizationUserServiceImplementation } from "@bitwarden/common/admin-console/services/organization-user/organization-user.service.implementation";
|
||||
import { PolicyApiService } from "@bitwarden/common/admin-console/services/policy/policy-api.service";
|
||||
import { PolicyService } from "@bitwarden/common/admin-console/services/policy/policy.service";
|
||||
import { ProviderApiService } from "@bitwarden/common/admin-console/services/provider/provider-api.service";
|
||||
@@ -184,7 +186,7 @@ export class ServiceContainer {
|
||||
environmentService: EnvironmentService;
|
||||
cipherService: CipherService;
|
||||
folderService: InternalFolderService;
|
||||
organizationUserService: OrganizationUserService;
|
||||
organizationUserApiService: OrganizationUserApiService;
|
||||
collectionService: CollectionService;
|
||||
vaultTimeoutService: VaultTimeoutService;
|
||||
masterPasswordService: InternalMasterPasswordServiceAbstraction;
|
||||
@@ -492,7 +494,7 @@ export class ServiceContainer {
|
||||
|
||||
this.providerService = new ProviderService(this.stateProvider);
|
||||
|
||||
this.organizationUserService = new OrganizationUserServiceImplementation(this.apiService);
|
||||
this.organizationUserApiService = new DefaultOrganizationUserApiService(this.apiService);
|
||||
|
||||
this.policyApiService = new PolicyApiService(this.policyService, this.apiService);
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ export class VaultProgram extends BaseProgram {
|
||||
this.serviceContainer.collectionService,
|
||||
this.serviceContainer.organizationService,
|
||||
this.serviceContainer.searchService,
|
||||
this.serviceContainer.organizationUserService,
|
||||
this.serviceContainer.organizationUserApiService,
|
||||
this.serviceContainer.apiService,
|
||||
this.serviceContainer.eventCollectionService,
|
||||
);
|
||||
@@ -412,7 +412,7 @@ export class VaultProgram extends BaseProgram {
|
||||
const command = new ConfirmCommand(
|
||||
this.serviceContainer.apiService,
|
||||
this.serviceContainer.cryptoService,
|
||||
this.serviceContainer.organizationUserService,
|
||||
this.serviceContainer.organizationUserApiService,
|
||||
);
|
||||
const response = await command.run(object, id, cmd);
|
||||
this.processResponse(response);
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@bitwarden/common/spec": ["../../libs/common/spec"],
|
||||
"@bitwarden/admin-console/common": ["../../libs/admin-console/src/common"],
|
||||
"@bitwarden/auth/common": ["../../libs/auth/src/common"],
|
||||
"@bitwarden/auth/angular": ["../../libs/auth/src/angular"],
|
||||
"@bitwarden/common/*": ["../../libs/common/src/*"],
|
||||
|
||||
Reference in New Issue
Block a user