mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 13:53:34 +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:
@@ -99,7 +99,7 @@ export class SendOptionsComponent implements OnInit {
|
||||
this.accountService.activeAccount$
|
||||
.pipe(
|
||||
getUserId,
|
||||
switchMap((userId) => this.policyService.getAll$(PolicyType.SendOptions, userId)),
|
||||
switchMap((userId) => this.policyService.policiesByType$(PolicyType.SendOptions, userId)),
|
||||
map((policies) => policies?.some((p) => p.data.disableHideEmail)),
|
||||
takeUntilDestroyed(),
|
||||
)
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
// FIXME: Update this file to be type safe and remove this and next line
|
||||
// @ts-strict-ignore
|
||||
import { inject, Injectable } from "@angular/core";
|
||||
import { combineLatest, firstValueFrom, map } from "rxjs";
|
||||
import { combineLatest, firstValueFrom, map, switchMap } from "rxjs";
|
||||
|
||||
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
|
||||
import { PolicyType } from "@bitwarden/common/admin-console/enums";
|
||||
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
||||
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
||||
import { SendType } from "@bitwarden/common/tools/send/enums/send-type";
|
||||
import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction";
|
||||
import { SendId } from "@bitwarden/common/types/guid";
|
||||
@@ -22,6 +24,7 @@ import {
|
||||
export class DefaultSendFormConfigService implements SendFormConfigService {
|
||||
private policyService: PolicyService = inject(PolicyService);
|
||||
private sendService: SendService = inject(SendService);
|
||||
private accountService: AccountService = inject(AccountService);
|
||||
|
||||
async buildConfig(
|
||||
mode: SendFormMode,
|
||||
@@ -40,9 +43,11 @@ export class DefaultSendFormConfigService implements SendFormConfigService {
|
||||
};
|
||||
}
|
||||
|
||||
private areSendsEnabled$ = this.policyService
|
||||
.policyAppliesToActiveUser$(PolicyType.DisableSend)
|
||||
.pipe(map((p) => !p));
|
||||
private areSendsEnabled$ = this.accountService.activeAccount$.pipe(
|
||||
getUserId,
|
||||
switchMap((userId) => this.policyService.policyAppliesToUser$(PolicyType.DisableSend, userId)),
|
||||
map((p) => !p),
|
||||
);
|
||||
|
||||
private getSend(id?: SendId) {
|
||||
if (id == null) {
|
||||
|
||||
Reference in New Issue
Block a user