mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 08:43:33 +00:00
[deps] Autofill: Update prettier to v3 (#7014)
* [deps] Autofill: Update prettier to v3 * prettier formatting updates --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jonathan Prusik <jprusik@classynemesis.com>
This commit is contained in:
@@ -78,7 +78,7 @@ const mockedOrganizationDomainSsoDetailsServerResponse = {
|
||||
};
|
||||
|
||||
const mockedOrganizationDomainSsoDetailsResponse = new OrganizationDomainSsoDetailsResponse(
|
||||
mockedOrganizationDomainSsoDetailsServerResponse
|
||||
mockedOrganizationDomainSsoDetailsServerResponse,
|
||||
);
|
||||
|
||||
describe("Org Domain API Service", () => {
|
||||
@@ -194,7 +194,7 @@ describe("Org Domain API Service", () => {
|
||||
"/organizations/domain/sso/details",
|
||||
new OrganizationDomainSsoDetailsRequest(email),
|
||||
false, //anonymous
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
expect(result).toEqual(mockedOrganizationDomainSsoDetailsResponse);
|
||||
|
||||
@@ -11,7 +11,7 @@ import { OrganizationDomainRequest } from "./requests/organization-domain.reques
|
||||
export class OrgDomainApiService implements OrgDomainApiServiceAbstraction {
|
||||
constructor(
|
||||
private orgDomainService: OrgDomainInternalServiceAbstraction,
|
||||
private apiService: ApiService
|
||||
private apiService: ApiService,
|
||||
) {}
|
||||
|
||||
async getAllByOrgId(orgId: string): Promise<Array<OrganizationDomainResponse>> {
|
||||
@@ -20,11 +20,11 @@ export class OrgDomainApiService implements OrgDomainApiServiceAbstraction {
|
||||
`/organizations/${orgId}/domain`,
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
const orgDomains = listResponse.data.map(
|
||||
(resultOrgDomain: any) => new OrganizationDomainResponse(resultOrgDomain)
|
||||
(resultOrgDomain: any) => new OrganizationDomainResponse(resultOrgDomain),
|
||||
);
|
||||
|
||||
this.orgDomainService.replace(orgDomains);
|
||||
@@ -34,14 +34,14 @@ export class OrgDomainApiService implements OrgDomainApiServiceAbstraction {
|
||||
|
||||
async getByOrgIdAndOrgDomainId(
|
||||
orgId: string,
|
||||
orgDomainId: string
|
||||
orgDomainId: string,
|
||||
): Promise<OrganizationDomainResponse> {
|
||||
const result = await this.apiService.send(
|
||||
"GET",
|
||||
`/organizations/${orgId}/domain/${orgDomainId}`,
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
const response = new OrganizationDomainResponse(result);
|
||||
@@ -53,14 +53,14 @@ export class OrgDomainApiService implements OrgDomainApiServiceAbstraction {
|
||||
|
||||
async post(
|
||||
orgId: string,
|
||||
orgDomainReq: OrganizationDomainRequest
|
||||
orgDomainReq: OrganizationDomainRequest,
|
||||
): Promise<OrganizationDomainResponse> {
|
||||
const result = await this.apiService.send(
|
||||
"POST",
|
||||
`/organizations/${orgId}/domain`,
|
||||
orgDomainReq,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
const response = new OrganizationDomainResponse(result);
|
||||
@@ -76,7 +76,7 @@ export class OrgDomainApiService implements OrgDomainApiServiceAbstraction {
|
||||
`/organizations/${orgId}/domain/${orgDomainId}/verify`,
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
const response = new OrganizationDomainResponse(result);
|
||||
@@ -92,7 +92,7 @@ export class OrgDomainApiService implements OrgDomainApiServiceAbstraction {
|
||||
`/organizations/${orgId}/domain/${orgDomainId}`,
|
||||
null,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
this.orgDomainService.delete([orgDomainId]);
|
||||
}
|
||||
@@ -103,7 +103,7 @@ export class OrgDomainApiService implements OrgDomainApiServiceAbstraction {
|
||||
`/organizations/domain/sso/details`,
|
||||
new OrganizationDomainSsoDetailsRequest(email),
|
||||
false, // anonymous
|
||||
true
|
||||
true,
|
||||
);
|
||||
const response = new OrganizationDomainSsoDetailsResponse(result);
|
||||
|
||||
|
||||
@@ -47,14 +47,14 @@ const mockedExtraDomainServerResponse = {
|
||||
};
|
||||
|
||||
const mockedUnverifiedOrgDomainResponse = new OrganizationDomainResponse(
|
||||
mockedUnverifiedDomainServerResponse
|
||||
mockedUnverifiedDomainServerResponse,
|
||||
);
|
||||
const mockedVerifiedOrgDomainResponse = new OrganizationDomainResponse(
|
||||
mockedVerifiedDomainServerResponse
|
||||
mockedVerifiedDomainServerResponse,
|
||||
);
|
||||
|
||||
const mockedExtraOrgDomainResponse = new OrganizationDomainResponse(
|
||||
mockedExtraDomainServerResponse
|
||||
mockedExtraDomainServerResponse,
|
||||
);
|
||||
|
||||
describe("Org Domain Service", () => {
|
||||
@@ -96,11 +96,11 @@ describe("Org Domain Service", () => {
|
||||
orgDomainService.replace(orgDomains);
|
||||
|
||||
expect(orgDomainService.get(mockedVerifiedOrgDomainResponse.id)).toEqual(
|
||||
mockedVerifiedOrgDomainResponse
|
||||
mockedVerifiedOrgDomainResponse,
|
||||
);
|
||||
|
||||
expect(orgDomainService.get(mockedUnverifiedOrgDomainResponse.id)).toEqual(
|
||||
mockedUnverifiedOrgDomainResponse
|
||||
mockedUnverifiedOrgDomainResponse,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -116,7 +116,7 @@ describe("Org Domain Service", () => {
|
||||
orgDomainService.upsert([changedOrgDomain]);
|
||||
|
||||
expect(orgDomainService.get(mockedVerifiedOrgDomainResponse.id).domainName).toEqual(
|
||||
changedOrgDomain.domainName
|
||||
changedOrgDomain.domainName,
|
||||
);
|
||||
|
||||
const newOrgDomain = new OrganizationDomainResponse({
|
||||
|
||||
@@ -12,7 +12,7 @@ export class OrgDomainService implements OrgDomainInternalServiceAbstraction {
|
||||
|
||||
constructor(
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private i18nService: I18nService
|
||||
private i18nService: I18nService,
|
||||
) {}
|
||||
|
||||
get(orgDomainId: string): OrganizationDomainResponse {
|
||||
@@ -26,7 +26,7 @@ export class OrgDomainService implements OrgDomainInternalServiceAbstraction {
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t("valueCopied", this.i18nService.t("dnsTxtRecord"))
|
||||
this.i18nService.t("valueCopied", this.i18nService.t("dnsTxtRecord")),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ export class OrgDomainService implements OrgDomainInternalServiceAbstraction {
|
||||
orgDomains.forEach((orgDomain: OrganizationDomainResponse) => {
|
||||
// Determine if passed in orgDomain exists in existing array:
|
||||
const index = existingOrgDomains.findIndex(
|
||||
(existingOrgDomain) => existingOrgDomain.id === orgDomain.id
|
||||
(existingOrgDomain) => existingOrgDomain.id === orgDomain.id,
|
||||
);
|
||||
if (index !== -1) {
|
||||
existingOrgDomains[index] = orgDomain;
|
||||
@@ -61,7 +61,7 @@ export class OrgDomainService implements OrgDomainInternalServiceAbstraction {
|
||||
|
||||
orgDomainIds.forEach((orgDomainId: string) => {
|
||||
const index = existingOrgDomains.findIndex(
|
||||
(existingOrgDomain) => existingOrgDomain.id === orgDomainId
|
||||
(existingOrgDomain) => existingOrgDomain.id === orgDomainId,
|
||||
);
|
||||
if (index !== -1) {
|
||||
existingOrgDomains.splice(index, 1);
|
||||
|
||||
@@ -30,7 +30,7 @@ export class OrganizationUserServiceImplementation implements OrganizationUserSe
|
||||
id: string,
|
||||
options?: {
|
||||
includeGroups?: boolean;
|
||||
}
|
||||
},
|
||||
): Promise<OrganizationUserDetailsResponse> {
|
||||
const params = new URLSearchParams();
|
||||
|
||||
@@ -43,7 +43,7 @@ export class OrganizationUserServiceImplementation implements OrganizationUserSe
|
||||
`/organizations/${organizationId}/users/${id}?${params.toString()}`,
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
return new OrganizationUserDetailsResponse(r);
|
||||
}
|
||||
@@ -54,7 +54,7 @@ export class OrganizationUserServiceImplementation implements OrganizationUserSe
|
||||
"/organizations/" + organizationId + "/users/" + id + "/groups",
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
return r;
|
||||
}
|
||||
@@ -64,7 +64,7 @@ export class OrganizationUserServiceImplementation implements OrganizationUserSe
|
||||
options?: {
|
||||
includeCollections?: boolean;
|
||||
includeGroups?: boolean;
|
||||
}
|
||||
},
|
||||
): Promise<ListResponse<OrganizationUserUserDetailsResponse>> {
|
||||
const params = new URLSearchParams();
|
||||
|
||||
@@ -80,35 +80,35 @@ export class OrganizationUserServiceImplementation implements OrganizationUserSe
|
||||
`/organizations/${organizationId}/users?${params.toString()}`,
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
return new ListResponse(r, OrganizationUserUserDetailsResponse);
|
||||
}
|
||||
|
||||
async getOrganizationUserResetPasswordDetails(
|
||||
organizationId: string,
|
||||
id: string
|
||||
id: string,
|
||||
): Promise<OrganizationUserResetPasswordDetailsResponse> {
|
||||
const r = await this.apiService.send(
|
||||
"GET",
|
||||
"/organizations/" + organizationId + "/users/" + id + "/reset-password-details",
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
return new OrganizationUserResetPasswordDetailsResponse(r);
|
||||
}
|
||||
|
||||
postOrganizationUserInvite(
|
||||
organizationId: string,
|
||||
request: OrganizationUserInviteRequest
|
||||
request: OrganizationUserInviteRequest,
|
||||
): Promise<void> {
|
||||
return this.apiService.send(
|
||||
"POST",
|
||||
"/organizations/" + organizationId + "/users/invite",
|
||||
request,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -118,20 +118,20 @@ export class OrganizationUserServiceImplementation implements OrganizationUserSe
|
||||
"/organizations/" + organizationId + "/users/" + id + "/reinvite",
|
||||
null,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
async postManyOrganizationUserReinvite(
|
||||
organizationId: string,
|
||||
ids: string[]
|
||||
ids: string[],
|
||||
): Promise<ListResponse<OrganizationUserBulkResponse>> {
|
||||
const r = await this.apiService.send(
|
||||
"POST",
|
||||
"/organizations/" + organizationId + "/users/reinvite",
|
||||
new OrganizationUserBulkRequest(ids),
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
return new ListResponse(r, OrganizationUserBulkResponse);
|
||||
}
|
||||
@@ -139,139 +139,139 @@ export class OrganizationUserServiceImplementation implements OrganizationUserSe
|
||||
postOrganizationUserAcceptInit(
|
||||
organizationId: string,
|
||||
id: string,
|
||||
request: OrganizationUserAcceptInitRequest
|
||||
request: OrganizationUserAcceptInitRequest,
|
||||
): Promise<void> {
|
||||
return this.apiService.send(
|
||||
"POST",
|
||||
"/organizations/" + organizationId + "/users/" + id + "/accept-init",
|
||||
request,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
postOrganizationUserAccept(
|
||||
organizationId: string,
|
||||
id: string,
|
||||
request: OrganizationUserAcceptRequest
|
||||
request: OrganizationUserAcceptRequest,
|
||||
): Promise<void> {
|
||||
return this.apiService.send(
|
||||
"POST",
|
||||
"/organizations/" + organizationId + "/users/" + id + "/accept",
|
||||
request,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
postOrganizationUserConfirm(
|
||||
organizationId: string,
|
||||
id: string,
|
||||
request: OrganizationUserConfirmRequest
|
||||
request: OrganizationUserConfirmRequest,
|
||||
): Promise<void> {
|
||||
return this.apiService.send(
|
||||
"POST",
|
||||
"/organizations/" + organizationId + "/users/" + id + "/confirm",
|
||||
request,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
async postOrganizationUsersPublicKey(
|
||||
organizationId: string,
|
||||
ids: string[]
|
||||
ids: string[],
|
||||
): Promise<ListResponse<OrganizationUserBulkPublicKeyResponse>> {
|
||||
const r = await this.apiService.send(
|
||||
"POST",
|
||||
"/organizations/" + organizationId + "/users/public-keys",
|
||||
new OrganizationUserBulkRequest(ids),
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
return new ListResponse(r, OrganizationUserBulkPublicKeyResponse);
|
||||
}
|
||||
|
||||
async postOrganizationUserBulkConfirm(
|
||||
organizationId: string,
|
||||
request: OrganizationUserBulkConfirmRequest
|
||||
request: OrganizationUserBulkConfirmRequest,
|
||||
): Promise<ListResponse<OrganizationUserBulkResponse>> {
|
||||
const r = await this.apiService.send(
|
||||
"POST",
|
||||
"/organizations/" + organizationId + "/users/confirm",
|
||||
request,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
return new ListResponse(r, OrganizationUserBulkResponse);
|
||||
}
|
||||
|
||||
async putOrganizationUserBulkEnableSecretsManager(
|
||||
organizationId: string,
|
||||
ids: string[]
|
||||
ids: string[],
|
||||
): Promise<void> {
|
||||
await this.apiService.send(
|
||||
"PUT",
|
||||
"/organizations/" + organizationId + "/users/enable-secrets-manager",
|
||||
new OrganizationUserBulkRequest(ids),
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
putOrganizationUser(
|
||||
organizationId: string,
|
||||
id: string,
|
||||
request: OrganizationUserUpdateRequest
|
||||
request: OrganizationUserUpdateRequest,
|
||||
): Promise<void> {
|
||||
return this.apiService.send(
|
||||
"PUT",
|
||||
"/organizations/" + organizationId + "/users/" + id,
|
||||
request,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
putOrganizationUserGroups(
|
||||
organizationId: string,
|
||||
id: string,
|
||||
request: OrganizationUserUpdateGroupsRequest
|
||||
request: OrganizationUserUpdateGroupsRequest,
|
||||
): Promise<void> {
|
||||
return this.apiService.send(
|
||||
"PUT",
|
||||
"/organizations/" + organizationId + "/users/" + id + "/groups",
|
||||
request,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
putOrganizationUserResetPasswordEnrollment(
|
||||
organizationId: string,
|
||||
userId: string,
|
||||
request: OrganizationUserResetPasswordEnrollmentRequest
|
||||
request: OrganizationUserResetPasswordEnrollmentRequest,
|
||||
): Promise<void> {
|
||||
return this.apiService.send(
|
||||
"PUT",
|
||||
"/organizations/" + organizationId + "/users/" + userId + "/reset-password-enrollment",
|
||||
request,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
putOrganizationUserResetPassword(
|
||||
organizationId: string,
|
||||
id: string,
|
||||
request: OrganizationUserResetPasswordRequest
|
||||
request: OrganizationUserResetPasswordRequest,
|
||||
): Promise<void> {
|
||||
return this.apiService.send(
|
||||
"PUT",
|
||||
"/organizations/" + organizationId + "/users/" + id + "/reset-password",
|
||||
request,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -281,20 +281,20 @@ export class OrganizationUserServiceImplementation implements OrganizationUserSe
|
||||
"/organizations/" + organizationId + "/users/" + id,
|
||||
null,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
async deleteManyOrganizationUsers(
|
||||
organizationId: string,
|
||||
ids: string[]
|
||||
ids: string[],
|
||||
): Promise<ListResponse<OrganizationUserBulkResponse>> {
|
||||
const r = await this.apiService.send(
|
||||
"DELETE",
|
||||
"/organizations/" + organizationId + "/users",
|
||||
new OrganizationUserBulkRequest(ids),
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
return new ListResponse(r, OrganizationUserBulkResponse);
|
||||
}
|
||||
@@ -305,20 +305,20 @@ export class OrganizationUserServiceImplementation implements OrganizationUserSe
|
||||
"/organizations/" + organizationId + "/users/" + id + "/revoke",
|
||||
null,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
async revokeManyOrganizationUsers(
|
||||
organizationId: string,
|
||||
ids: string[]
|
||||
ids: string[],
|
||||
): Promise<ListResponse<OrganizationUserBulkResponse>> {
|
||||
const r = await this.apiService.send(
|
||||
"PUT",
|
||||
"/organizations/" + organizationId + "/users/revoke",
|
||||
new OrganizationUserBulkRequest(ids),
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
return new ListResponse(r, OrganizationUserBulkResponse);
|
||||
}
|
||||
@@ -329,20 +329,20 @@ export class OrganizationUserServiceImplementation implements OrganizationUserSe
|
||||
"/organizations/" + organizationId + "/users/" + id + "/restore",
|
||||
null,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
async restoreManyOrganizationUsers(
|
||||
organizationId: string,
|
||||
ids: string[]
|
||||
ids: string[],
|
||||
): Promise<ListResponse<OrganizationUserBulkResponse>> {
|
||||
const r = await this.apiService.send(
|
||||
"PUT",
|
||||
"/organizations/" + organizationId + "/users/restore",
|
||||
new OrganizationUserBulkRequest(ids),
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
return new ListResponse(r, OrganizationUserBulkResponse);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,10 @@ import { OrganizationResponse } from "../../models/response/organization.respons
|
||||
import { ProfileOrganizationResponse } from "../../models/response/profile-organization.response";
|
||||
|
||||
export class OrganizationApiService implements OrganizationApiServiceAbstraction {
|
||||
constructor(private apiService: ApiService, private syncService: SyncService) {}
|
||||
constructor(
|
||||
private apiService: ApiService,
|
||||
private syncService: SyncService,
|
||||
) {}
|
||||
|
||||
async get(id: string): Promise<OrganizationResponse> {
|
||||
const r = await this.apiService.send("GET", "/organizations/" + id, null, true, true);
|
||||
@@ -46,7 +49,7 @@ export class OrganizationApiService implements OrganizationApiServiceAbstraction
|
||||
"/organizations/" + id + "/billing",
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
return new BillingResponse(r);
|
||||
}
|
||||
@@ -57,7 +60,7 @@ export class OrganizationApiService implements OrganizationApiServiceAbstraction
|
||||
"/organizations/" + id + "/subscription",
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
return new OrganizationSubscriptionResponse(r);
|
||||
}
|
||||
@@ -68,7 +71,7 @@ export class OrganizationApiService implements OrganizationApiServiceAbstraction
|
||||
"/organizations/" + id + "/license?installationId=" + installationId,
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -78,7 +81,7 @@ export class OrganizationApiService implements OrganizationApiServiceAbstraction
|
||||
"/organizations/" + identifier + "/auto-enroll-status",
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
return new OrganizationAutoEnrollStatusResponse(r);
|
||||
}
|
||||
@@ -96,7 +99,7 @@ export class OrganizationApiService implements OrganizationApiServiceAbstraction
|
||||
"/organizations/licenses/self-hosted",
|
||||
data,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
return new OrganizationResponse(r);
|
||||
}
|
||||
@@ -118,34 +121,34 @@ export class OrganizationApiService implements OrganizationApiServiceAbstraction
|
||||
"/organizations/" + id + "/upgrade",
|
||||
request,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
return new PaymentResponse(r);
|
||||
}
|
||||
|
||||
async updatePasswordManagerSeats(
|
||||
id: string,
|
||||
request: OrganizationSubscriptionUpdateRequest
|
||||
request: OrganizationSubscriptionUpdateRequest,
|
||||
): Promise<void> {
|
||||
return this.apiService.send(
|
||||
"POST",
|
||||
"/organizations/" + id + "/subscription",
|
||||
request,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
async updateSecretsManagerSubscription(
|
||||
id: string,
|
||||
request: OrganizationSmSubscriptionUpdateRequest
|
||||
request: OrganizationSmSubscriptionUpdateRequest,
|
||||
): Promise<void> {
|
||||
return this.apiService.send(
|
||||
"POST",
|
||||
"/organizations/" + id + "/sm-subscription",
|
||||
request,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -155,7 +158,7 @@ export class OrganizationApiService implements OrganizationApiServiceAbstraction
|
||||
"/organizations/" + id + "/seat",
|
||||
request,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
return new PaymentResponse(r);
|
||||
}
|
||||
@@ -166,7 +169,7 @@ export class OrganizationApiService implements OrganizationApiServiceAbstraction
|
||||
"/organizations/" + id + "/storage",
|
||||
request,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
return new PaymentResponse(r);
|
||||
}
|
||||
@@ -177,7 +180,7 @@ export class OrganizationApiService implements OrganizationApiServiceAbstraction
|
||||
"/organizations/" + id + "/verify-bank",
|
||||
request,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -205,7 +208,7 @@ export class OrganizationApiService implements OrganizationApiServiceAbstraction
|
||||
"/organizations/licenses/self-hosted/" + id,
|
||||
data,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -215,7 +218,7 @@ export class OrganizationApiService implements OrganizationApiServiceAbstraction
|
||||
"/organizations/" + organizationId + "/import",
|
||||
request,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -225,14 +228,14 @@ export class OrganizationApiService implements OrganizationApiServiceAbstraction
|
||||
"/organizations/" + id + "/api-key",
|
||||
request,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
return new ApiKeyResponse(r);
|
||||
}
|
||||
|
||||
async getApiKeyInformation(
|
||||
id: string,
|
||||
organizationApiKeyType: OrganizationApiKeyType = null
|
||||
organizationApiKeyType: OrganizationApiKeyType = null,
|
||||
): Promise<ListResponse<OrganizationApiKeyInformationResponse>> {
|
||||
const uri =
|
||||
organizationApiKeyType === null
|
||||
@@ -248,7 +251,7 @@ export class OrganizationApiService implements OrganizationApiServiceAbstraction
|
||||
"/organizations/" + id + "/rotate-api-key",
|
||||
request,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
return new ApiKeyResponse(r);
|
||||
}
|
||||
@@ -270,14 +273,14 @@ export class OrganizationApiService implements OrganizationApiServiceAbstraction
|
||||
|
||||
async updateKeys(
|
||||
id: string,
|
||||
request: OrganizationKeysRequest
|
||||
request: OrganizationKeysRequest,
|
||||
): Promise<OrganizationKeysResponse> {
|
||||
const r = await this.apiService.send(
|
||||
"POST",
|
||||
"/organizations/" + id + "/keys",
|
||||
request,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
// Not broadcasting anything because data on this response doesn't correspond to `Organization`
|
||||
return new OrganizationKeysResponse(r);
|
||||
@@ -294,7 +297,7 @@ export class OrganizationApiService implements OrganizationApiServiceAbstraction
|
||||
"/organizations/" + id + "/sso",
|
||||
request,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
// Not broadcasting anything because data on this response doesn't correspond to `Organization`
|
||||
return new OrganizationSsoResponse(r);
|
||||
@@ -306,34 +309,34 @@ export class OrganizationApiService implements OrganizationApiServiceAbstraction
|
||||
"/organizations/licenses/self-hosted/" + id + "/sync/",
|
||||
null,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
async subscribeToSecretsManager(
|
||||
id: string,
|
||||
request: SecretsManagerSubscribeRequest
|
||||
request: SecretsManagerSubscribeRequest,
|
||||
): Promise<ProfileOrganizationResponse> {
|
||||
const r = await this.apiService.send(
|
||||
"POST",
|
||||
"/organizations/" + id + "/subscribe-secrets-manager",
|
||||
request,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
return new ProfileOrganizationResponse(r);
|
||||
}
|
||||
|
||||
async updateCollectionManagement(
|
||||
id: string,
|
||||
request: OrganizationCollectionManagementUpdateRequest
|
||||
request: OrganizationCollectionManagementUpdateRequest,
|
||||
): Promise<OrganizationResponse> {
|
||||
const r = await this.apiService.send(
|
||||
"PUT",
|
||||
"/organizations/" + id + "/collection-management",
|
||||
request,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
const data = new OrganizationResponse(r);
|
||||
await this.syncService.fullSync(true);
|
||||
|
||||
@@ -14,7 +14,7 @@ describe("Organization Service", () => {
|
||||
let activeAccountUnlocked: BehaviorSubject<boolean>;
|
||||
|
||||
const resetStateService = async (
|
||||
customizeStateService: (stateService: MockProxy<StateService>) => void
|
||||
customizeStateService: (stateService: MockProxy<StateService>) => void,
|
||||
) => {
|
||||
mockClear(stateService);
|
||||
stateService = mock<StateService>();
|
||||
|
||||
@@ -25,7 +25,7 @@ export class OrganizationService implements InternalOrganizationServiceAbstracti
|
||||
|
||||
const data = await this.stateService.getOrganizations();
|
||||
this.updateObservables(data);
|
||||
})
|
||||
}),
|
||||
)
|
||||
.subscribe();
|
||||
}
|
||||
@@ -42,7 +42,7 @@ export class OrganizationService implements InternalOrganizationServiceAbstracti
|
||||
async canManageSponsorships(): Promise<boolean> {
|
||||
const organizations = this._organizations.getValue();
|
||||
return organizations.some(
|
||||
(o) => o.familySponsorshipAvailable || o.familySponsorshipFriendlyName !== null
|
||||
(o) => o.familySponsorshipAvailable || o.familySponsorshipFriendlyName !== null,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ export class PolicyApiService implements PolicyApiServiceAbstraction {
|
||||
constructor(
|
||||
private policyService: InternalPolicyService,
|
||||
private apiService: ApiService,
|
||||
private stateService: StateService
|
||||
private stateService: StateService,
|
||||
) {}
|
||||
|
||||
async getPolicy(organizationId: string, type: PolicyType): Promise<PolicyResponse> {
|
||||
@@ -27,7 +27,7 @@ export class PolicyApiService implements PolicyApiServiceAbstraction {
|
||||
"/organizations/" + organizationId + "/policies/" + type,
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
return new PolicyResponse(r);
|
||||
}
|
||||
@@ -38,7 +38,7 @@ export class PolicyApiService implements PolicyApiServiceAbstraction {
|
||||
"/organizations/" + organizationId + "/policies",
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
return new ListResponse(r, PolicyResponse);
|
||||
}
|
||||
@@ -47,7 +47,7 @@ export class PolicyApiService implements PolicyApiServiceAbstraction {
|
||||
organizationId: string,
|
||||
token: string,
|
||||
email: string,
|
||||
organizationUserId: string
|
||||
organizationUserId: string,
|
||||
): Promise<ListResponse<PolicyResponse>> {
|
||||
const r = await this.apiService.send(
|
||||
"GET",
|
||||
@@ -62,35 +62,34 @@ export class PolicyApiService implements PolicyApiServiceAbstraction {
|
||||
organizationUserId,
|
||||
null,
|
||||
false,
|
||||
true
|
||||
true,
|
||||
);
|
||||
return new ListResponse(r, PolicyResponse);
|
||||
}
|
||||
|
||||
private async getMasterPasswordPolicyResponseForOrgUser(
|
||||
organizationId: string
|
||||
organizationId: string,
|
||||
): Promise<PolicyResponse> {
|
||||
const response = await this.apiService.send(
|
||||
"GET",
|
||||
"/organizations/" + organizationId + "/policies/master-password",
|
||||
null,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
return new PolicyResponse(response);
|
||||
}
|
||||
|
||||
async getMasterPasswordPolicyOptsForOrgUser(
|
||||
orgId: string
|
||||
orgId: string,
|
||||
): Promise<MasterPasswordPolicyOptions | null> {
|
||||
try {
|
||||
const masterPasswordPolicyResponse = await this.getMasterPasswordPolicyResponseForOrgUser(
|
||||
orgId
|
||||
);
|
||||
const masterPasswordPolicyResponse =
|
||||
await this.getMasterPasswordPolicyResponseForOrgUser(orgId);
|
||||
|
||||
const masterPasswordPolicy = this.policyService.mapPolicyFromResponse(
|
||||
masterPasswordPolicyResponse
|
||||
masterPasswordPolicyResponse,
|
||||
);
|
||||
|
||||
if (!masterPasswordPolicy) {
|
||||
@@ -98,7 +97,7 @@ export class PolicyApiService implements PolicyApiServiceAbstraction {
|
||||
}
|
||||
|
||||
return await firstValueFrom(
|
||||
this.policyService.masterPasswordPolicyOptions$([masterPasswordPolicy])
|
||||
this.policyService.masterPasswordPolicyOptions$([masterPasswordPolicy]),
|
||||
);
|
||||
} catch (error) {
|
||||
// If policy not found, return null
|
||||
@@ -116,7 +115,7 @@ export class PolicyApiService implements PolicyApiServiceAbstraction {
|
||||
"/organizations/" + organizationId + "/policies/" + type,
|
||||
request,
|
||||
true,
|
||||
true
|
||||
true,
|
||||
);
|
||||
const response = new PolicyResponse(r);
|
||||
const data = new PolicyData(response);
|
||||
|
||||
@@ -20,7 +20,7 @@ export class PolicyService implements InternalPolicyServiceAbstraction {
|
||||
|
||||
constructor(
|
||||
protected stateService: StateService,
|
||||
private organizationService: OrganizationService
|
||||
private organizationService: OrganizationService,
|
||||
) {
|
||||
this.stateService.activeAccountUnlocked$
|
||||
.pipe(
|
||||
@@ -37,7 +37,7 @@ export class PolicyService implements InternalPolicyServiceAbstraction {
|
||||
const data = await this.stateService.getEncryptedPolicies();
|
||||
|
||||
await this.updateObservables(data);
|
||||
})
|
||||
}),
|
||||
)
|
||||
.subscribe();
|
||||
}
|
||||
@@ -50,12 +50,12 @@ export class PolicyService implements InternalPolicyServiceAbstraction {
|
||||
policies,
|
||||
policyType,
|
||||
policyFilter,
|
||||
userId
|
||||
userId,
|
||||
);
|
||||
if (appliesToCurrentUser) {
|
||||
return policies.find((policy) => policy.type === policyType && policy.enabled);
|
||||
}
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ export class PolicyService implements InternalPolicyServiceAbstraction {
|
||||
});
|
||||
|
||||
return enforcedOptions;
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -145,14 +145,14 @@ export class PolicyService implements InternalPolicyServiceAbstraction {
|
||||
concatMap(async (policies) => {
|
||||
const userId = await this.stateService.getUserId();
|
||||
return await this.checkPoliciesThatApplyToUser(policies, policyType, policyFilter, userId);
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
evaluateMasterPassword(
|
||||
passwordStrength: number,
|
||||
newPassword: string,
|
||||
enforcedPolicyOptions: MasterPasswordPolicyOptions
|
||||
enforcedPolicyOptions: MasterPasswordPolicyOptions,
|
||||
): boolean {
|
||||
if (enforcedPolicyOptions == null) {
|
||||
return true;
|
||||
@@ -194,7 +194,7 @@ export class PolicyService implements InternalPolicyServiceAbstraction {
|
||||
|
||||
getResetPasswordPolicyOptions(
|
||||
policies: Policy[],
|
||||
orgId: string
|
||||
orgId: string,
|
||||
): [ResetPasswordPolicyOptions, boolean] {
|
||||
const resetPasswordPolicyOptions = new ResetPasswordPolicyOptions();
|
||||
|
||||
@@ -203,7 +203,7 @@ export class PolicyService implements InternalPolicyServiceAbstraction {
|
||||
}
|
||||
|
||||
const policy = policies.find(
|
||||
(p) => p.organizationId === orgId && p.type === PolicyType.ResetPassword && p.enabled
|
||||
(p) => p.organizationId === orgId && p.type === PolicyType.ResetPassword && p.enabled,
|
||||
);
|
||||
resetPasswordPolicyOptions.autoEnrollEnabled = policy?.data?.autoEnrollEnabled ?? false;
|
||||
|
||||
@@ -226,7 +226,7 @@ export class PolicyService implements InternalPolicyServiceAbstraction {
|
||||
async policyAppliesToUser(
|
||||
policyType: PolicyType,
|
||||
policyFilter?: (policy: Policy) => boolean,
|
||||
userId?: string
|
||||
userId?: string,
|
||||
) {
|
||||
const policies = await this.getAll(policyType, userId);
|
||||
|
||||
@@ -278,11 +278,11 @@ export class PolicyService implements InternalPolicyServiceAbstraction {
|
||||
policies: Policy[],
|
||||
policyType: PolicyType,
|
||||
policyFilter?: (policy: Policy) => boolean,
|
||||
userId?: string
|
||||
userId?: string,
|
||||
) {
|
||||
const organizations = await this.organizationService.getAll(userId);
|
||||
const filteredPolicies = policies.filter(
|
||||
(p) => p.type === policyType && p.enabled && (policyFilter == null || policyFilter(p))
|
||||
(p) => p.type === policyType && p.enabled && (policyFilter == null || policyFilter(p)),
|
||||
);
|
||||
const policySet = new Set(filteredPolicies.map((p) => p.organizationId));
|
||||
|
||||
@@ -291,7 +291,7 @@ export class PolicyService implements InternalPolicyServiceAbstraction {
|
||||
o.status >= OrganizationUserStatusType.Accepted &&
|
||||
o.usePolicies &&
|
||||
policySet.has(o.id) &&
|
||||
!this.isExemptFromPolicies(o, policyType)
|
||||
!this.isExemptFromPolicies(o, policyType),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user