mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-29 12:55:21 +01:00
[EC-376] Extract API logic from PolicyService to PolicyApiService (#3203)
* Added abstractions for PolicyApiService and PolicyService * Added implementations for PolicyApiService and PolicyService * Updated all references to new PolicyApiService and PolicyService * Deleted old PolicyService abstraction and implementation * Fixed CLI import path for policy.service * Fixed main.background.ts policyApiService dependency for policyService * Updated policy-api.service with the correct imports * [EC-376] Sorted methods order in PolicyApiService * [EC-376] Removed unused clearCache method from PolicyService * [EC-376] Added upsert method to PolicyService * [EC-376] PolicyApiService putPolicy method now upserts data to PolicyService
This commit is contained in:
parent
5f13c4722f
commit
c263eacd88
@ -20,7 +20,8 @@ import { NotificationsService as NotificationsServiceAbstraction } from "@bitwar
|
|||||||
import { OrganizationService as OrganizationServiceAbstraction } from "@bitwarden/common/abstractions/organization.service";
|
import { OrganizationService as OrganizationServiceAbstraction } from "@bitwarden/common/abstractions/organization.service";
|
||||||
import { PasswordGenerationService as PasswordGenerationServiceAbstraction } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService as PasswordGenerationServiceAbstraction } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService as PlatformUtilsServiceAbstraction } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService as PlatformUtilsServiceAbstraction } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService as PolicyServiceAbstraction } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyApiServiceAbstraction } from "@bitwarden/common/abstractions/policy/policy-api.service.abstraction";
|
||||||
|
import { InternalPolicyService as InternalPolicyServiceAbstraction } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { ProviderService as ProviderServiceAbstraction } from "@bitwarden/common/abstractions/provider.service";
|
import { ProviderService as ProviderServiceAbstraction } from "@bitwarden/common/abstractions/provider.service";
|
||||||
import { SearchService as SearchServiceAbstraction } from "@bitwarden/common/abstractions/search.service";
|
import { SearchService as SearchServiceAbstraction } from "@bitwarden/common/abstractions/search.service";
|
||||||
import { SendService as SendServiceAbstraction } from "@bitwarden/common/abstractions/send.service";
|
import { SendService as SendServiceAbstraction } from "@bitwarden/common/abstractions/send.service";
|
||||||
@ -60,7 +61,8 @@ import { MemoryStorageService } from "@bitwarden/common/services/memoryStorage.s
|
|||||||
import { NotificationsService } from "@bitwarden/common/services/notifications.service";
|
import { NotificationsService } from "@bitwarden/common/services/notifications.service";
|
||||||
import { OrganizationService } from "@bitwarden/common/services/organization.service";
|
import { OrganizationService } from "@bitwarden/common/services/organization.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/services/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/services/passwordGeneration.service";
|
||||||
import { PolicyService } from "@bitwarden/common/services/policy.service";
|
import { PolicyApiService } from "@bitwarden/common/services/policy/policy-api.service";
|
||||||
|
import { PolicyService } from "@bitwarden/common/services/policy/policy.service";
|
||||||
import { ProviderService } from "@bitwarden/common/services/provider.service";
|
import { ProviderService } from "@bitwarden/common/services/provider.service";
|
||||||
import { SearchService } from "@bitwarden/common/services/search.service";
|
import { SearchService } from "@bitwarden/common/services/search.service";
|
||||||
import { SendService } from "@bitwarden/common/services/send.service";
|
import { SendService } from "@bitwarden/common/services/send.service";
|
||||||
@ -137,7 +139,7 @@ export default class MainBackground {
|
|||||||
stateMigrationService: StateMigrationService;
|
stateMigrationService: StateMigrationService;
|
||||||
systemService: SystemServiceAbstraction;
|
systemService: SystemServiceAbstraction;
|
||||||
eventService: EventServiceAbstraction;
|
eventService: EventServiceAbstraction;
|
||||||
policyService: PolicyServiceAbstraction;
|
policyService: InternalPolicyServiceAbstraction;
|
||||||
popupUtilsService: PopupUtilsService;
|
popupUtilsService: PopupUtilsService;
|
||||||
sendService: SendServiceAbstraction;
|
sendService: SendServiceAbstraction;
|
||||||
fileUploadService: FileUploadServiceAbstraction;
|
fileUploadService: FileUploadServiceAbstraction;
|
||||||
@ -150,6 +152,7 @@ export default class MainBackground {
|
|||||||
usernameGenerationService: UsernameGenerationServiceAbstraction;
|
usernameGenerationService: UsernameGenerationServiceAbstraction;
|
||||||
encryptService: EncryptService;
|
encryptService: EncryptService;
|
||||||
folderApiService: FolderApiServiceAbstraction;
|
folderApiService: FolderApiServiceAbstraction;
|
||||||
|
policyApiService: PolicyApiServiceAbstraction;
|
||||||
|
|
||||||
// Passed to the popup for Safari to workaround issues with theming, downloading, etc.
|
// Passed to the popup for Safari to workaround issues with theming, downloading, etc.
|
||||||
backgroundWindow = window;
|
backgroundWindow = window;
|
||||||
@ -292,10 +295,12 @@ export default class MainBackground {
|
|||||||
this.stateService
|
this.stateService
|
||||||
);
|
);
|
||||||
this.organizationService = new OrganizationService(this.stateService);
|
this.organizationService = new OrganizationService(this.stateService);
|
||||||
this.policyService = new PolicyService(
|
this.policyService = new PolicyService(this.stateService, this.organizationService);
|
||||||
|
this.policyApiService = new PolicyApiService(
|
||||||
|
this.policyService,
|
||||||
|
this.apiService,
|
||||||
this.stateService,
|
this.stateService,
|
||||||
this.organizationService,
|
this.organizationService
|
||||||
this.apiService
|
|
||||||
);
|
);
|
||||||
this.keyConnectorService = new KeyConnectorService(
|
this.keyConnectorService = new KeyConnectorService(
|
||||||
this.stateService,
|
this.stateService,
|
||||||
|
@ -3,7 +3,7 @@ import { firstValueFrom } from "rxjs";
|
|||||||
import { AuthService } from "@bitwarden/common/abstractions/auth.service";
|
import { AuthService } from "@bitwarden/common/abstractions/auth.service";
|
||||||
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
||||||
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { AuthenticationStatus } from "@bitwarden/common/enums/authenticationStatus";
|
import { AuthenticationStatus } from "@bitwarden/common/enums/authenticationStatus";
|
||||||
import { CipherType } from "@bitwarden/common/enums/cipherType";
|
import { CipherType } from "@bitwarden/common/enums/cipherType";
|
||||||
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
||||||
|
@ -8,7 +8,8 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|||||||
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyApiServiceAbstraction } from "@bitwarden/common/abstractions/policy/policy-api.service.abstraction";
|
||||||
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
||||||
|
|
||||||
@ -25,6 +26,7 @@ export class SetPasswordComponent extends BaseSetPasswordComponent {
|
|||||||
stateService: StateService,
|
stateService: StateService,
|
||||||
passwordGenerationService: PasswordGenerationService,
|
passwordGenerationService: PasswordGenerationService,
|
||||||
platformUtilsService: PlatformUtilsService,
|
platformUtilsService: PlatformUtilsService,
|
||||||
|
policyApiService: PolicyApiServiceAbstraction,
|
||||||
policyService: PolicyService,
|
policyService: PolicyService,
|
||||||
router: Router,
|
router: Router,
|
||||||
syncService: SyncService,
|
syncService: SyncService,
|
||||||
@ -36,6 +38,7 @@ export class SetPasswordComponent extends BaseSetPasswordComponent {
|
|||||||
messagingService,
|
messagingService,
|
||||||
passwordGenerationService,
|
passwordGenerationService,
|
||||||
platformUtilsService,
|
platformUtilsService,
|
||||||
|
policyApiService,
|
||||||
policyService,
|
policyService,
|
||||||
router,
|
router,
|
||||||
apiService,
|
apiService,
|
||||||
|
@ -8,7 +8,7 @@ import { LogService } from "@bitwarden/common/abstractions/log.service";
|
|||||||
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { SendService } from "@bitwarden/common/abstractions/send.service";
|
import { SendService } from "@bitwarden/common/abstractions/send.service";
|
||||||
|
|
||||||
import { StateService } from "../../services/abstractions/state.service";
|
import { StateService } from "../../services/abstractions/state.service";
|
||||||
|
@ -7,7 +7,7 @@ import { EnvironmentService } from "@bitwarden/common/abstractions/environment.s
|
|||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { SearchService } from "@bitwarden/common/abstractions/search.service";
|
import { SearchService } from "@bitwarden/common/abstractions/search.service";
|
||||||
import { SendService } from "@bitwarden/common/abstractions/send.service";
|
import { SendService } from "@bitwarden/common/abstractions/send.service";
|
||||||
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
||||||
|
@ -9,7 +9,7 @@ import { EnvironmentService } from "@bitwarden/common/abstractions/environment.s
|
|||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { SearchService } from "@bitwarden/common/abstractions/search.service";
|
import { SearchService } from "@bitwarden/common/abstractions/search.service";
|
||||||
import { SendService } from "@bitwarden/common/abstractions/send.service";
|
import { SendService } from "@bitwarden/common/abstractions/send.service";
|
||||||
import { SendType } from "@bitwarden/common/enums/sendType";
|
import { SendType } from "@bitwarden/common/enums/sendType";
|
||||||
|
@ -33,7 +33,8 @@ import { OrganizationService } from "@bitwarden/common/abstractions/organization
|
|||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyApiServiceAbstraction } from "@bitwarden/common/abstractions/policy/policy-api.service.abstraction";
|
||||||
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { ProviderService } from "@bitwarden/common/abstractions/provider.service";
|
import { ProviderService } from "@bitwarden/common/abstractions/provider.service";
|
||||||
import { SearchService as SearchServiceAbstraction } from "@bitwarden/common/abstractions/search.service";
|
import { SearchService as SearchServiceAbstraction } from "@bitwarden/common/abstractions/search.service";
|
||||||
import { SendService } from "@bitwarden/common/abstractions/send.service";
|
import { SendService } from "@bitwarden/common/abstractions/send.service";
|
||||||
@ -181,7 +182,16 @@ function getBgService<T>(service: keyof MainBackground) {
|
|||||||
{ provide: I18nService, useFactory: getBgService<I18nService>("i18nService"), deps: [] },
|
{ provide: I18nService, useFactory: getBgService<I18nService>("i18nService"), deps: [] },
|
||||||
{ provide: CryptoService, useFactory: getBgService<CryptoService>("cryptoService"), deps: [] },
|
{ provide: CryptoService, useFactory: getBgService<CryptoService>("cryptoService"), deps: [] },
|
||||||
{ provide: EventService, useFactory: getBgService<EventService>("eventService"), deps: [] },
|
{ provide: EventService, useFactory: getBgService<EventService>("eventService"), deps: [] },
|
||||||
{ provide: PolicyService, useFactory: getBgService<PolicyService>("policyService"), deps: [] },
|
{
|
||||||
|
provide: PolicyService,
|
||||||
|
useFactory: getBgService<PolicyService>("policyService"),
|
||||||
|
deps: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provide: PolicyApiServiceAbstraction,
|
||||||
|
useFactory: getBgService<PolicyApiServiceAbstraction>("policyApiService"),
|
||||||
|
deps: [],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
provide: PlatformUtilsService,
|
provide: PlatformUtilsService,
|
||||||
useFactory: getBgService<PlatformUtilsService>("platformUtilsService"),
|
useFactory: getBgService<PlatformUtilsService>("platformUtilsService"),
|
||||||
|
@ -10,7 +10,7 @@ import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload
|
|||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification.service";
|
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -15,7 +15,7 @@ import { MessagingService } from "@bitwarden/common/abstractions/messaging.servi
|
|||||||
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
||||||
import { PasswordRepromptService } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
import { PasswordRepromptService } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { CipherType } from "@bitwarden/common/enums/cipherType";
|
import { CipherType } from "@bitwarden/common/enums/cipherType";
|
||||||
import { LoginUriView } from "@bitwarden/common/models/view/loginUriView";
|
import { LoginUriView } from "@bitwarden/common/models/view/loginUriView";
|
||||||
|
@ -4,7 +4,7 @@ import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
|||||||
import { CollectionService } from "@bitwarden/common/abstractions/collection.service";
|
import { CollectionService } from "@bitwarden/common/abstractions/collection.service";
|
||||||
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
||||||
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { CipherView } from "@bitwarden/common/models/view/cipherView";
|
import { CipherView } from "@bitwarden/common/models/view/cipherView";
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ import { MemoryStorageService } from "@bitwarden/common/services/memoryStorage.s
|
|||||||
import { NoopMessagingService } from "@bitwarden/common/services/noopMessaging.service";
|
import { NoopMessagingService } from "@bitwarden/common/services/noopMessaging.service";
|
||||||
import { OrganizationService } from "@bitwarden/common/services/organization.service";
|
import { OrganizationService } from "@bitwarden/common/services/organization.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/services/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/services/passwordGeneration.service";
|
||||||
import { PolicyService } from "@bitwarden/common/services/policy.service";
|
import { PolicyService } from "@bitwarden/common/services/policy/policy.service";
|
||||||
import { ProviderService } from "@bitwarden/common/services/provider.service";
|
import { ProviderService } from "@bitwarden/common/services/provider.service";
|
||||||
import { SearchService } from "@bitwarden/common/services/search.service";
|
import { SearchService } from "@bitwarden/common/services/search.service";
|
||||||
import { SendService } from "@bitwarden/common/services/send.service";
|
import { SendService } from "@bitwarden/common/services/send.service";
|
||||||
@ -223,11 +223,7 @@ export class Main {
|
|||||||
|
|
||||||
this.organizationService = new OrganizationService(this.stateService);
|
this.organizationService = new OrganizationService(this.stateService);
|
||||||
|
|
||||||
this.policyService = new PolicyService(
|
this.policyService = new PolicyService(this.stateService, this.organizationService);
|
||||||
this.stateService,
|
|
||||||
this.organizationService,
|
|
||||||
this.apiService
|
|
||||||
);
|
|
||||||
|
|
||||||
this.sendService = new SendService(
|
this.sendService = new SendService(
|
||||||
this.cryptoService,
|
this.cryptoService,
|
||||||
|
@ -2,7 +2,7 @@ import * as program from "commander";
|
|||||||
import * as inquirer from "inquirer";
|
import * as inquirer from "inquirer";
|
||||||
|
|
||||||
import { ExportFormat, ExportService } from "@bitwarden/common/abstractions/export.service";
|
import { ExportFormat, ExportService } from "@bitwarden/common/abstractions/export.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
||||||
import { Utils } from "@bitwarden/common/misc/utils";
|
import { Utils } from "@bitwarden/common/misc/utils";
|
||||||
import { Response } from "@bitwarden/node/cli/models/response";
|
import { Response } from "@bitwarden/node/cli/models/response";
|
||||||
|
@ -9,7 +9,7 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|||||||
import { KeyConnectorService } from "@bitwarden/common/abstractions/keyConnector.service";
|
import { KeyConnectorService } from "@bitwarden/common/abstractions/keyConnector.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
||||||
import { TwoFactorService } from "@bitwarden/common/abstractions/twoFactor.service";
|
import { TwoFactorService } from "@bitwarden/common/abstractions/twoFactor.service";
|
||||||
|
@ -9,7 +9,8 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|||||||
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyApiServiceAbstraction } from "@bitwarden/common/abstractions/policy/policy-api.service.abstraction";
|
||||||
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
||||||
|
|
||||||
@ -27,6 +28,7 @@ export class SetPasswordComponent extends BaseSetPasswordComponent implements On
|
|||||||
messagingService: MessagingService,
|
messagingService: MessagingService,
|
||||||
passwordGenerationService: PasswordGenerationService,
|
passwordGenerationService: PasswordGenerationService,
|
||||||
platformUtilsService: PlatformUtilsService,
|
platformUtilsService: PlatformUtilsService,
|
||||||
|
policyApiService: PolicyApiServiceAbstraction,
|
||||||
policyService: PolicyService,
|
policyService: PolicyService,
|
||||||
router: Router,
|
router: Router,
|
||||||
syncService: SyncService,
|
syncService: SyncService,
|
||||||
@ -41,6 +43,7 @@ export class SetPasswordComponent extends BaseSetPasswordComponent implements On
|
|||||||
messagingService,
|
messagingService,
|
||||||
passwordGenerationService,
|
passwordGenerationService,
|
||||||
platformUtilsService,
|
platformUtilsService,
|
||||||
|
policyApiService,
|
||||||
policyService,
|
policyService,
|
||||||
router,
|
router,
|
||||||
apiService,
|
apiService,
|
||||||
|
@ -8,7 +8,7 @@ import { LogService } from "@bitwarden/common/abstractions/log.service";
|
|||||||
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ import { MessagingService } from "@bitwarden/common/abstractions/messaging.servi
|
|||||||
import { NotificationsService } from "@bitwarden/common/abstractions/notifications.service";
|
import { NotificationsService } from "@bitwarden/common/abstractions/notifications.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { InternalPolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { SearchService } from "@bitwarden/common/abstractions/search.service";
|
import { SearchService } from "@bitwarden/common/abstractions/search.service";
|
||||||
import { SettingsService } from "@bitwarden/common/abstractions/settings.service";
|
import { SettingsService } from "@bitwarden/common/abstractions/settings.service";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
@ -123,7 +123,7 @@ export class AppComponent implements OnInit {
|
|||||||
private systemService: SystemService,
|
private systemService: SystemService,
|
||||||
private stateService: StateService,
|
private stateService: StateService,
|
||||||
private eventService: EventService,
|
private eventService: EventService,
|
||||||
private policyService: PolicyService,
|
private policyService: InternalPolicyService,
|
||||||
private modalService: ModalService,
|
private modalService: ModalService,
|
||||||
private keyConnectorService: KeyConnectorService
|
private keyConnectorService: KeyConnectorService
|
||||||
) {}
|
) {}
|
||||||
|
@ -7,7 +7,7 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { SendService } from "@bitwarden/common/abstractions/send.service";
|
import { SendService } from "@bitwarden/common/abstractions/send.service";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import { EnvironmentService } from "@bitwarden/common/abstractions/environment.s
|
|||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { SearchService } from "@bitwarden/common/abstractions/search.service";
|
import { SearchService } from "@bitwarden/common/abstractions/search.service";
|
||||||
import { SendService } from "@bitwarden/common/abstractions/send.service";
|
import { SendService } from "@bitwarden/common/abstractions/send.service";
|
||||||
import { SendView } from "@bitwarden/common/models/view/sendView";
|
import { SendView } from "@bitwarden/common/models/view/sendView";
|
||||||
|
@ -14,7 +14,7 @@ import { MessagingService } from "@bitwarden/common/abstractions/messaging.servi
|
|||||||
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
||||||
import { PasswordRepromptService } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
import { PasswordRepromptService } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
|
|
||||||
const BroadcasterSubscriptionId = "AddEditComponent";
|
const BroadcasterSubscriptionId = "AddEditComponent";
|
||||||
|
@ -12,7 +12,7 @@ import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload
|
|||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification.service";
|
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification.service";
|
||||||
|
|
||||||
const BroadcasterSubscriptionId = "ExportComponent";
|
const BroadcasterSubscriptionId = "ExportComponent";
|
||||||
|
@ -6,7 +6,8 @@ import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
|
|||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyApiServiceAbstraction } from "@bitwarden/common/abstractions/policy/policy-api.service.abstraction";
|
||||||
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { Utils } from "@bitwarden/common/misc/utils";
|
import { Utils } from "@bitwarden/common/misc/utils";
|
||||||
import { Policy } from "@bitwarden/common/models/domain/policy";
|
import { Policy } from "@bitwarden/common/models/domain/policy";
|
||||||
@ -31,6 +32,7 @@ export class AcceptOrganizationComponent extends BaseAcceptComponent {
|
|||||||
private apiService: ApiService,
|
private apiService: ApiService,
|
||||||
stateService: StateService,
|
stateService: StateService,
|
||||||
private cryptoService: CryptoService,
|
private cryptoService: CryptoService,
|
||||||
|
private policyApiService: PolicyApiServiceAbstraction,
|
||||||
private policyService: PolicyService,
|
private policyService: PolicyService,
|
||||||
private logService: LogService
|
private logService: LogService
|
||||||
) {
|
) {
|
||||||
@ -93,7 +95,7 @@ export class AcceptOrganizationComponent extends BaseAcceptComponent {
|
|||||||
private async performResetPasswordAutoEnroll(qParams: any): Promise<boolean> {
|
private async performResetPasswordAutoEnroll(qParams: any): Promise<boolean> {
|
||||||
let policyList: Policy[] = null;
|
let policyList: Policy[] = null;
|
||||||
try {
|
try {
|
||||||
const policies = await this.apiService.getPoliciesByToken(
|
const policies = await this.policyApiService.getPoliciesByToken(
|
||||||
qParams.organizationId,
|
qParams.organizationId,
|
||||||
qParams.token,
|
qParams.token,
|
||||||
qParams.email,
|
qParams.email,
|
||||||
|
@ -12,7 +12,8 @@ import { LogService } from "@bitwarden/common/abstractions/log.service";
|
|||||||
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyApiServiceAbstraction } from "@bitwarden/common/abstractions/policy/policy-api.service.abstraction";
|
||||||
|
import { InternalPolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { PolicyData } from "@bitwarden/common/models/data/policyData";
|
import { PolicyData } from "@bitwarden/common/models/data/policyData";
|
||||||
import { MasterPasswordPolicyOptions } from "@bitwarden/common/models/domain/masterPasswordPolicyOptions";
|
import { MasterPasswordPolicyOptions } from "@bitwarden/common/models/domain/masterPasswordPolicyOptions";
|
||||||
import { Policy } from "@bitwarden/common/models/domain/policy";
|
import { Policy } from "@bitwarden/common/models/domain/policy";
|
||||||
@ -40,7 +41,8 @@ export class LoginComponent extends BaseLoginComponent {
|
|||||||
passwordGenerationService: PasswordGenerationService,
|
passwordGenerationService: PasswordGenerationService,
|
||||||
cryptoFunctionService: CryptoFunctionService,
|
cryptoFunctionService: CryptoFunctionService,
|
||||||
private apiService: ApiService,
|
private apiService: ApiService,
|
||||||
private policyService: PolicyService,
|
private policyApiService: PolicyApiServiceAbstraction,
|
||||||
|
private policyService: InternalPolicyService,
|
||||||
logService: LogService,
|
logService: LogService,
|
||||||
ngZone: NgZone,
|
ngZone: NgZone,
|
||||||
protected stateService: StateService,
|
protected stateService: StateService,
|
||||||
@ -94,7 +96,7 @@ export class LoginComponent extends BaseLoginComponent {
|
|||||||
if (invite != null) {
|
if (invite != null) {
|
||||||
let policyList: Policy[] = null;
|
let policyList: Policy[] = null;
|
||||||
try {
|
try {
|
||||||
this.policies = await this.apiService.getPoliciesByToken(
|
this.policies = await this.policyApiService.getPoliciesByToken(
|
||||||
invite.organizationId,
|
invite.organizationId,
|
||||||
invite.token,
|
invite.token,
|
||||||
invite.email,
|
invite.email,
|
||||||
|
@ -13,7 +13,8 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyApiServiceAbstraction } from "@bitwarden/common/abstractions/policy/policy-api.service.abstraction";
|
||||||
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { PolicyData } from "@bitwarden/common/models/data/policyData";
|
import { PolicyData } from "@bitwarden/common/models/data/policyData";
|
||||||
import { MasterPasswordPolicyOptions } from "@bitwarden/common/models/domain/masterPasswordPolicyOptions";
|
import { MasterPasswordPolicyOptions } from "@bitwarden/common/models/domain/masterPasswordPolicyOptions";
|
||||||
@ -46,6 +47,7 @@ export class RegisterComponent extends BaseRegisterComponent {
|
|||||||
stateService: StateService,
|
stateService: StateService,
|
||||||
platformUtilsService: PlatformUtilsService,
|
platformUtilsService: PlatformUtilsService,
|
||||||
passwordGenerationService: PasswordGenerationService,
|
passwordGenerationService: PasswordGenerationService,
|
||||||
|
private policyApiService: PolicyApiServiceAbstraction,
|
||||||
private policyService: PolicyService,
|
private policyService: PolicyService,
|
||||||
environmentService: EnvironmentService,
|
environmentService: EnvironmentService,
|
||||||
logService: LogService,
|
logService: LogService,
|
||||||
@ -110,7 +112,7 @@ export class RegisterComponent extends BaseRegisterComponent {
|
|||||||
const invite = await this.stateService.getOrganizationInvitation();
|
const invite = await this.stateService.getOrganizationInvitation();
|
||||||
if (invite != null) {
|
if (invite != null) {
|
||||||
try {
|
try {
|
||||||
const policies = await this.apiService.getPoliciesByToken(
|
const policies = await this.policyApiService.getPoliciesByToken(
|
||||||
invite.organizationId,
|
invite.organizationId,
|
||||||
invite.token,
|
invite.token,
|
||||||
invite.email,
|
invite.email,
|
||||||
|
@ -8,7 +8,8 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|||||||
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyApiServiceAbstraction } from "@bitwarden/common/abstractions/policy/policy-api.service.abstraction";
|
||||||
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
||||||
|
|
||||||
@ -24,6 +25,7 @@ export class SetPasswordComponent extends BaseSetPasswordComponent {
|
|||||||
messagingService: MessagingService,
|
messagingService: MessagingService,
|
||||||
passwordGenerationService: PasswordGenerationService,
|
passwordGenerationService: PasswordGenerationService,
|
||||||
platformUtilsService: PlatformUtilsService,
|
platformUtilsService: PlatformUtilsService,
|
||||||
|
policyApiService: PolicyApiServiceAbstraction,
|
||||||
policyService: PolicyService,
|
policyService: PolicyService,
|
||||||
router: Router,
|
router: Router,
|
||||||
syncService: SyncService,
|
syncService: SyncService,
|
||||||
@ -36,6 +38,7 @@ export class SetPasswordComponent extends BaseSetPasswordComponent {
|
|||||||
messagingService,
|
messagingService,
|
||||||
passwordGenerationService,
|
passwordGenerationService,
|
||||||
platformUtilsService,
|
platformUtilsService,
|
||||||
|
policyApiService,
|
||||||
policyService,
|
policyService,
|
||||||
router,
|
router,
|
||||||
apiService,
|
apiService,
|
||||||
|
@ -9,7 +9,7 @@ import { LogService } from "@bitwarden/common/abstractions/log.service";
|
|||||||
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification.service";
|
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification.service";
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import { LogService } from "@bitwarden/common/abstractions/log.service";
|
|||||||
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ import { KeyConnectorService } from "@bitwarden/common/abstractions/keyConnector
|
|||||||
import { NotificationsService } from "@bitwarden/common/abstractions/notifications.service";
|
import { NotificationsService } from "@bitwarden/common/abstractions/notifications.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { InternalPolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { SearchService } from "@bitwarden/common/abstractions/search.service";
|
import { SearchService } from "@bitwarden/common/abstractions/search.service";
|
||||||
import { SettingsService } from "@bitwarden/common/abstractions/settings.service";
|
import { SettingsService } from "@bitwarden/common/abstractions/settings.service";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
@ -73,7 +73,7 @@ export class AppComponent implements OnDestroy, OnInit {
|
|||||||
private routerService: RouterService,
|
private routerService: RouterService,
|
||||||
private stateService: StateService,
|
private stateService: StateService,
|
||||||
private eventService: EventService,
|
private eventService: EventService,
|
||||||
private policyService: PolicyService,
|
private policyService: InternalPolicyService,
|
||||||
protected policyListService: PolicyListService,
|
protected policyListService: PolicyListService,
|
||||||
private keyConnectorService: KeyConnectorService
|
private keyConnectorService: KeyConnectorService
|
||||||
) {}
|
) {}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
|
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { DeviceType } from "@bitwarden/common/enums/deviceType";
|
import { DeviceType } from "@bitwarden/common/enums/deviceType";
|
||||||
import { EventType } from "@bitwarden/common/enums/eventType";
|
import { EventType } from "@bitwarden/common/enums/eventType";
|
||||||
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
||||||
|
@ -12,7 +12,7 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { MasterPasswordPolicyOptions } from "@bitwarden/common/models/domain/masterPasswordPolicyOptions";
|
import { MasterPasswordPolicyOptions } from "@bitwarden/common/models/domain/masterPasswordPolicyOptions";
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import { LogService } from "@bitwarden/common/abstractions/log.service";
|
|||||||
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
||||||
import { ProductType } from "@bitwarden/common/enums/productType";
|
import { ProductType } from "@bitwarden/common/enums/productType";
|
||||||
|
|
||||||
|
@ -5,10 +5,10 @@ import { UntypedFormBuilder, Validators } from "@angular/forms";
|
|||||||
import { ActivatedRoute, Router } from "@angular/router";
|
import { ActivatedRoute, Router } from "@angular/router";
|
||||||
import { first } from "rxjs";
|
import { first } from "rxjs";
|
||||||
|
|
||||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyApiServiceAbstraction } from "@bitwarden/common/abstractions/policy/policy-api.service.abstraction";
|
||||||
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { PlanType } from "@bitwarden/common/enums/planType";
|
import { PlanType } from "@bitwarden/common/enums/planType";
|
||||||
import { ProductType } from "@bitwarden/common/enums/productType";
|
import { ProductType } from "@bitwarden/common/enums/productType";
|
||||||
@ -48,8 +48,8 @@ export class TrialInitiationComponent implements OnInit {
|
|||||||
private formBuilder: UntypedFormBuilder,
|
private formBuilder: UntypedFormBuilder,
|
||||||
private titleCasePipe: TitleCasePipe,
|
private titleCasePipe: TitleCasePipe,
|
||||||
private stateService: StateService,
|
private stateService: StateService,
|
||||||
private apiService: ApiService,
|
|
||||||
private logService: LogService,
|
private logService: LogService,
|
||||||
|
private policyApiService: PolicyApiServiceAbstraction,
|
||||||
private policyService: PolicyService,
|
private policyService: PolicyService,
|
||||||
private i18nService: I18nService
|
private i18nService: I18nService
|
||||||
) {}
|
) {}
|
||||||
@ -88,7 +88,7 @@ export class TrialInitiationComponent implements OnInit {
|
|||||||
const invite = await this.stateService.getOrganizationInvitation();
|
const invite = await this.stateService.getOrganizationInvitation();
|
||||||
if (invite != null) {
|
if (invite != null) {
|
||||||
try {
|
try {
|
||||||
const policies = await this.apiService.getPoliciesByToken(
|
const policies = await this.policyApiService.getPoliciesByToken(
|
||||||
invite.organizationId,
|
invite.organizationId,
|
||||||
invite.token,
|
invite.token,
|
||||||
invite.email,
|
invite.email,
|
||||||
|
@ -5,7 +5,7 @@ import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
|||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
||||||
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
||||||
import { Organization } from "@bitwarden/common/models/domain/organization";
|
import { Organization } from "@bitwarden/common/models/domain/organization";
|
||||||
|
@ -9,7 +9,7 @@ import { CollectionService } from "@bitwarden/common/abstractions/collection.ser
|
|||||||
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { CollectionData } from "@bitwarden/common/models/data/collectionData";
|
import { CollectionData } from "@bitwarden/common/models/data/collectionData";
|
||||||
import { Collection } from "@bitwarden/common/models/domain/collection";
|
import { Collection } from "@bitwarden/common/models/domain/collection";
|
||||||
|
@ -12,7 +12,8 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyApiServiceAbstraction } from "@bitwarden/common/abstractions/policy/policy-api.service.abstraction";
|
||||||
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { SearchService } from "@bitwarden/common/abstractions/search.service";
|
import { SearchService } from "@bitwarden/common/abstractions/search.service";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
||||||
@ -84,6 +85,7 @@ export class PeopleComponent
|
|||||||
private router: Router,
|
private router: Router,
|
||||||
searchService: SearchService,
|
searchService: SearchService,
|
||||||
validationService: ValidationService,
|
validationService: ValidationService,
|
||||||
|
private policyApiService: PolicyApiServiceAbstraction,
|
||||||
private policyService: PolicyService,
|
private policyService: PolicyService,
|
||||||
logService: LogService,
|
logService: LogService,
|
||||||
searchPipe: SearchPipe,
|
searchPipe: SearchPipe,
|
||||||
@ -151,7 +153,7 @@ export class PeopleComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
const resetPasswordPolicy = await this.policyService.getPolicyForOrganization(
|
const resetPasswordPolicy = await this.policyApiService.getPolicyForOrganization(
|
||||||
PolicyType.ResetPassword,
|
PolicyType.ResetPassword,
|
||||||
this.organizationId
|
this.organizationId
|
||||||
);
|
);
|
||||||
|
@ -3,8 +3,8 @@ import { ActivatedRoute, Router } from "@angular/router";
|
|||||||
import { first } from "rxjs/operators";
|
import { first } from "rxjs/operators";
|
||||||
|
|
||||||
import { ModalService } from "@bitwarden/angular/services/modal.service";
|
import { ModalService } from "@bitwarden/angular/services/modal.service";
|
||||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
|
||||||
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
||||||
|
import { PolicyApiServiceAbstraction } from "@bitwarden/common/abstractions/policy/policy-api.service.abstraction";
|
||||||
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
||||||
import { Organization } from "@bitwarden/common/models/domain/organization";
|
import { Organization } from "@bitwarden/common/models/domain/organization";
|
||||||
import { PolicyResponse } from "@bitwarden/common/models/response/policyResponse";
|
import { PolicyResponse } from "@bitwarden/common/models/response/policyResponse";
|
||||||
@ -31,10 +31,10 @@ export class PoliciesComponent implements OnInit {
|
|||||||
private policiesEnabledMap: Map<PolicyType, boolean> = new Map<PolicyType, boolean>();
|
private policiesEnabledMap: Map<PolicyType, boolean> = new Map<PolicyType, boolean>();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private apiService: ApiService,
|
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private modalService: ModalService,
|
private modalService: ModalService,
|
||||||
private organizationService: OrganizationService,
|
private organizationService: OrganizationService,
|
||||||
|
private policyApiService: PolicyApiServiceAbstraction,
|
||||||
private policyListService: PolicyListService,
|
private policyListService: PolicyListService,
|
||||||
private router: Router
|
private router: Router
|
||||||
) {}
|
) {}
|
||||||
@ -73,7 +73,7 @@ export class PoliciesComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
const response = await this.apiService.getPolicies(this.organizationId);
|
const response = await this.policyApiService.getPolicies(this.organizationId);
|
||||||
this.orgPolicies = response.data != null && response.data.length > 0 ? response.data : [];
|
this.orgPolicies = response.data != null && response.data.length > 0 ? response.data : [];
|
||||||
this.orgPolicies.forEach((op) => {
|
this.orgPolicies.forEach((op) => {
|
||||||
this.policiesEnabledMap.set(op.type, op.enabled);
|
this.policiesEnabledMap.set(op.type, op.enabled);
|
||||||
|
@ -9,10 +9,10 @@ import {
|
|||||||
ViewContainerRef,
|
ViewContainerRef,
|
||||||
} from "@angular/core";
|
} from "@angular/core";
|
||||||
|
|
||||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
|
import { PolicyApiServiceAbstraction } from "@bitwarden/common/abstractions/policy/policy-api.service.abstraction";
|
||||||
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
||||||
import { PolicyRequest } from "@bitwarden/common/models/request/policyRequest";
|
import { PolicyRequest } from "@bitwarden/common/models/request/policyRequest";
|
||||||
import { PolicyResponse } from "@bitwarden/common/models/response/policyResponse";
|
import { PolicyResponse } from "@bitwarden/common/models/response/policyResponse";
|
||||||
@ -42,7 +42,7 @@ export class PolicyEditComponent {
|
|||||||
private policyResponse: PolicyResponse;
|
private policyResponse: PolicyResponse;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private apiService: ApiService,
|
private policyApiService: PolicyApiServiceAbstraction,
|
||||||
private i18nService: I18nService,
|
private i18nService: I18nService,
|
||||||
private platformUtilsService: PlatformUtilsService,
|
private platformUtilsService: PlatformUtilsService,
|
||||||
private componentFactoryResolver: ComponentFactoryResolver,
|
private componentFactoryResolver: ComponentFactoryResolver,
|
||||||
@ -65,7 +65,10 @@ export class PolicyEditComponent {
|
|||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
try {
|
try {
|
||||||
this.policyResponse = await this.apiService.getPolicy(this.organizationId, this.policy.type);
|
this.policyResponse = await this.policyApiService.getPolicy(
|
||||||
|
this.organizationId,
|
||||||
|
this.policy.type
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.statusCode === 404) {
|
if (e.statusCode === 404) {
|
||||||
this.policyResponse = new PolicyResponse({ Enabled: false });
|
this.policyResponse = new PolicyResponse({ Enabled: false });
|
||||||
@ -85,7 +88,11 @@ export class PolicyEditComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.formPromise = this.apiService.putPolicy(this.organizationId, this.policy.type, request);
|
this.formPromise = this.policyApiService.putPolicy(
|
||||||
|
this.organizationId,
|
||||||
|
this.policy.type,
|
||||||
|
request
|
||||||
|
);
|
||||||
await this.formPromise;
|
await this.formPromise;
|
||||||
this.platformUtilsService.showToast(
|
this.platformUtilsService.showToast(
|
||||||
"success",
|
"success",
|
||||||
|
@ -7,7 +7,7 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { EncString } from "@bitwarden/common/models/domain/encString";
|
import { EncString } from "@bitwarden/common/models/domain/encString";
|
||||||
import { MasterPasswordPolicyOptions } from "@bitwarden/common/models/domain/masterPasswordPolicyOptions";
|
import { MasterPasswordPolicyOptions } from "@bitwarden/common/models/domain/masterPasswordPolicyOptions";
|
||||||
import { SymmetricCryptoKey } from "@bitwarden/common/models/domain/symmetricCryptoKey";
|
import { SymmetricCryptoKey } from "@bitwarden/common/models/domain/symmetricCryptoKey";
|
||||||
|
@ -7,7 +7,7 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { TwoFactorProviderType } from "@bitwarden/common/enums/twoFactorProviderType";
|
import { TwoFactorProviderType } from "@bitwarden/common/enums/twoFactorProviderType";
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload
|
|||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification.service";
|
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification.service";
|
||||||
import { EventType } from "@bitwarden/common/enums/eventType";
|
import { EventType } from "@bitwarden/common/enums/eventType";
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import { ImportService } from "@bitwarden/common/abstractions/import.service";
|
|||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
|
|
||||||
import { ImportComponent } from "../../../tools/import-export/import.component";
|
import { ImportComponent } from "../../../tools/import-export/import.component";
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import { OrganizationService } from "@bitwarden/common/abstractions/organization
|
|||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PasswordRepromptService } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
import { PasswordRepromptService } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { TotpService } from "@bitwarden/common/abstractions/totp.service";
|
import { TotpService } from "@bitwarden/common/abstractions/totp.service";
|
||||||
import { CipherData } from "@bitwarden/common/models/data/cipherData";
|
import { CipherData } from "@bitwarden/common/models/data/cipherData";
|
||||||
|
@ -7,7 +7,7 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { SendService } from "@bitwarden/common/abstractions/send.service";
|
import { SendService } from "@bitwarden/common/abstractions/send.service";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import { EnvironmentService } from "@bitwarden/common/abstractions/environment.s
|
|||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { SearchService } from "@bitwarden/common/abstractions/search.service";
|
import { SearchService } from "@bitwarden/common/abstractions/search.service";
|
||||||
import { SendService } from "@bitwarden/common/abstractions/send.service";
|
import { SendService } from "@bitwarden/common/abstractions/send.service";
|
||||||
import { SendView } from "@bitwarden/common/models/view/sendView";
|
import { SendView } from "@bitwarden/common/models/view/sendView";
|
||||||
|
@ -13,7 +13,7 @@ import { MessagingService } from "@bitwarden/common/abstractions/messaging.servi
|
|||||||
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { SendService } from "@bitwarden/common/abstractions/send.service";
|
import { SendService } from "@bitwarden/common/abstractions/send.service";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
||||||
|
@ -8,7 +8,7 @@ import { LogService } from "@bitwarden/common/abstractions/log.service";
|
|||||||
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { KdfType } from "@bitwarden/common/enums/kdfType";
|
import { KdfType } from "@bitwarden/common/enums/kdfType";
|
||||||
import { PolicyData } from "@bitwarden/common/models/data/policyData";
|
import { PolicyData } from "@bitwarden/common/models/data/policyData";
|
||||||
|
@ -12,7 +12,7 @@ import { OrganizationService } from "@bitwarden/common/abstractions/organization
|
|||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PasswordRepromptService } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
import { PasswordRepromptService } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { TotpService } from "@bitwarden/common/abstractions/totp.service";
|
import { TotpService } from "@bitwarden/common/abstractions/totp.service";
|
||||||
import { Cipher } from "@bitwarden/common/models/domain/cipher";
|
import { Cipher } from "@bitwarden/common/models/domain/cipher";
|
||||||
|
@ -9,7 +9,7 @@ import { LogService } from "@bitwarden/common/abstractions/log.service";
|
|||||||
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
||||||
import { PaymentMethodType } from "@bitwarden/common/enums/paymentMethodType";
|
import { PaymentMethodType } from "@bitwarden/common/enums/paymentMethodType";
|
||||||
import { PlanType } from "@bitwarden/common/enums/planType";
|
import { PlanType } from "@bitwarden/common/enums/planType";
|
||||||
|
@ -7,7 +7,7 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
||||||
import { TwoFactorProviderType } from "@bitwarden/common/enums/twoFactorProviderType";
|
import { TwoFactorProviderType } from "@bitwarden/common/enums/twoFactorProviderType";
|
||||||
|
@ -9,7 +9,7 @@ import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload
|
|||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification.service";
|
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -7,7 +7,7 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|||||||
import { ImportService } from "@bitwarden/common/abstractions/import.service";
|
import { ImportService } from "@bitwarden/common/abstractions/import.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { ImportOption, ImportType } from "@bitwarden/common/enums/importOptions";
|
import { ImportOption, ImportType } from "@bitwarden/common/enums/importOptions";
|
||||||
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import { OrganizationService } from "@bitwarden/common/abstractions/organization
|
|||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PasswordRepromptService } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
import { PasswordRepromptService } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { TotpService } from "@bitwarden/common/abstractions/totp.service";
|
import { TotpService } from "@bitwarden/common/abstractions/totp.service";
|
||||||
import { CipherType } from "@bitwarden/common/enums/cipherType";
|
import { CipherType } from "@bitwarden/common/enums/cipherType";
|
||||||
|
@ -12,7 +12,7 @@ import { MessagingService } from "@bitwarden/common/abstractions/messaging.servi
|
|||||||
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
||||||
import { PasswordRepromptService } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
import { PasswordRepromptService } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { CipherRepromptType } from "@bitwarden/common/enums/cipherRepromptType";
|
import { CipherRepromptType } from "@bitwarden/common/enums/cipherRepromptType";
|
||||||
import { CipherType } from "@bitwarden/common/enums/cipherType";
|
import { CipherType } from "@bitwarden/common/enums/cipherType";
|
||||||
|
@ -5,7 +5,7 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|||||||
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { KdfType } from "@bitwarden/common/enums/kdfType";
|
import { KdfType } from "@bitwarden/common/enums/kdfType";
|
||||||
import { EncString } from "@bitwarden/common/models/domain/encString";
|
import { EncString } from "@bitwarden/common/models/domain/encString";
|
||||||
|
@ -8,7 +8,7 @@ import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload
|
|||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification.service";
|
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification.service";
|
||||||
import { EventType } from "@bitwarden/common/enums/eventType";
|
import { EventType } from "@bitwarden/common/enums/eventType";
|
||||||
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
||||||
|
@ -6,7 +6,7 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { SendService } from "@bitwarden/common/abstractions/send.service";
|
import { SendService } from "@bitwarden/common/abstractions/send.service";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
||||||
|
@ -4,7 +4,7 @@ import { EnvironmentService } from "@bitwarden/common/abstractions/environment.s
|
|||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { SearchService } from "@bitwarden/common/abstractions/search.service";
|
import { SearchService } from "@bitwarden/common/abstractions/search.service";
|
||||||
import { SendService } from "@bitwarden/common/abstractions/send.service";
|
import { SendService } from "@bitwarden/common/abstractions/send.service";
|
||||||
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
||||||
|
@ -8,7 +8,8 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|||||||
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyApiServiceAbstraction } from "@bitwarden/common/abstractions/policy/policy-api.service.abstraction";
|
||||||
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
||||||
import { HashPurpose } from "@bitwarden/common/enums/hashPurpose";
|
import { HashPurpose } from "@bitwarden/common/enums/hashPurpose";
|
||||||
@ -40,6 +41,7 @@ export class SetPasswordComponent extends BaseChangePasswordComponent {
|
|||||||
messagingService: MessagingService,
|
messagingService: MessagingService,
|
||||||
passwordGenerationService: PasswordGenerationService,
|
passwordGenerationService: PasswordGenerationService,
|
||||||
platformUtilsService: PlatformUtilsService,
|
platformUtilsService: PlatformUtilsService,
|
||||||
|
private policyApiService: PolicyApiServiceAbstraction,
|
||||||
policyService: PolicyService,
|
policyService: PolicyService,
|
||||||
protected router: Router,
|
protected router: Router,
|
||||||
private apiService: ApiService,
|
private apiService: ApiService,
|
||||||
@ -75,7 +77,7 @@ export class SetPasswordComponent extends BaseChangePasswordComponent {
|
|||||||
this.orgId = response.id;
|
this.orgId = response.id;
|
||||||
this.resetPasswordAutoEnroll = response.resetPasswordEnabled;
|
this.resetPasswordAutoEnroll = response.resetPasswordEnabled;
|
||||||
this.enforcedPolicyOptions =
|
this.enforcedPolicyOptions =
|
||||||
await this.policyService.getMasterPasswordPoliciesForInvitedUsers(this.orgId);
|
await this.policyApiService.getMasterPasswordPoliciesForInvitedUsers(this.orgId);
|
||||||
} catch {
|
} catch {
|
||||||
this.platformUtilsService.showToast("error", null, this.i18nService.t("errorOccurred"));
|
this.platformUtilsService.showToast("error", null, this.i18nService.t("errorOccurred"));
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import {
|
|||||||
} from "@angular/forms";
|
} from "@angular/forms";
|
||||||
|
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
||||||
import { Policy } from "@bitwarden/common/models/domain/policy";
|
import { Policy } from "@bitwarden/common/models/domain/policy";
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import { LogService } from "@bitwarden/common/abstractions/log.service";
|
|||||||
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification.service";
|
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification.service";
|
||||||
import { VerificationType } from "@bitwarden/common/enums/verificationType";
|
import { VerificationType } from "@bitwarden/common/enums/verificationType";
|
||||||
|
@ -7,7 +7,7 @@ import { LogService } from "@bitwarden/common/abstractions/log.service";
|
|||||||
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
import { SyncService } from "@bitwarden/common/abstractions/sync.service";
|
||||||
import { EncString } from "@bitwarden/common/models/domain/encString";
|
import { EncString } from "@bitwarden/common/models/domain/encString";
|
||||||
|
@ -5,7 +5,7 @@ import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
|||||||
import { CollectionService } from "@bitwarden/common/abstractions/collection.service";
|
import { CollectionService } from "@bitwarden/common/abstractions/collection.service";
|
||||||
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
import { FolderService } from "@bitwarden/common/abstractions/folder/folder.service.abstraction";
|
||||||
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
||||||
import { ServiceUtils } from "@bitwarden/common/misc/serviceUtils";
|
import { ServiceUtils } from "@bitwarden/common/misc/serviceUtils";
|
||||||
|
@ -33,7 +33,11 @@ import { OrganizationService as OrganizationServiceAbstraction } from "@bitwarde
|
|||||||
import { PasswordGenerationService as PasswordGenerationServiceAbstraction } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService as PasswordGenerationServiceAbstraction } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
||||||
import { PlatformUtilsService as PlatformUtilsServiceAbstraction } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService as PlatformUtilsServiceAbstraction } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService as PolicyServiceAbstraction } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyApiServiceAbstraction } from "@bitwarden/common/abstractions/policy/policy-api.service.abstraction";
|
||||||
|
import {
|
||||||
|
PolicyService as PolicyServiceAbstraction,
|
||||||
|
InternalPolicyService,
|
||||||
|
} from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { ProviderService as ProviderServiceAbstraction } from "@bitwarden/common/abstractions/provider.service";
|
import { ProviderService as ProviderServiceAbstraction } from "@bitwarden/common/abstractions/provider.service";
|
||||||
import { SearchService as SearchServiceAbstraction } from "@bitwarden/common/abstractions/search.service";
|
import { SearchService as SearchServiceAbstraction } from "@bitwarden/common/abstractions/search.service";
|
||||||
import { SendService as SendServiceAbstraction } from "@bitwarden/common/abstractions/send.service";
|
import { SendService as SendServiceAbstraction } from "@bitwarden/common/abstractions/send.service";
|
||||||
@ -73,7 +77,8 @@ import { KeyConnectorService } from "@bitwarden/common/services/keyConnector.ser
|
|||||||
import { NotificationsService } from "@bitwarden/common/services/notifications.service";
|
import { NotificationsService } from "@bitwarden/common/services/notifications.service";
|
||||||
import { OrganizationService } from "@bitwarden/common/services/organization.service";
|
import { OrganizationService } from "@bitwarden/common/services/organization.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/services/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/services/passwordGeneration.service";
|
||||||
import { PolicyService } from "@bitwarden/common/services/policy.service";
|
import { PolicyApiService } from "@bitwarden/common/services/policy/policy-api.service";
|
||||||
|
import { PolicyService } from "@bitwarden/common/services/policy/policy.service";
|
||||||
import { ProviderService } from "@bitwarden/common/services/provider.service";
|
import { ProviderService } from "@bitwarden/common/services/provider.service";
|
||||||
import { SearchService } from "@bitwarden/common/services/search.service";
|
import { SearchService } from "@bitwarden/common/services/search.service";
|
||||||
import { SendService } from "@bitwarden/common/services/send.service";
|
import { SendService } from "@bitwarden/common/services/send.service";
|
||||||
@ -426,7 +431,21 @@ export const LOG_MAC_FAILURES = new InjectionToken<string>("LOG_MAC_FAILURES");
|
|||||||
{
|
{
|
||||||
provide: PolicyServiceAbstraction,
|
provide: PolicyServiceAbstraction,
|
||||||
useClass: PolicyService,
|
useClass: PolicyService,
|
||||||
deps: [StateServiceAbstraction, OrganizationServiceAbstraction, ApiServiceAbstraction],
|
deps: [StateServiceAbstraction, OrganizationServiceAbstraction],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provide: InternalPolicyService,
|
||||||
|
useExisting: PolicyServiceAbstraction,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provide: PolicyApiServiceAbstraction,
|
||||||
|
useClass: PolicyApiService,
|
||||||
|
deps: [
|
||||||
|
PolicyServiceAbstraction,
|
||||||
|
ApiServiceAbstraction,
|
||||||
|
StateServiceAbstraction,
|
||||||
|
OrganizationServiceAbstraction,
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
provide: SendServiceAbstraction,
|
provide: SendServiceAbstraction,
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { OrganizationApiKeyType } from "../enums/organizationApiKeyType";
|
import { OrganizationApiKeyType } from "../enums/organizationApiKeyType";
|
||||||
import { OrganizationConnectionType } from "../enums/organizationConnectionType";
|
import { OrganizationConnectionType } from "../enums/organizationConnectionType";
|
||||||
import { PolicyType } from "../enums/policyType";
|
|
||||||
import { SetKeyConnectorKeyRequest } from "../models/request/account/setKeyConnectorKeyRequest";
|
import { SetKeyConnectorKeyRequest } from "../models/request/account/setKeyConnectorKeyRequest";
|
||||||
import { VerifyOTPRequest } from "../models/request/account/verifyOTPRequest";
|
import { VerifyOTPRequest } from "../models/request/account/verifyOTPRequest";
|
||||||
import { AttachmentRequest } from "../models/request/attachmentRequest";
|
import { AttachmentRequest } from "../models/request/attachmentRequest";
|
||||||
@ -59,7 +58,6 @@ import { OrganizationUserUpdateRequest } from "../models/request/organizationUse
|
|||||||
import { PasswordHintRequest } from "../models/request/passwordHintRequest";
|
import { PasswordHintRequest } from "../models/request/passwordHintRequest";
|
||||||
import { PasswordRequest } from "../models/request/passwordRequest";
|
import { PasswordRequest } from "../models/request/passwordRequest";
|
||||||
import { PaymentRequest } from "../models/request/paymentRequest";
|
import { PaymentRequest } from "../models/request/paymentRequest";
|
||||||
import { PolicyRequest } from "../models/request/policyRequest";
|
|
||||||
import { PreloginRequest } from "../models/request/preloginRequest";
|
import { PreloginRequest } from "../models/request/preloginRequest";
|
||||||
import { ProviderAddOrganizationRequest } from "../models/request/provider/providerAddOrganizationRequest";
|
import { ProviderAddOrganizationRequest } from "../models/request/provider/providerAddOrganizationRequest";
|
||||||
import { ProviderOrganizationCreateRequest } from "../models/request/provider/providerOrganizationCreateRequest";
|
import { ProviderOrganizationCreateRequest } from "../models/request/provider/providerOrganizationCreateRequest";
|
||||||
@ -366,24 +364,6 @@ export abstract class ApiService {
|
|||||||
deleteGroup: (organizationId: string, id: string) => Promise<any>;
|
deleteGroup: (organizationId: string, id: string) => Promise<any>;
|
||||||
deleteGroupUser: (organizationId: string, id: string, organizationUserId: string) => Promise<any>;
|
deleteGroupUser: (organizationId: string, id: string, organizationUserId: string) => Promise<any>;
|
||||||
|
|
||||||
getPolicy: (organizationId: string, type: PolicyType) => Promise<PolicyResponse>;
|
|
||||||
getPolicies: (organizationId: string) => Promise<ListResponse<PolicyResponse>>;
|
|
||||||
getPoliciesByToken: (
|
|
||||||
organizationId: string,
|
|
||||||
token: string,
|
|
||||||
email: string,
|
|
||||||
organizationUserId: string
|
|
||||||
) => Promise<ListResponse<PolicyResponse>>;
|
|
||||||
getPoliciesByInvitedUser: (
|
|
||||||
organizationId: string,
|
|
||||||
userId: string
|
|
||||||
) => Promise<ListResponse<PolicyResponse>>;
|
|
||||||
putPolicy: (
|
|
||||||
organizationId: string,
|
|
||||||
type: PolicyType,
|
|
||||||
request: PolicyRequest
|
|
||||||
) => Promise<PolicyResponse>;
|
|
||||||
|
|
||||||
getOrganizationUser: (
|
getOrganizationUser: (
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
id: string
|
id: string
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
||||||
|
import { MasterPasswordPolicyOptions } from "@bitwarden/common/models/domain/masterPasswordPolicyOptions";
|
||||||
|
import { Policy } from "@bitwarden/common/models/domain/policy";
|
||||||
|
import { PolicyRequest } from "@bitwarden/common/models/request/policyRequest";
|
||||||
|
import { ListResponse } from "@bitwarden/common/models/response/listResponse";
|
||||||
|
import { PolicyResponse } from "@bitwarden/common/models/response/policyResponse";
|
||||||
|
|
||||||
|
export class PolicyApiServiceAbstraction {
|
||||||
|
getPolicy: (organizationId: string, type: PolicyType) => Promise<PolicyResponse>;
|
||||||
|
getPolicies: (organizationId: string) => Promise<ListResponse<PolicyResponse>>;
|
||||||
|
getPoliciesByToken: (
|
||||||
|
organizationId: string,
|
||||||
|
token: string,
|
||||||
|
email: string,
|
||||||
|
organizationUserId: string
|
||||||
|
) => Promise<ListResponse<PolicyResponse>>;
|
||||||
|
getPoliciesByInvitedUser: (
|
||||||
|
organizationId: string,
|
||||||
|
userId: string
|
||||||
|
) => Promise<ListResponse<PolicyResponse>>;
|
||||||
|
getPolicyForOrganization: (policyType: PolicyType, organizationId: string) => Promise<Policy>;
|
||||||
|
getMasterPasswordPoliciesForInvitedUsers: (orgId: string) => Promise<MasterPasswordPolicyOptions>;
|
||||||
|
putPolicy: (organizationId: string, type: PolicyType, request: PolicyRequest) => Promise<any>;
|
||||||
|
}
|
@ -1,18 +1,14 @@
|
|||||||
import { PolicyType } from "../enums/policyType";
|
import { PolicyType } from "../../enums/policyType";
|
||||||
import { PolicyData } from "../models/data/policyData";
|
import { PolicyData } from "../../models/data/policyData";
|
||||||
import { MasterPasswordPolicyOptions } from "../models/domain/masterPasswordPolicyOptions";
|
import { MasterPasswordPolicyOptions } from "../../models/domain/masterPasswordPolicyOptions";
|
||||||
import { Policy } from "../models/domain/policy";
|
import { Policy } from "../../models/domain/policy";
|
||||||
import { ResetPasswordPolicyOptions } from "../models/domain/resetPasswordPolicyOptions";
|
import { ResetPasswordPolicyOptions } from "../../models/domain/resetPasswordPolicyOptions";
|
||||||
import { ListResponse } from "../models/response/listResponse";
|
import { ListResponse } from "../../models/response/listResponse";
|
||||||
import { PolicyResponse } from "../models/response/policyResponse";
|
import { PolicyResponse } from "../../models/response/policyResponse";
|
||||||
|
|
||||||
export abstract class PolicyService {
|
export abstract class PolicyService {
|
||||||
clearCache: () => void;
|
|
||||||
getAll: (type?: PolicyType, userId?: string) => Promise<Policy[]>;
|
getAll: (type?: PolicyType, userId?: string) => Promise<Policy[]>;
|
||||||
getPolicyForOrganization: (policyType: PolicyType, organizationId: string) => Promise<Policy>;
|
|
||||||
replace: (policies: { [id: string]: PolicyData }) => Promise<any>;
|
|
||||||
clear: (userId?: string) => Promise<any>;
|
|
||||||
getMasterPasswordPoliciesForInvitedUsers: (orgId: string) => Promise<MasterPasswordPolicyOptions>;
|
|
||||||
getMasterPasswordPolicyOptions: (policies?: Policy[]) => Promise<MasterPasswordPolicyOptions>;
|
getMasterPasswordPolicyOptions: (policies?: Policy[]) => Promise<MasterPasswordPolicyOptions>;
|
||||||
evaluateMasterPassword: (
|
evaluateMasterPassword: (
|
||||||
passwordStrength: number,
|
passwordStrength: number,
|
||||||
@ -30,3 +26,9 @@ export abstract class PolicyService {
|
|||||||
userId?: string
|
userId?: string
|
||||||
) => Promise<boolean>;
|
) => Promise<boolean>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export abstract class InternalPolicyService extends PolicyService {
|
||||||
|
upsert: (policy: PolicyData) => Promise<any>;
|
||||||
|
replace: (policies: { [id: string]: PolicyData }) => Promise<any>;
|
||||||
|
clear: (userId?: string) => Promise<any>;
|
||||||
|
}
|
@ -6,7 +6,6 @@ import { TokenService } from "../abstractions/token.service";
|
|||||||
import { DeviceType } from "../enums/deviceType";
|
import { DeviceType } from "../enums/deviceType";
|
||||||
import { OrganizationApiKeyType } from "../enums/organizationApiKeyType";
|
import { OrganizationApiKeyType } from "../enums/organizationApiKeyType";
|
||||||
import { OrganizationConnectionType } from "../enums/organizationConnectionType";
|
import { OrganizationConnectionType } from "../enums/organizationConnectionType";
|
||||||
import { PolicyType } from "../enums/policyType";
|
|
||||||
import { Utils } from "../misc/utils";
|
import { Utils } from "../misc/utils";
|
||||||
import { SetKeyConnectorKeyRequest } from "../models/request/account/setKeyConnectorKeyRequest";
|
import { SetKeyConnectorKeyRequest } from "../models/request/account/setKeyConnectorKeyRequest";
|
||||||
import { VerifyOTPRequest } from "../models/request/account/verifyOTPRequest";
|
import { VerifyOTPRequest } from "../models/request/account/verifyOTPRequest";
|
||||||
@ -67,7 +66,6 @@ import { OrganizationUserUpdateRequest } from "../models/request/organizationUse
|
|||||||
import { PasswordHintRequest } from "../models/request/passwordHintRequest";
|
import { PasswordHintRequest } from "../models/request/passwordHintRequest";
|
||||||
import { PasswordRequest } from "../models/request/passwordRequest";
|
import { PasswordRequest } from "../models/request/passwordRequest";
|
||||||
import { PaymentRequest } from "../models/request/paymentRequest";
|
import { PaymentRequest } from "../models/request/paymentRequest";
|
||||||
import { PolicyRequest } from "../models/request/policyRequest";
|
|
||||||
import { PreloginRequest } from "../models/request/preloginRequest";
|
import { PreloginRequest } from "../models/request/preloginRequest";
|
||||||
import { ProviderAddOrganizationRequest } from "../models/request/provider/providerAddOrganizationRequest";
|
import { ProviderAddOrganizationRequest } from "../models/request/provider/providerAddOrganizationRequest";
|
||||||
import { ProviderOrganizationCreateRequest } from "../models/request/provider/providerOrganizationCreateRequest";
|
import { ProviderOrganizationCreateRequest } from "../models/request/provider/providerOrganizationCreateRequest";
|
||||||
@ -1024,83 +1022,6 @@ export class ApiService implements ApiServiceAbstraction {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Policy APIs
|
|
||||||
|
|
||||||
async getPolicy(organizationId: string, type: PolicyType): Promise<PolicyResponse> {
|
|
||||||
const r = await this.send(
|
|
||||||
"GET",
|
|
||||||
"/organizations/" + organizationId + "/policies/" + type,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
return new PolicyResponse(r);
|
|
||||||
}
|
|
||||||
|
|
||||||
async getPolicies(organizationId: string): Promise<ListResponse<PolicyResponse>> {
|
|
||||||
const r = await this.send(
|
|
||||||
"GET",
|
|
||||||
"/organizations/" + organizationId + "/policies",
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
return new ListResponse(r, PolicyResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
async getPoliciesByToken(
|
|
||||||
organizationId: string,
|
|
||||||
token: string,
|
|
||||||
email: string,
|
|
||||||
organizationUserId: string
|
|
||||||
): Promise<ListResponse<PolicyResponse>> {
|
|
||||||
const r = await this.send(
|
|
||||||
"GET",
|
|
||||||
"/organizations/" +
|
|
||||||
organizationId +
|
|
||||||
"/policies/token?" +
|
|
||||||
"token=" +
|
|
||||||
encodeURIComponent(token) +
|
|
||||||
"&email=" +
|
|
||||||
encodeURIComponent(email) +
|
|
||||||
"&organizationUserId=" +
|
|
||||||
organizationUserId,
|
|
||||||
null,
|
|
||||||
false,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
return new ListResponse(r, PolicyResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
async getPoliciesByInvitedUser(
|
|
||||||
organizationId: string,
|
|
||||||
userId: string
|
|
||||||
): Promise<ListResponse<PolicyResponse>> {
|
|
||||||
const r = await this.send(
|
|
||||||
"GET",
|
|
||||||
"/organizations/" + organizationId + "/policies/invited-user?" + "userId=" + userId,
|
|
||||||
null,
|
|
||||||
false,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
return new ListResponse(r, PolicyResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
async putPolicy(
|
|
||||||
organizationId: string,
|
|
||||||
type: PolicyType,
|
|
||||||
request: PolicyRequest
|
|
||||||
): Promise<PolicyResponse> {
|
|
||||||
const r = await this.send(
|
|
||||||
"PUT",
|
|
||||||
"/organizations/" + organizationId + "/policies/" + type,
|
|
||||||
request,
|
|
||||||
true,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
return new PolicyResponse(r);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Organization User APIs
|
// Organization User APIs
|
||||||
|
|
||||||
async getOrganizationUser(
|
async getOrganizationUser(
|
||||||
|
@ -2,7 +2,7 @@ import * as zxcvbn from "zxcvbn";
|
|||||||
|
|
||||||
import { CryptoService } from "../abstractions/crypto.service";
|
import { CryptoService } from "../abstractions/crypto.service";
|
||||||
import { PasswordGenerationService as PasswordGenerationServiceAbstraction } from "../abstractions/passwordGeneration.service";
|
import { PasswordGenerationService as PasswordGenerationServiceAbstraction } from "../abstractions/passwordGeneration.service";
|
||||||
import { PolicyService } from "../abstractions/policy.service";
|
import { PolicyService } from "../abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "../abstractions/state.service";
|
import { StateService } from "../abstractions/state.service";
|
||||||
import { PolicyType } from "../enums/policyType";
|
import { PolicyType } from "../enums/policyType";
|
||||||
import { EEFLongWordList } from "../misc/wordlist";
|
import { EEFLongWordList } from "../misc/wordlist";
|
||||||
|
120
libs/common/src/services/policy/policy-api.service.ts
Normal file
120
libs/common/src/services/policy/policy-api.service.ts
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||||
|
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
||||||
|
import { PolicyApiServiceAbstraction } from "@bitwarden/common/abstractions/policy/policy-api.service.abstraction";
|
||||||
|
import { InternalPolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
|
import { PolicyType } from "@bitwarden/common/enums/policyType";
|
||||||
|
import { PolicyData } from "@bitwarden/common/models/data/policyData";
|
||||||
|
import { MasterPasswordPolicyOptions } from "@bitwarden/common/models/domain/masterPasswordPolicyOptions";
|
||||||
|
import { Policy } from "@bitwarden/common/models/domain/policy";
|
||||||
|
import { PolicyRequest } from "@bitwarden/common/models/request/policyRequest";
|
||||||
|
import { ListResponse } from "@bitwarden/common/models/response/listResponse";
|
||||||
|
import { PolicyResponse } from "@bitwarden/common/models/response/policyResponse";
|
||||||
|
|
||||||
|
export class PolicyApiService implements PolicyApiServiceAbstraction {
|
||||||
|
constructor(
|
||||||
|
private policyService: InternalPolicyService,
|
||||||
|
private apiService: ApiService,
|
||||||
|
private stateService: StateService,
|
||||||
|
private organizationService: OrganizationService
|
||||||
|
) {}
|
||||||
|
|
||||||
|
async getPolicy(organizationId: string, type: PolicyType): Promise<PolicyResponse> {
|
||||||
|
const r = await this.apiService.send(
|
||||||
|
"GET",
|
||||||
|
"/organizations/" + organizationId + "/policies/" + type,
|
||||||
|
null,
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
return new PolicyResponse(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getPolicies(organizationId: string): Promise<ListResponse<PolicyResponse>> {
|
||||||
|
const r = await this.apiService.send(
|
||||||
|
"GET",
|
||||||
|
"/organizations/" + organizationId + "/policies",
|
||||||
|
null,
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
return new ListResponse(r, PolicyResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getPoliciesByToken(
|
||||||
|
organizationId: string,
|
||||||
|
token: string,
|
||||||
|
email: string,
|
||||||
|
organizationUserId: string
|
||||||
|
): Promise<ListResponse<PolicyResponse>> {
|
||||||
|
const r = await this.apiService.send(
|
||||||
|
"GET",
|
||||||
|
"/organizations/" +
|
||||||
|
organizationId +
|
||||||
|
"/policies/token?" +
|
||||||
|
"token=" +
|
||||||
|
encodeURIComponent(token) +
|
||||||
|
"&email=" +
|
||||||
|
encodeURIComponent(email) +
|
||||||
|
"&organizationUserId=" +
|
||||||
|
organizationUserId,
|
||||||
|
null,
|
||||||
|
false,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
return new ListResponse(r, PolicyResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getPoliciesByInvitedUser(
|
||||||
|
organizationId: string,
|
||||||
|
userId: string
|
||||||
|
): Promise<ListResponse<PolicyResponse>> {
|
||||||
|
const r = await this.apiService.send(
|
||||||
|
"GET",
|
||||||
|
"/organizations/" + organizationId + "/policies/invited-user?" + "userId=" + userId,
|
||||||
|
null,
|
||||||
|
false,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
return new ListResponse(r, PolicyResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getPolicyForOrganization(policyType: PolicyType, organizationId: string): Promise<Policy> {
|
||||||
|
const org = await this.organizationService.get(organizationId);
|
||||||
|
if (org?.isProviderUser) {
|
||||||
|
const orgPolicies = await this.getPolicies(organizationId);
|
||||||
|
const policy = orgPolicies.data.find((p) => p.organizationId === organizationId);
|
||||||
|
|
||||||
|
if (policy == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Policy(new PolicyData(policy));
|
||||||
|
}
|
||||||
|
|
||||||
|
const policies = await this.policyService.getAll(policyType);
|
||||||
|
return policies.find((p) => p.organizationId === organizationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getMasterPasswordPoliciesForInvitedUsers(
|
||||||
|
orgId: string
|
||||||
|
): Promise<MasterPasswordPolicyOptions> {
|
||||||
|
const userId = await this.stateService.getUserId();
|
||||||
|
const response = await this.getPoliciesByInvitedUser(orgId, userId);
|
||||||
|
const policies = await this.policyService.mapPoliciesFromToken(response);
|
||||||
|
return this.policyService.getMasterPasswordPolicyOptions(policies);
|
||||||
|
}
|
||||||
|
|
||||||
|
async putPolicy(organizationId: string, type: PolicyType, request: PolicyRequest): Promise<any> {
|
||||||
|
const r = await this.apiService.send(
|
||||||
|
"PUT",
|
||||||
|
"/organizations/" + organizationId + "/policies/" + type,
|
||||||
|
request,
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
const response = new PolicyResponse(r);
|
||||||
|
const data = new PolicyData(response);
|
||||||
|
await this.policyService.upsert(data);
|
||||||
|
}
|
||||||
|
}
|
@ -1,31 +1,25 @@
|
|||||||
import { ApiService } from "../abstractions/api.service";
|
import { OrganizationService } from "../../abstractions/organization.service";
|
||||||
import { OrganizationService } from "../abstractions/organization.service";
|
import { InternalPolicyService as InternalPolicyServiceAbstraction } from "../../abstractions/policy/policy.service.abstraction";
|
||||||
import { PolicyService as PolicyServiceAbstraction } from "../abstractions/policy.service";
|
import { StateService } from "../../abstractions/state.service";
|
||||||
import { StateService } from "../abstractions/state.service";
|
import { OrganizationUserStatusType } from "../../enums/organizationUserStatusType";
|
||||||
import { OrganizationUserStatusType } from "../enums/organizationUserStatusType";
|
import { OrganizationUserType } from "../../enums/organizationUserType";
|
||||||
import { OrganizationUserType } from "../enums/organizationUserType";
|
import { PolicyType } from "../../enums/policyType";
|
||||||
import { PolicyType } from "../enums/policyType";
|
import { PolicyData } from "../../models/data/policyData";
|
||||||
import { PolicyData } from "../models/data/policyData";
|
import { MasterPasswordPolicyOptions } from "../../models/domain/masterPasswordPolicyOptions";
|
||||||
import { MasterPasswordPolicyOptions } from "../models/domain/masterPasswordPolicyOptions";
|
import { Organization } from "../../models/domain/organization";
|
||||||
import { Organization } from "../models/domain/organization";
|
import { Policy } from "../../models/domain/policy";
|
||||||
import { Policy } from "../models/domain/policy";
|
import { ResetPasswordPolicyOptions } from "../../models/domain/resetPasswordPolicyOptions";
|
||||||
import { ResetPasswordPolicyOptions } from "../models/domain/resetPasswordPolicyOptions";
|
import { ListResponse } from "../../models/response/listResponse";
|
||||||
import { ListResponse } from "../models/response/listResponse";
|
import { PolicyResponse } from "../../models/response/policyResponse";
|
||||||
import { PolicyResponse } from "../models/response/policyResponse";
|
|
||||||
|
|
||||||
export class PolicyService implements PolicyServiceAbstraction {
|
export class PolicyService implements InternalPolicyServiceAbstraction {
|
||||||
policyCache: Policy[];
|
policyCache: Policy[];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private stateService: StateService,
|
private stateService: StateService,
|
||||||
private organizationService: OrganizationService,
|
private organizationService: OrganizationService
|
||||||
private apiService: ApiService
|
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async clearCache(): Promise<void> {
|
|
||||||
await this.stateService.setDecryptedPolicies(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
async getAll(type?: PolicyType, userId?: string): Promise<Policy[]> {
|
async getAll(type?: PolicyType, userId?: string): Promise<Policy[]> {
|
||||||
let response: Policy[] = [];
|
let response: Policy[] = [];
|
||||||
const decryptedPolicies = await this.stateService.getDecryptedPolicies({ userId: userId });
|
const decryptedPolicies = await this.stateService.getDecryptedPolicies({ userId: userId });
|
||||||
@ -48,42 +42,6 @@ export class PolicyService implements PolicyServiceAbstraction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getPolicyForOrganization(policyType: PolicyType, organizationId: string): Promise<Policy> {
|
|
||||||
const org = await this.organizationService.get(organizationId);
|
|
||||||
if (org?.isProviderUser) {
|
|
||||||
const orgPolicies = await this.apiService.getPolicies(organizationId);
|
|
||||||
const policy = orgPolicies.data.find((p) => p.organizationId === organizationId);
|
|
||||||
|
|
||||||
if (policy == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Policy(new PolicyData(policy));
|
|
||||||
}
|
|
||||||
|
|
||||||
const policies = await this.getAll(policyType);
|
|
||||||
return policies.find((p) => p.organizationId === organizationId);
|
|
||||||
}
|
|
||||||
|
|
||||||
async replace(policies: { [id: string]: PolicyData }): Promise<any> {
|
|
||||||
await this.stateService.setDecryptedPolicies(null);
|
|
||||||
await this.stateService.setEncryptedPolicies(policies);
|
|
||||||
}
|
|
||||||
|
|
||||||
async clear(userId?: string): Promise<any> {
|
|
||||||
await this.stateService.setDecryptedPolicies(null, { userId: userId });
|
|
||||||
await this.stateService.setEncryptedPolicies(null, { userId: userId });
|
|
||||||
}
|
|
||||||
|
|
||||||
async getMasterPasswordPoliciesForInvitedUsers(
|
|
||||||
orgId: string
|
|
||||||
): Promise<MasterPasswordPolicyOptions> {
|
|
||||||
const userId = await this.stateService.getUserId();
|
|
||||||
const response = await this.apiService.getPoliciesByInvitedUser(orgId, userId);
|
|
||||||
const policies = await this.mapPoliciesFromToken(response);
|
|
||||||
return this.getMasterPasswordPolicyOptions(policies);
|
|
||||||
}
|
|
||||||
|
|
||||||
async getMasterPasswordPolicyOptions(policies?: Policy[]): Promise<MasterPasswordPolicyOptions> {
|
async getMasterPasswordPolicyOptions(policies?: Policy[]): Promise<MasterPasswordPolicyOptions> {
|
||||||
let enforcedOptions: MasterPasswordPolicyOptions = null;
|
let enforcedOptions: MasterPasswordPolicyOptions = null;
|
||||||
|
|
||||||
@ -237,6 +195,28 @@ export class PolicyService implements PolicyServiceAbstraction {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async upsert(policy: PolicyData): Promise<any> {
|
||||||
|
let policies = await this.stateService.getEncryptedPolicies();
|
||||||
|
if (policies == null) {
|
||||||
|
policies = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
policies[policy.id] = policy;
|
||||||
|
|
||||||
|
await this.stateService.setDecryptedPolicies(null);
|
||||||
|
await this.stateService.setEncryptedPolicies(policies);
|
||||||
|
}
|
||||||
|
|
||||||
|
async replace(policies: { [id: string]: PolicyData }): Promise<any> {
|
||||||
|
await this.stateService.setDecryptedPolicies(null);
|
||||||
|
await this.stateService.setEncryptedPolicies(policies);
|
||||||
|
}
|
||||||
|
|
||||||
|
async clear(userId?: string): Promise<any> {
|
||||||
|
await this.stateService.setDecryptedPolicies(null, { userId: userId });
|
||||||
|
await this.stateService.setEncryptedPolicies(null, { userId: userId });
|
||||||
|
}
|
||||||
|
|
||||||
private isExcemptFromPolicies(organization: Organization, policyType: PolicyType) {
|
private isExcemptFromPolicies(organization: Organization, policyType: PolicyType) {
|
||||||
if (policyType === PolicyType.MaximumVaultTimeout) {
|
if (policyType === PolicyType.MaximumVaultTimeout) {
|
||||||
return organization.type === OrganizationUserType.Owner;
|
return organization.type === OrganizationUserType.Owner;
|
@ -8,7 +8,7 @@ import { KeyConnectorService } from "../abstractions/keyConnector.service";
|
|||||||
import { LogService } from "../abstractions/log.service";
|
import { LogService } from "../abstractions/log.service";
|
||||||
import { MessagingService } from "../abstractions/messaging.service";
|
import { MessagingService } from "../abstractions/messaging.service";
|
||||||
import { OrganizationService } from "../abstractions/organization.service";
|
import { OrganizationService } from "../abstractions/organization.service";
|
||||||
import { PolicyService } from "../abstractions/policy.service";
|
import { InternalPolicyService } from "../abstractions/policy/policy.service.abstraction";
|
||||||
import { ProviderService } from "../abstractions/provider.service";
|
import { ProviderService } from "../abstractions/provider.service";
|
||||||
import { SendService } from "../abstractions/send.service";
|
import { SendService } from "../abstractions/send.service";
|
||||||
import { SettingsService } from "../abstractions/settings.service";
|
import { SettingsService } from "../abstractions/settings.service";
|
||||||
@ -46,7 +46,7 @@ export class SyncService implements SyncServiceAbstraction {
|
|||||||
private cryptoService: CryptoService,
|
private cryptoService: CryptoService,
|
||||||
private collectionService: CollectionService,
|
private collectionService: CollectionService,
|
||||||
private messagingService: MessagingService,
|
private messagingService: MessagingService,
|
||||||
private policyService: PolicyService,
|
private policyService: InternalPolicyService,
|
||||||
private sendService: SendService,
|
private sendService: SendService,
|
||||||
private logService: LogService,
|
private logService: LogService,
|
||||||
private keyConnectorService: KeyConnectorService,
|
private keyConnectorService: KeyConnectorService,
|
||||||
|
@ -6,7 +6,7 @@ import { FolderService } from "../abstractions/folder/folder.service.abstraction
|
|||||||
import { KeyConnectorService } from "../abstractions/keyConnector.service";
|
import { KeyConnectorService } from "../abstractions/keyConnector.service";
|
||||||
import { MessagingService } from "../abstractions/messaging.service";
|
import { MessagingService } from "../abstractions/messaging.service";
|
||||||
import { PlatformUtilsService } from "../abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "../abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "../abstractions/policy.service";
|
import { PolicyService } from "../abstractions/policy/policy.service.abstraction";
|
||||||
import { SearchService } from "../abstractions/search.service";
|
import { SearchService } from "../abstractions/search.service";
|
||||||
import { StateService } from "../abstractions/state.service";
|
import { StateService } from "../abstractions/state.service";
|
||||||
import { TokenService } from "../abstractions/token.service";
|
import { TokenService } from "../abstractions/token.service";
|
||||||
|
@ -12,7 +12,7 @@ import { EnvironmentService } from "@bitwarden/common/abstractions/environment.s
|
|||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
import { PasswordGenerationService } from "@bitwarden/common/abstractions/passwordGeneration.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PolicyService } from "@bitwarden/common/abstractions/policy.service";
|
import { PolicyService } from "@bitwarden/common/abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||||
import { TwoFactorService } from "@bitwarden/common/abstractions/twoFactor.service";
|
import { TwoFactorService } from "@bitwarden/common/abstractions/twoFactor.service";
|
||||||
import { TwoFactorProviderType } from "@bitwarden/common/enums/twoFactorProviderType";
|
import { TwoFactorProviderType } from "@bitwarden/common/enums/twoFactorProviderType";
|
||||||
|
Loading…
Reference in New Issue
Block a user