mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +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:
@@ -7,11 +7,11 @@ export abstract class OrgDomainApiServiceAbstraction {
|
||||
getAllByOrgId: (orgId: string) => Promise<Array<OrganizationDomainResponse>>;
|
||||
getByOrgIdAndOrgDomainId: (
|
||||
orgId: string,
|
||||
orgDomainId: string
|
||||
orgDomainId: string,
|
||||
) => Promise<OrganizationDomainResponse>;
|
||||
post: (
|
||||
orgId: string,
|
||||
orgDomain: OrganizationDomainRequest
|
||||
orgDomain: OrganizationDomainRequest,
|
||||
) => Promise<OrganizationDomainResponse>;
|
||||
verify: (orgId: string, orgDomainId: string) => Promise<OrganizationDomainResponse>;
|
||||
delete: (orgId: string, orgDomainId: string) => Promise<any>;
|
||||
|
||||
@@ -34,7 +34,7 @@ export abstract class OrganizationUserService {
|
||||
id: string,
|
||||
options?: {
|
||||
includeGroups?: boolean;
|
||||
}
|
||||
},
|
||||
): Promise<OrganizationUserDetailsResponse>;
|
||||
|
||||
/**
|
||||
@@ -54,7 +54,7 @@ export abstract class OrganizationUserService {
|
||||
options?: {
|
||||
includeCollections?: boolean;
|
||||
includeGroups?: boolean;
|
||||
}
|
||||
},
|
||||
): Promise<ListResponse<OrganizationUserUserDetailsResponse>>;
|
||||
|
||||
/**
|
||||
@@ -64,7 +64,7 @@ export abstract class OrganizationUserService {
|
||||
*/
|
||||
abstract getOrganizationUserResetPasswordDetails(
|
||||
organizationId: string,
|
||||
id: string
|
||||
id: string,
|
||||
): Promise<OrganizationUserResetPasswordDetailsResponse>;
|
||||
|
||||
/**
|
||||
@@ -74,7 +74,7 @@ export abstract class OrganizationUserService {
|
||||
*/
|
||||
abstract postOrganizationUserInvite(
|
||||
organizationId: string,
|
||||
request: OrganizationUserInviteRequest
|
||||
request: OrganizationUserInviteRequest,
|
||||
): Promise<void>;
|
||||
|
||||
/**
|
||||
@@ -92,7 +92,7 @@ export abstract class OrganizationUserService {
|
||||
*/
|
||||
abstract postManyOrganizationUserReinvite(
|
||||
organizationId: string,
|
||||
ids: string[]
|
||||
ids: string[],
|
||||
): Promise<ListResponse<OrganizationUserBulkResponse>>;
|
||||
|
||||
/**
|
||||
@@ -106,7 +106,7 @@ export abstract class OrganizationUserService {
|
||||
abstract postOrganizationUserAcceptInit(
|
||||
organizationId: string,
|
||||
id: string,
|
||||
request: OrganizationUserAcceptInitRequest
|
||||
request: OrganizationUserAcceptInitRequest,
|
||||
): Promise<void>;
|
||||
|
||||
/**
|
||||
@@ -118,7 +118,7 @@ export abstract class OrganizationUserService {
|
||||
abstract postOrganizationUserAccept(
|
||||
organizationId: string,
|
||||
id: string,
|
||||
request: OrganizationUserAcceptRequest
|
||||
request: OrganizationUserAcceptRequest,
|
||||
): Promise<void>;
|
||||
|
||||
/**
|
||||
@@ -130,7 +130,7 @@ export abstract class OrganizationUserService {
|
||||
abstract postOrganizationUserConfirm(
|
||||
organizationId: string,
|
||||
id: string,
|
||||
request: OrganizationUserConfirmRequest
|
||||
request: OrganizationUserConfirmRequest,
|
||||
): Promise<void>;
|
||||
|
||||
/**
|
||||
@@ -140,7 +140,7 @@ export abstract class OrganizationUserService {
|
||||
*/
|
||||
abstract postOrganizationUsersPublicKey(
|
||||
organizationId: string,
|
||||
ids: string[]
|
||||
ids: string[],
|
||||
): Promise<ListResponse<OrganizationUserBulkPublicKeyResponse>>;
|
||||
|
||||
/**
|
||||
@@ -150,7 +150,7 @@ export abstract class OrganizationUserService {
|
||||
*/
|
||||
abstract postOrganizationUserBulkConfirm(
|
||||
organizationId: string,
|
||||
request: OrganizationUserBulkConfirmRequest
|
||||
request: OrganizationUserBulkConfirmRequest,
|
||||
): Promise<ListResponse<OrganizationUserBulkResponse>>;
|
||||
|
||||
/**
|
||||
@@ -162,7 +162,7 @@ export abstract class OrganizationUserService {
|
||||
abstract putOrganizationUser(
|
||||
organizationId: string,
|
||||
id: string,
|
||||
request: OrganizationUserUpdateRequest
|
||||
request: OrganizationUserUpdateRequest,
|
||||
): Promise<void>;
|
||||
|
||||
/**
|
||||
@@ -174,7 +174,7 @@ export abstract class OrganizationUserService {
|
||||
abstract putOrganizationUserGroups(
|
||||
organizationId: string,
|
||||
id: string,
|
||||
groupIds: OrganizationUserUpdateGroupsRequest
|
||||
groupIds: OrganizationUserUpdateGroupsRequest,
|
||||
): Promise<void>;
|
||||
|
||||
/**
|
||||
@@ -186,7 +186,7 @@ export abstract class OrganizationUserService {
|
||||
abstract putOrganizationUserResetPasswordEnrollment(
|
||||
organizationId: string,
|
||||
userId: string,
|
||||
request: OrganizationUserResetPasswordEnrollmentRequest
|
||||
request: OrganizationUserResetPasswordEnrollmentRequest,
|
||||
): Promise<void>;
|
||||
|
||||
/**
|
||||
@@ -198,7 +198,7 @@ export abstract class OrganizationUserService {
|
||||
abstract putOrganizationUserResetPassword(
|
||||
organizationId: string,
|
||||
id: string,
|
||||
request: OrganizationUserResetPasswordRequest
|
||||
request: OrganizationUserResetPasswordRequest,
|
||||
): Promise<void>;
|
||||
|
||||
/**
|
||||
@@ -209,7 +209,7 @@ export abstract class OrganizationUserService {
|
||||
*/
|
||||
abstract putOrganizationUserBulkEnableSecretsManager(
|
||||
organizationId: string,
|
||||
ids: string[]
|
||||
ids: string[],
|
||||
): Promise<void>;
|
||||
|
||||
/**
|
||||
@@ -227,7 +227,7 @@ export abstract class OrganizationUserService {
|
||||
*/
|
||||
abstract deleteManyOrganizationUsers(
|
||||
organizationId: string,
|
||||
ids: string[]
|
||||
ids: string[],
|
||||
): Promise<ListResponse<OrganizationUserBulkResponse>>;
|
||||
|
||||
/**
|
||||
@@ -245,7 +245,7 @@ export abstract class OrganizationUserService {
|
||||
*/
|
||||
abstract revokeManyOrganizationUsers(
|
||||
organizationId: string,
|
||||
ids: string[]
|
||||
ids: string[],
|
||||
): Promise<ListResponse<OrganizationUserBulkResponse>>;
|
||||
|
||||
/**
|
||||
@@ -263,6 +263,6 @@ export abstract class OrganizationUserService {
|
||||
*/
|
||||
abstract restoreManyOrganizationUsers(
|
||||
organizationId: string,
|
||||
ids: string[]
|
||||
ids: string[],
|
||||
): Promise<ListResponse<OrganizationUserBulkResponse>>;
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@ export class OrganizationApiServiceAbstraction {
|
||||
upgrade: (id: string, request: OrganizationUpgradeRequest) => Promise<PaymentResponse>;
|
||||
updatePasswordManagerSeats: (
|
||||
id: string,
|
||||
request: OrganizationSubscriptionUpdateRequest
|
||||
request: OrganizationSubscriptionUpdateRequest,
|
||||
) => Promise<void>;
|
||||
updateSecretsManagerSubscription: (
|
||||
id: string,
|
||||
request: OrganizationSmSubscriptionUpdateRequest
|
||||
request: OrganizationSmSubscriptionUpdateRequest,
|
||||
) => Promise<void>;
|
||||
updateSeats: (id: string, request: SeatRequest) => Promise<PaymentResponse>;
|
||||
updateStorage: (id: string, request: StorageRequest) => Promise<PaymentResponse>;
|
||||
@@ -60,7 +60,7 @@ export class OrganizationApiServiceAbstraction {
|
||||
getOrCreateApiKey: (id: string, request: OrganizationApiKeyRequest) => Promise<ApiKeyResponse>;
|
||||
getApiKeyInformation: (
|
||||
id: string,
|
||||
organizationApiKeyType?: OrganizationApiKeyType
|
||||
organizationApiKeyType?: OrganizationApiKeyType,
|
||||
) => Promise<ListResponse<OrganizationApiKeyInformationResponse>>;
|
||||
rotateApiKey: (id: string, request: OrganizationApiKeyRequest) => Promise<ApiKeyResponse>;
|
||||
getTaxInfo: (id: string) => Promise<TaxInfoResponse>;
|
||||
@@ -72,10 +72,10 @@ export class OrganizationApiServiceAbstraction {
|
||||
selfHostedSyncLicense: (id: string) => Promise<void>;
|
||||
subscribeToSecretsManager: (
|
||||
id: string,
|
||||
request: SecretsManagerSubscribeRequest
|
||||
request: SecretsManagerSubscribeRequest,
|
||||
) => Promise<ProfileOrganizationResponse>;
|
||||
updateCollectionManagement: (
|
||||
id: string,
|
||||
request: OrganizationCollectionManagementUpdateRequest
|
||||
request: OrganizationCollectionManagementUpdateRequest,
|
||||
) => Promise<OrganizationResponse>;
|
||||
}
|
||||
|
||||
@@ -53,13 +53,15 @@ export function getOrganizationById(id: string) {
|
||||
|
||||
export function canAccessAdmin(i18nService: I18nService) {
|
||||
return map<Organization[], Organization[]>((orgs) =>
|
||||
orgs.filter(canAccessOrgAdmin).sort(Utils.getSortFunction(i18nService, "name"))
|
||||
orgs.filter(canAccessOrgAdmin).sort(Utils.getSortFunction(i18nService, "name")),
|
||||
);
|
||||
}
|
||||
|
||||
export function canAccessImportExport(i18nService: I18nService) {
|
||||
return map<Organization[], Organization[]>((orgs) =>
|
||||
orgs.filter((org) => org.canAccessImportExport).sort(Utils.getSortFunction(i18nService, "name"))
|
||||
orgs
|
||||
.filter((org) => org.canAccessImportExport)
|
||||
.sort(Utils.getSortFunction(i18nService, "name")),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ export class PolicyApiServiceAbstraction {
|
||||
organizationId: string,
|
||||
token: string,
|
||||
email: string,
|
||||
organizationUserId: string
|
||||
organizationUserId: string,
|
||||
) => Promise<ListResponse<PolicyResponse>>;
|
||||
|
||||
getMasterPasswordPolicyOptsForOrgUser: (orgId: string) => Promise<MasterPasswordPolicyOptions>;
|
||||
|
||||
@@ -38,7 +38,7 @@ export abstract class PolicyService {
|
||||
*/
|
||||
policyAppliesToActiveUser$: (
|
||||
policyType: PolicyType,
|
||||
policyFilter?: (policy: Policy) => boolean
|
||||
policyFilter?: (policy: Policy) => boolean,
|
||||
) => Observable<boolean>;
|
||||
|
||||
/**
|
||||
@@ -49,7 +49,7 @@ export abstract class PolicyService {
|
||||
policyAppliesToUser: (
|
||||
policyType: PolicyType,
|
||||
policyFilter?: (policy: Policy) => boolean,
|
||||
userId?: string
|
||||
userId?: string,
|
||||
) => Promise<boolean>;
|
||||
|
||||
// Policy specific interfaces
|
||||
@@ -67,7 +67,7 @@ export abstract class PolicyService {
|
||||
evaluateMasterPassword: (
|
||||
passwordStrength: number,
|
||||
newPassword: string,
|
||||
enforcedPolicyOptions?: MasterPasswordPolicyOptions
|
||||
enforcedPolicyOptions?: MasterPasswordPolicyOptions,
|
||||
) => boolean;
|
||||
|
||||
/**
|
||||
@@ -76,7 +76,7 @@ export abstract class PolicyService {
|
||||
*/
|
||||
getResetPasswordPolicyOptions: (
|
||||
policies: Policy[],
|
||||
orgId: string
|
||||
orgId: string,
|
||||
) => [ResetPasswordPolicyOptions, boolean];
|
||||
|
||||
// Helpers
|
||||
|
||||
@@ -56,7 +56,7 @@ export class OrganizationData {
|
||||
options: {
|
||||
isMember: boolean;
|
||||
isProviderUser: boolean;
|
||||
}
|
||||
},
|
||||
) {
|
||||
this.id = response.id;
|
||||
this.name = response.name;
|
||||
|
||||
@@ -37,7 +37,10 @@ export class EncryptedOrganizationKey implements BaseEncryptedOrganizationKey {
|
||||
}
|
||||
|
||||
export class ProviderEncryptedOrganizationKey implements BaseEncryptedOrganizationKey {
|
||||
constructor(private key: string, private providerId: string) {}
|
||||
constructor(
|
||||
private key: string,
|
||||
private providerId: string,
|
||||
) {}
|
||||
|
||||
async decrypt(cryptoService: CryptoService) {
|
||||
const providerKey = await cryptoService.getProviderKey(this.providerId);
|
||||
|
||||
@@ -11,6 +11,6 @@ export class OrganizationConnectionRequest {
|
||||
public organizationId: string,
|
||||
public type: OrganizationConnectionType,
|
||||
public enabled: boolean,
|
||||
public config: OrganizationConnectionRequestConfigs
|
||||
public config: OrganizationConnectionRequestConfigs,
|
||||
) {}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@ import { OrganizationCreateRequest } from "../../../models/request/organization-
|
||||
export class ProviderOrganizationCreateRequest {
|
||||
constructor(
|
||||
public clientOwnerEmail: string,
|
||||
public organizationCreateRequest: OrganizationCreateRequest
|
||||
public organizationCreateRequest: OrganizationCreateRequest,
|
||||
) {}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { ScimProviderType } from "../../enums";
|
||||
|
||||
export class ScimConfigRequest {
|
||||
constructor(private enabled: boolean, private scimProvider: ScimProviderType = null) {}
|
||||
constructor(
|
||||
private enabled: boolean,
|
||||
private scimProvider: ScimProviderType = null,
|
||||
) {}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import { ScimConfigApi } from "../api/scim-config.api";
|
||||
export type OrganizationConnectionConfigApis = BillingSyncConfigApi | ScimConfigApi;
|
||||
|
||||
export class OrganizationConnectionResponse<
|
||||
TConfig extends OrganizationConnectionConfigApis
|
||||
TConfig extends OrganizationConnectionConfigApis,
|
||||
> extends BaseResponse {
|
||||
id: string;
|
||||
type: OrganizationConnectionType;
|
||||
|
||||
@@ -70,10 +70,10 @@ export class OrganizationResponse extends BaseResponse {
|
||||
this.maxAutoscaleSmSeats = this.getResponseProperty("MaxAutoscaleSmSeats");
|
||||
this.maxAutoscaleSmServiceAccounts = this.getResponseProperty("MaxAutoscaleSmServiceAccounts");
|
||||
this.limitCollectionCreationDeletion = this.getResponseProperty(
|
||||
"LimitCollectionCreationDeletion"
|
||||
"LimitCollectionCreationDeletion",
|
||||
);
|
||||
this.allowAdminAccessToAllCollectionItems = this.getResponseProperty(
|
||||
"AllowAdminAccessToAllCollectionItems"
|
||||
"AllowAdminAccessToAllCollectionItems",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,13 +94,13 @@ export class ProfileOrganizationResponse extends BaseResponse {
|
||||
this.keyConnectorEnabled = this.getResponseProperty("KeyConnectorEnabled") ?? false;
|
||||
this.keyConnectorUrl = this.getResponseProperty("KeyConnectorUrl");
|
||||
const familySponsorshipLastSyncDateString = this.getResponseProperty(
|
||||
"FamilySponsorshipLastSyncDate"
|
||||
"FamilySponsorshipLastSyncDate",
|
||||
);
|
||||
if (familySponsorshipLastSyncDateString) {
|
||||
this.familySponsorshipLastSyncDate = new Date(familySponsorshipLastSyncDateString);
|
||||
}
|
||||
const familySponsorshipValidUntilString = this.getResponseProperty(
|
||||
"FamilySponsorshipValidUntil"
|
||||
"FamilySponsorshipValidUntil",
|
||||
);
|
||||
if (familySponsorshipValidUntilString) {
|
||||
this.familySponsorshipValidUntil = new Date(familySponsorshipValidUntilString);
|
||||
@@ -108,10 +108,10 @@ export class ProfileOrganizationResponse extends BaseResponse {
|
||||
this.familySponsorshipToDelete = this.getResponseProperty("FamilySponsorshipToDelete");
|
||||
this.accessSecretsManager = this.getResponseProperty("AccessSecretsManager");
|
||||
this.limitCollectionCreationDeletion = this.getResponseProperty(
|
||||
"LimitCollectionCreationDeletion"
|
||||
"LimitCollectionCreationDeletion",
|
||||
);
|
||||
this.allowAdminAccessToAllCollectionItems = this.getResponseProperty(
|
||||
"AllowAdminAccessToAllCollectionItems"
|
||||
"AllowAdminAccessToAllCollectionItems",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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