2018-07-06 16:21:08 +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 { MessagingService } from "@bitwarden/common/abstractions/messaging.service";
|
2022-09-27 22:25:19 +02:00
|
|
|
import { OrganizationService } from "@bitwarden/common/abstractions/organization/organization.service.abstraction";
|
2022-06-14 17:10:53 +02:00
|
|
|
import { Organization } from "@bitwarden/common/models/domain/organization";
|
2018-07-05 20:40:53 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: "app-org-tools",
|
|
|
|
templateUrl: "tools.component.html",
|
|
|
|
})
|
2022-08-26 18:09:28 +02:00
|
|
|
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
|
2018-12-14 19:56:01 +01:00
|
|
|
export class ToolsComponent {
|
|
|
|
organization: Organization;
|
|
|
|
accessReports = false;
|
2021-01-12 21:31:22 +01:00
|
|
|
loading = true;
|
2018-12-14 19:56:01 +01:00
|
|
|
|
2021-12-14 17:10:26 +01:00
|
|
|
constructor(
|
|
|
|
private route: ActivatedRoute,
|
|
|
|
private organizationService: OrganizationService,
|
2018-12-14 20:48:12 +01:00
|
|
|
private messagingService: MessagingService
|
|
|
|
) {}
|
2018-12-14 19:56:01 +01:00
|
|
|
|
|
|
|
ngOnInit() {
|
2022-08-26 18:09:28 +02:00
|
|
|
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
|
2021-02-03 18:41:33 +01:00
|
|
|
this.route.parent.params.subscribe(async (params) => {
|
2021-12-14 17:10:26 +01:00
|
|
|
this.organization = await this.organizationService.get(params.organizationId);
|
2018-12-16 03:54:32 +01:00
|
|
|
// TODO: Maybe we want to just make sure they are not on a free plan? Just compare useTotp for now
|
|
|
|
// since all paid plans include useTotp
|
|
|
|
this.accessReports = this.organization.useTotp;
|
2021-01-12 21:31:22 +01:00
|
|
|
this.loading = false;
|
2018-12-14 19:56:01 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-12-14 20:48:12 +01:00
|
|
|
upgradeOrganization() {
|
|
|
|
this.messagingService.send("upgradeOrganization", { organizationId: this.organization.id });
|
|
|
|
}
|
2018-12-14 19:56:01 +01:00
|
|
|
}
|