2021-08-27 14:50:58 +02:00
|
|
|
import { Component } from '@angular/core';
|
2018-12-14 20:42:04 +01:00
|
|
|
import { ActivatedRoute } from '@angular/router';
|
|
|
|
|
2021-06-07 20:13:58 +02:00
|
|
|
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
|
|
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
|
|
|
import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
|
2021-10-11 15:32:30 +02:00
|
|
|
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
2021-06-07 20:13:58 +02:00
|
|
|
import { UserService } from 'jslib-common/abstractions/user.service';
|
2018-12-14 20:42:04 +01:00
|
|
|
|
2021-08-27 14:50:58 +02:00
|
|
|
import { ModalService } from 'jslib-angular/services/modal.service';
|
|
|
|
|
2021-06-07 20:13:58 +02:00
|
|
|
import { Cipher } from 'jslib-common/models/domain/cipher';
|
2021-01-12 21:31:22 +01:00
|
|
|
|
2021-06-07 20:13:58 +02:00
|
|
|
import { CipherView } from 'jslib-common/models/view/cipherView';
|
2018-12-14 20:42:04 +01:00
|
|
|
|
|
|
|
import {
|
|
|
|
WeakPasswordsReportComponent as BaseWeakPasswordsReportComponent,
|
|
|
|
} from '../../tools/weak-passwords-report.component';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-weak-passwords-report',
|
|
|
|
templateUrl: '../../tools/weak-passwords-report.component.html',
|
|
|
|
})
|
|
|
|
export class WeakPasswordsReportComponent extends BaseWeakPasswordsReportComponent {
|
2021-01-12 21:31:22 +01:00
|
|
|
manageableCiphers: Cipher[];
|
|
|
|
|
2018-12-14 20:42:04 +01:00
|
|
|
constructor(cipherService: CipherService, passwordGenerationService: PasswordGenerationService,
|
2021-08-27 14:50:58 +02:00
|
|
|
modalService: ModalService, messagingService: MessagingService,
|
2021-10-11 15:32:30 +02:00
|
|
|
userService: UserService, passwordRepromptService: PasswordRepromptService, private route: ActivatedRoute) {
|
|
|
|
super(cipherService, passwordGenerationService, modalService, messagingService, userService,
|
|
|
|
passwordRepromptService);
|
2018-12-14 20:42:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
async ngOnInit() {
|
2021-02-03 18:41:33 +01:00
|
|
|
this.route.parent.parent.params.subscribe(async params => {
|
2018-12-14 20:42:04 +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 20:42:04 +01:00
|
|
|
await 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 20:42:04 +01:00
|
|
|
}
|