1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +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:
Thomas Rittson
2024-09-05 08:21:26 +10:00
committed by GitHub
parent 2f69228c21
commit 8344623185
83 changed files with 297 additions and 239 deletions

View File

@@ -1,7 +1,9 @@
import { MockProxy, mock } from "jest-mock-extended";
import { OrganizationUserService } from "@bitwarden/common/admin-console/abstractions/organization-user/organization-user.service";
import { OrganizationUserResetPasswordDetailsResponse } from "@bitwarden/common/admin-console/abstractions/organization-user/responses";
import {
OrganizationUserApiService,
OrganizationUserResetPasswordDetailsResponse,
} from "@bitwarden/admin-console/common";
import { ListResponse } from "@bitwarden/common/models/response/list.response";
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
import { EncString } from "@bitwarden/common/platform/models/domain/enc-string";
@@ -14,17 +16,17 @@ import { PendingAuthRequestView } from "./pending-auth-request.view";
describe("OrganizationAuthRequestService", () => {
let organizationAuthRequestApiService: MockProxy<OrganizationAuthRequestApiService>;
let cryptoService: MockProxy<CryptoService>;
let organizationUserService: MockProxy<OrganizationUserService>;
let organizationUserApiService: MockProxy<OrganizationUserApiService>;
let organizationAuthRequestService: OrganizationAuthRequestService;
beforeEach(() => {
organizationAuthRequestApiService = mock<OrganizationAuthRequestApiService>();
cryptoService = mock<CryptoService>();
organizationUserService = mock<OrganizationUserService>();
organizationUserApiService = mock<OrganizationUserApiService>();
organizationAuthRequestService = new OrganizationAuthRequestService(
organizationAuthRequestApiService,
cryptoService,
organizationUserService,
organizationUserApiService,
);
});
@@ -113,7 +115,7 @@ describe("OrganizationAuthRequestService", () => {
OrganizationUserResetPasswordDetailsResponse,
);
organizationUserService.getManyOrganizationUserAccountRecoveryDetails.mockResolvedValueOnce(
organizationUserApiService.getManyOrganizationUserAccountRecoveryDetails.mockResolvedValueOnce(
organizationUserResetPasswordDetailsResponse,
);
@@ -155,7 +157,7 @@ describe("OrganizationAuthRequestService", () => {
encryptedPrivateKey: "encryptedPrivateKey",
});
organizationUserService.getOrganizationUserResetPasswordDetails.mockResolvedValue(
organizationUserApiService.getOrganizationUserResetPasswordDetails.mockResolvedValue(
organizationUserResetPasswordDetailsResponse,
);

View File

@@ -1,5 +1,7 @@
import { OrganizationUserService } from "@bitwarden/common/admin-console/abstractions/organization-user/organization-user.service";
import { OrganizationUserResetPasswordDetailsResponse } from "@bitwarden/common/admin-console/abstractions/organization-user/responses";
import {
OrganizationUserApiService,
OrganizationUserResetPasswordDetailsResponse,
} from "@bitwarden/admin-console/common";
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
import { Utils } from "@bitwarden/common/platform/misc/utils";
import { EncString } from "@bitwarden/common/platform/models/domain/enc-string";
@@ -13,7 +15,7 @@ export class OrganizationAuthRequestService {
constructor(
private organizationAuthRequestApiService: OrganizationAuthRequestApiService,
private cryptoService: CryptoService,
private organizationUserService: OrganizationUserService,
private organizationUserApiService: OrganizationUserApiService,
) {}
async listPendingRequests(organizationId: string): Promise<PendingAuthRequestView[]> {
@@ -30,7 +32,7 @@ export class OrganizationAuthRequestService {
): Promise<void> {
const organizationUserIds = authRequests.map((r) => r.organizationUserId);
const details =
await this.organizationUserService.getManyOrganizationUserAccountRecoveryDetails(
await this.organizationUserApiService.getManyOrganizationUserAccountRecoveryDetails(
organizationId,
organizationUserIds,
);
@@ -61,7 +63,7 @@ export class OrganizationAuthRequestService {
}
async approvePendingRequest(organizationId: string, authRequest: PendingAuthRequestView) {
const details = await this.organizationUserService.getOrganizationUserResetPasswordDetails(
const details = await this.organizationUserApiService.getOrganizationUserResetPasswordDetails(
organizationId,
authRequest.organizationUserId,
);