2018-12-14 19:56:01 +01:00
|
|
|
import {
|
|
|
|
Component,
|
|
|
|
ComponentFactoryResolver,
|
|
|
|
} from '@angular/core';
|
|
|
|
import { ActivatedRoute } from '@angular/router';
|
|
|
|
|
|
|
|
import { AuditService } from 'jslib/abstractions/audit.service';
|
|
|
|
import { CipherService } from 'jslib/abstractions/cipher.service';
|
|
|
|
import { MessagingService } from 'jslib/abstractions/messaging.service';
|
|
|
|
import { UserService } from 'jslib/abstractions/user.service';
|
|
|
|
|
|
|
|
import {
|
|
|
|
ExposedPasswordsReportComponent as BaseExposedPasswordsReportComponent,
|
|
|
|
} from '../../tools/exposed-passwords-report.component';
|
|
|
|
|
2021-01-12 21:31:22 +01:00
|
|
|
import { Cipher } from 'jslib/models/domain/cipher';
|
2021-02-03 18:41:33 +01:00
|
|
|
import { CipherView } from 'jslib/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 {
|
2021-01-12 21:31:22 +01:00
|
|
|
manageableCiphers: Cipher[];
|
|
|
|
|
2018-12-14 20:42:04 +01:00
|
|
|
constructor(cipherService: CipherService, auditService: AuditService,
|
2018-12-14 19:56:01 +01:00
|
|
|
componentFactoryResolver: ComponentFactoryResolver, messagingService: MessagingService,
|
|
|
|
userService: UserService, private route: ActivatedRoute) {
|
2018-12-14 20:42:04 +01:00
|
|
|
super(cipherService, auditService, componentFactoryResolver, messagingService, userService);
|
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 => {
|
2018-12-14 19:56:01 +01:00
|
|
|
this.organization = await this.userService.getOrganization(params.organizationId);
|
2021-01-12 21:31:22 +01:00
|
|
|
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);
|
|
|
|
}
|
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
|
|
|
}
|