Skip to content

Commit a425fb5

Browse files
committed
[PM-18721] get grantor policies if grantor is owner of an org
1 parent 9eb69b1 commit a425fb5

File tree

2 files changed

+12
-27
lines changed

2 files changed

+12
-27
lines changed

apps/web/src/app/auth/emergency-access/services/emergency-access.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class EmergencyAccessService
8787
}
8888

8989
/**
90-
* Returns policies that apply to the grantor.
90+
* Returns policies that apply to the grantor if the grantor is the owner of an org, otherwise returns null.
9191
* Intended for grantee.
9292
* @param id emergency access id
9393
*/

apps/web/src/app/auth/settings/emergency-access/takeover/emergency-access-takeover-dialog.component.ts

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { CommonModule } from "@angular/common";
2-
import { AfterViewInit, Component, Inject, OnInit, ViewChild } from "@angular/core";
3-
import { BehaviorSubject, combineLatest, map } from "rxjs";
2+
import { Component, Inject, OnInit, ViewChild } from "@angular/core";
3+
import { BehaviorSubject, firstValueFrom } from "rxjs";
44

55
import {
66
InputPasswordComponent,
@@ -10,6 +10,7 @@ import {
1010
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
1111
import { MasterPasswordPolicyOptions } from "@bitwarden/common/admin-console/models/domain/master-password-policy-options";
1212
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
13+
import { getUserId } from "@bitwarden/common/auth/services/account.service";
1314
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
1415
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
1516
import {
@@ -60,7 +61,7 @@ type EmergencyAccessTakeoverDialogResultType =
6061
InputPasswordComponent,
6162
],
6263
})
63-
export class EmergencyAccessTakeoverDialogComponent implements OnInit, AfterViewInit {
64+
export class EmergencyAccessTakeoverDialogComponent implements OnInit {
6465
@ViewChild(InputPasswordComponent)
6566
inputPasswordComponent: InputPasswordComponent | undefined = undefined;
6667

@@ -83,34 +84,18 @@ export class EmergencyAccessTakeoverDialogComponent implements OnInit, AfterView
8384
) {}
8485

8586
async ngOnInit() {
86-
// const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
87-
// const grantorPolicies = await this.emergencyAccessService.getGrantorPolicies(
88-
// this.dialogData.emergencyAccessId,
89-
// );
87+
const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
88+
const grantorPolicies = await this.emergencyAccessService.getGrantorPolicies(
89+
this.dialogData.emergencyAccessId,
90+
);
9091

91-
// this.masterPasswordPolicyOptions = await firstValueFrom(
92-
// this.policyService.masterPasswordPolicyOptions$(activeUserId, grantorPolicies),
93-
// );
92+
this.masterPasswordPolicyOptions = await firstValueFrom(
93+
this.policyService.masterPasswordPolicyOptions$(activeUserId, grantorPolicies),
94+
);
9495

9596
this.initializing = false;
9697
}
9798

98-
ngAfterViewInit() {
99-
if (!this.inputPasswordComponent) {
100-
throw new Error("InputPasswordComponent is not initialized");
101-
}
102-
103-
this.submitting$ = combineLatest([
104-
this.submittingBehaviorSubject.asObservable(),
105-
this.inputPasswordComponent.submitting$,
106-
]).pipe(
107-
map(
108-
([dialogCompIsSubmitting, inputPasswordCompIsSubmitting]) =>
109-
dialogCompIsSubmitting || inputPasswordCompIsSubmitting,
110-
),
111-
);
112-
}
113-
11499
protected handlePrimaryButtonClick = async () => {
115100
if (!this.inputPasswordComponent) {
116101
throw new Error("InputPasswordComponent is not initialized");

0 commit comments

Comments
 (0)