mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
[PM-18566] Wire up vNextPolicyService for Clients (#13678)
* wire up vNext impl * wire up vNextPolicyService for browser * wire up vNextPolicyService for desktop * wire up vNextPolicyService for cli * fix test * fix missed caller * cleanup * fix missing property assignment * fix QA bug for PM-19205 * fix QA bug for PM-19206 * fix QA bug for pm-19228 * cleanup
This commit is contained in:
@@ -14,7 +14,6 @@ import {
|
||||
import { ReactiveFormsModule, UntypedFormBuilder, Validators } from "@angular/forms";
|
||||
import {
|
||||
combineLatest,
|
||||
firstValueFrom,
|
||||
map,
|
||||
merge,
|
||||
Observable,
|
||||
@@ -212,12 +211,18 @@ export class ExportComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
this.formDisabled.emit(c === "DISABLED");
|
||||
});
|
||||
|
||||
// policies
|
||||
this.disablePersonalVaultExportPolicy$ = this.policyService.policyAppliesToActiveUser$(
|
||||
PolicyType.DisablePersonalVaultExport,
|
||||
this.disablePersonalVaultExportPolicy$ = this.accountService.activeAccount$.pipe(
|
||||
getUserId,
|
||||
switchMap((userId) =>
|
||||
this.policyService.policyAppliesToUser$(PolicyType.DisablePersonalVaultExport, userId),
|
||||
),
|
||||
);
|
||||
this.disablePersonalOwnershipPolicy$ = this.policyService.policyAppliesToActiveUser$(
|
||||
PolicyType.PersonalOwnership,
|
||||
|
||||
this.disablePersonalOwnershipPolicy$ = this.accountService.activeAccount$.pipe(
|
||||
getUserId,
|
||||
switchMap((userId) =>
|
||||
this.policyService.policyAppliesToUser$(PolicyType.PersonalOwnership, userId),
|
||||
),
|
||||
);
|
||||
|
||||
merge(
|
||||
@@ -227,8 +232,6 @@ export class ExportComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
.pipe(startWith(0), takeUntil(this.destroy$))
|
||||
.subscribe(() => this.adjustValidators());
|
||||
|
||||
const userId = await firstValueFrom(getUserId(this.accountService.activeAccount$));
|
||||
|
||||
// Wire up the password generation for the password-protected export
|
||||
const account$ = this.accountService.activeAccount$.pipe(
|
||||
pin({
|
||||
@@ -251,9 +254,14 @@ export class ExportComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
});
|
||||
|
||||
if (this.organizationId) {
|
||||
this.organizations$ = this.organizationService
|
||||
.memberOrganizations$(userId)
|
||||
.pipe(map((orgs) => orgs.filter((org) => org.id == this.organizationId)));
|
||||
this.organizations$ = this.accountService.activeAccount$.pipe(
|
||||
getUserId,
|
||||
switchMap((userId) =>
|
||||
this.organizationService
|
||||
.memberOrganizations$(userId)
|
||||
.pipe(map((orgs) => orgs.filter((org) => org.id == this.organizationId))),
|
||||
),
|
||||
);
|
||||
this.exportForm.controls.vaultSelector.patchValue(this.organizationId);
|
||||
this.exportForm.controls.vaultSelector.disable();
|
||||
|
||||
@@ -263,7 +271,10 @@ export class ExportComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
|
||||
this.organizations$ = combineLatest({
|
||||
collections: this.collectionService.decryptedCollections$,
|
||||
memberOrganizations: this.organizationService.memberOrganizations$(userId),
|
||||
memberOrganizations: this.accountService.activeAccount$.pipe(
|
||||
getUserId,
|
||||
switchMap((userId) => this.organizationService.memberOrganizations$(userId)),
|
||||
),
|
||||
}).pipe(
|
||||
map(({ collections, memberOrganizations }) => {
|
||||
const managedCollectionsOrgIds = new Set(
|
||||
|
||||
Reference in New Issue
Block a user