inactive 2fa report for orgs

This commit is contained in:
Kyle Spearrin 2018-12-14 14:22:30 -05:00
parent 392a90c02c
commit 9b7c0288d4
4 changed files with 57 additions and 3 deletions

View File

@ -37,6 +37,9 @@ import {
ExposedPasswordsReportComponent as OrgExposedPasswordsReportComponent,
} from './organizations/tools/exposed-passwords-report.component';
import { ImportComponent as OrgImportComponent } from './organizations/tools/import.component';
import {
InactiveTwoFactorReportComponent as OrgInactiveTwoFactorReportComponent,
} from './organizations/tools/inactive-two-factor-report.component';
import { ToolsComponent as OrgToolsComponent } from './organizations/tools/tools.component';
import { VaultComponent as OrgVaultComponent } from './organizations/vault/vault.component';
@ -179,7 +182,7 @@ const routes: Routes = [
{
path: 'inactive-two-factor-report',
component: InactiveTwoFactorReportComponent,
data: { titleId: 'exposedPasswordsReport' },
data: { titleId: 'inactive2faReport' },
},
],
},
@ -206,6 +209,11 @@ const routes: Routes = [
component: OrgExposedPasswordsReportComponent,
data: { titleId: 'exposedPasswordsReport' },
},
{
path: 'inactive-two-factor-report',
component: OrgInactiveTwoFactorReportComponent,
data: { titleId: 'inactive2faReport' },
},
],
},
{

View File

@ -67,6 +67,9 @@ import {
ExposedPasswordsReportComponent as OrgExposedPasswordsReportComponent,
} from './organizations/tools/exposed-passwords-report.component';
import { ImportComponent as OrgImportComponent } from './organizations/tools/import.component';
import {
InactiveTwoFactorReportComponent as OrgInactiveTwoFactorReportComponent,
} from './organizations/tools/inactive-two-factor-report.component';
import { ToolsComponent as OrgToolsComponent } from './organizations/tools/tools.component';
import { AddEditComponent as OrgAddEditComponent } from './organizations/vault/add-edit.component';
@ -257,6 +260,7 @@ registerLocaleData(localeZhCn, 'zh-CN');
OrgExportComponent,
OrgExposedPasswordsReportComponent,
OrgImportComponent,
OrgInactiveTwoFactorReportComponent,
OrgGroupAddEditComponent,
OrgGroupingsComponent,
OrgGroupsComponent,

View File

@ -0,0 +1,38 @@
import {
Component,
ComponentFactoryResolver,
} from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { CipherService } from 'jslib/abstractions/cipher.service';
import { MessagingService } from 'jslib/abstractions/messaging.service';
import { UserService } from 'jslib/abstractions/user.service';
import {
InactiveTwoFactorReportComponent as BaseInactiveTwoFactorReportComponent,
} from '../../tools/inactive-two-factor-report.component';
import { CipherView } from 'jslib/models/view/cipherView';
@Component({
selector: 'app-inactive-two-factor-report',
templateUrl: '../../tools/inactive-two-factor-report.component.html',
})
export class InactiveTwoFactorReportComponent extends BaseInactiveTwoFactorReportComponent {
constructor(ciphersService: CipherService, componentFactoryResolver: ComponentFactoryResolver,
messagingService: MessagingService, userService: UserService,
private route: ActivatedRoute) {
super(ciphersService, componentFactoryResolver, messagingService, userService);
}
async ngOnInit() {
this.route.parent.parent.params.subscribe(async (params) => {
this.organization = await this.userService.getOrganization(params.organizationId);
await super.ngOnInit();
});
}
getAllCiphers(): Promise<CipherView[]> {
return this.cipherService.getAllFromApiForOrganization(this.organization.id);
}
}

View File

@ -24,7 +24,7 @@ export class InactiveTwoFactorReportComponent extends CipherReportComponent impl
services = new Map<string, string>();
cipherDocs = new Map<string, string>();
constructor(private ciphersService: CipherService, componentFactoryResolver: ComponentFactoryResolver,
constructor(protected cipherService: CipherService, componentFactoryResolver: ComponentFactoryResolver,
messagingService: MessagingService, userService: UserService) {
super(componentFactoryResolver, userService, messagingService, true);
}
@ -40,7 +40,7 @@ export class InactiveTwoFactorReportComponent extends CipherReportComponent impl
await this.load2fa();
} catch { }
if (this.services.size > 0) {
const allCiphers = await this.ciphersService.getAllDecrypted();
const allCiphers = await this.getAllCiphers();
const inactive2faCiphers: CipherView[] = [];
const promises: Array<Promise<void>> = [];
const docs = new Map<string, string>();
@ -68,6 +68,10 @@ export class InactiveTwoFactorReportComponent extends CipherReportComponent impl
}
}
protected getAllCiphers(): Promise<CipherView[]> {
return this.cipherService.getAllDecrypted();
}
private async load2fa() {
if (this.services.size > 0) {
return;