2021-08-27 14:50:58 +02:00
|
|
|
import { Component } from "@angular/core";
|
2018-12-14 19:56:01 +01:00
|
|
|
import { ActivatedRoute } from "@angular/router";
|
|
|
|
|
2022-06-14 17:10:53 +02:00
|
|
|
import { ModalService } from "@bitwarden/angular/services/modal.service";
|
|
|
|
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
|
|
|
import { CipherService } from "@bitwarden/common/abstractions/cipher.service";
|
|
|
|
import { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
|
|
|
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
|
|
|
import { PasswordRepromptService } from "@bitwarden/common/abstractions/passwordReprompt.service";
|
|
|
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
|
|
|
import { Cipher } from "@bitwarden/common/models/domain/cipher";
|
|
|
|
import { CipherView } from "@bitwarden/common/models/view/cipherView";
|
2021-12-14 17:10:26 +01:00
|
|
|
|
2022-03-29 21:55:47 +02:00
|
|
|
import { ExposedPasswordsReportComponent as BaseExposedPasswordsReportComponent } from "../../reports/exposed-passwords-report.component";
|
2022-02-24 12:10:07 +01:00
|
|
|
|
2018-12-14 19:56:01 +01:00
|
|
|
@Component({
|
2022-05-12 15:47:18 +02:00
|
|
|
selector: "app-org-exposed-passwords-report",
|
2022-03-29 21:55:47 +02:00
|
|
|
templateUrl: "../../reports/exposed-passwords-report.component.html",
|
2018-12-14 19:56:01 +01:00
|
|
|
})
|
|
|
|
export class ExposedPasswordsReportComponent extends BaseExposedPasswordsReportComponent {
|
2021-01-12 21:31:22 +01:00
|
|
|
manageableCiphers: Cipher[];
|
2021-12-17 15:57:11 +01:00
|
|
|
|
2018-12-14 20:42:04 +01:00
|
|
|
constructor(
|
|
|
|
cipherService: CipherService,
|
|
|
|
auditService: AuditService,
|
2021-12-14 17:10:26 +01:00
|
|
|
modalService: ModalService,
|
|
|
|
messagingService: MessagingService,
|
|
|
|
stateService: StateService,
|
|
|
|
private organizationService: OrganizationService,
|
|
|
|
private route: ActivatedRoute,
|
|
|
|
passwordRepromptService: PasswordRepromptService
|
|
|
|
) {
|
|
|
|
super(
|
|
|
|
cipherService,
|
|
|
|
auditService,
|
|
|
|
modalService,
|
|
|
|
messagingService,
|
|
|
|
stateService,
|
|
|
|
passwordRepromptService
|
|
|
|
);
|
2018-12-14 19:56:01 +01:00
|
|
|
}
|
2021-12-17 15:57:11 +01:00
|
|
|
|
2018-12-14 19:56:01 +01:00
|
|
|
ngOnInit() {
|
2021-02-03 18:41:33 +01:00
|
|
|
this.route.parent.parent.params.subscribe(async (params) => {
|
2021-12-14 17:10:26 +01:00
|
|
|
this.organization = await this.organizationService.get(params.organizationId);
|
2021-01-12 21:31:22 +01:00
|
|
|
this.manageableCiphers = await this.cipherService.getAll();
|
2022-05-12 15:47:18 +02:00
|
|
|
await this.checkAccess();
|
2018-12-14 19:56:01 +01:00
|
|
|
});
|
|
|
|
}
|
2021-12-17 15:57:11 +01:00
|
|
|
|
2018-12-14 19:56:01 +01:00
|
|
|
getAllCiphers(): Promise<CipherView[]> {
|
|
|
|
return this.cipherService.getAllFromApiForOrganization(this.organization.id);
|
|
|
|
}
|
2021-12-17 15:57:11 +01:00
|
|
|
|
2021-01-12 21:31:22 +01:00
|
|
|
canManageCipher(c: CipherView): boolean {
|
|
|
|
return this.manageableCiphers.some((x) => x.id === c.id);
|
|
|
|
}
|
2018-12-14 19:56:01 +01:00
|
|
|
}
|