bitwarden-estensione-browser/src/app/organizations/tools/exposed-passwords-report.co...

47 lines
1.8 KiB
TypeScript
Raw Normal View History

import { Component } from '@angular/core';
2018-12-14 19:56:01 +01:00
import { ActivatedRoute } from '@angular/router';
import { AuditService } from 'jslib-common/abstractions/audit.service';
import { CipherService } from 'jslib-common/abstractions/cipher.service';
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
import { UserService } from 'jslib-common/abstractions/user.service';
2018-12-14 19:56:01 +01:00
import { ModalService } from 'jslib-angular/services/modal.service';
2018-12-14 19:56:01 +01:00
import {
ExposedPasswordsReportComponent as BaseExposedPasswordsReportComponent,
} from '../../tools/exposed-passwords-report.component';
import { Cipher } from 'jslib-common/models/domain/cipher';
import { CipherView } from 'jslib-common/models/view/cipherView';
2018-12-14 19:56:01 +01:00
@Component({
selector: 'app-exposed-passwords-report',
templateUrl: '../../tools/exposed-passwords-report.component.html',
})
export class ExposedPasswordsReportComponent extends BaseExposedPasswordsReportComponent {
manageableCiphers: Cipher[];
2018-12-14 20:42:04 +01:00
constructor(cipherService: CipherService, auditService: AuditService,
modalService: ModalService, messagingService: MessagingService,
2018-12-14 19:56:01 +01:00
userService: UserService, private route: ActivatedRoute) {
super(cipherService, auditService, modalService, messagingService, userService);
2018-12-14 19:56:01 +01:00
}
ngOnInit() {
this.route.parent.parent.params.subscribe(async params => {
2018-12-14 19:56:01 +01:00
this.organization = await this.userService.getOrganization(params.organizationId);
this.manageableCiphers = await this.cipherService.getAll();
2018-12-14 19:56:01 +01:00
super.ngOnInit();
});
}
getAllCiphers(): Promise<CipherView[]> {
return this.cipherService.getAllFromApiForOrganization(this.organization.id);
}
canManageCipher(c: CipherView): boolean {
return this.manageableCiphers.some(x => x.id === c.id);
}
2018-12-14 19:56:01 +01:00
}