2022-05-09 14:21:52 +02:00
|
|
|
import { NgModule } from "@angular/core";
|
|
|
|
import { RouterModule, Routes } from "@angular/router";
|
|
|
|
|
2022-06-14 17:10:53 +02:00
|
|
|
import { AuthGuard } from "@bitwarden/angular/guards/auth.guard";
|
2022-09-27 22:25:19 +02:00
|
|
|
import {
|
|
|
|
canAccessOrgAdmin,
|
|
|
|
canAccessManageTab,
|
|
|
|
canAccessSettingsTab,
|
|
|
|
canAccessToolsTab,
|
|
|
|
} from "@bitwarden/common/abstractions/organization/organization.service.abstraction";
|
2022-08-15 16:08:06 +02:00
|
|
|
import { Organization } from "@bitwarden/common/models/domain/organization";
|
2022-05-09 14:21:52 +02:00
|
|
|
|
2022-08-15 16:08:06 +02:00
|
|
|
import { OrganizationPermissionsGuard } from "./guards/org-permissions.guard";
|
2022-05-09 14:21:52 +02:00
|
|
|
import { OrganizationLayoutComponent } from "./layouts/organization-layout.component";
|
|
|
|
import { CollectionsComponent } from "./manage/collections.component";
|
|
|
|
import { EventsComponent } from "./manage/events.component";
|
|
|
|
import { GroupsComponent } from "./manage/groups.component";
|
|
|
|
import { ManageComponent } from "./manage/manage.component";
|
|
|
|
import { PeopleComponent } from "./manage/people.component";
|
|
|
|
import { PoliciesComponent } from "./manage/policies.component";
|
|
|
|
import { AccountComponent } from "./settings/account.component";
|
|
|
|
import { OrganizationBillingComponent } from "./settings/organization-billing.component";
|
|
|
|
import { OrganizationSubscriptionComponent } from "./settings/organization-subscription.component";
|
|
|
|
import { SettingsComponent } from "./settings/settings.component";
|
|
|
|
import { TwoFactorSetupComponent } from "./settings/two-factor-setup.component";
|
|
|
|
import { ExposedPasswordsReportComponent } from "./tools/exposed-passwords-report.component";
|
|
|
|
import { InactiveTwoFactorReportComponent } from "./tools/inactive-two-factor-report.component";
|
|
|
|
import { ReusedPasswordsReportComponent } from "./tools/reused-passwords-report.component";
|
|
|
|
import { ToolsComponent } from "./tools/tools.component";
|
|
|
|
import { UnsecuredWebsitesReportComponent } from "./tools/unsecured-websites-report.component";
|
|
|
|
import { WeakPasswordsReportComponent } from "./tools/weak-passwords-report.component";
|
2022-08-08 21:08:35 +02:00
|
|
|
import { VaultModule } from "./vault/vault.module";
|
2022-05-09 14:21:52 +02:00
|
|
|
|
|
|
|
const routes: Routes = [
|
|
|
|
{
|
|
|
|
path: ":organizationId",
|
|
|
|
component: OrganizationLayoutComponent,
|
2022-08-15 16:08:06 +02:00
|
|
|
canActivate: [AuthGuard, OrganizationPermissionsGuard],
|
2022-05-09 14:21:52 +02:00
|
|
|
data: {
|
2022-08-15 16:08:06 +02:00
|
|
|
organizationPermissions: canAccessOrgAdmin,
|
2022-05-09 14:21:52 +02:00
|
|
|
},
|
|
|
|
children: [
|
|
|
|
{ path: "", pathMatch: "full", redirectTo: "vault" },
|
|
|
|
{
|
|
|
|
path: "vault",
|
2022-08-08 21:08:35 +02:00
|
|
|
loadChildren: () => VaultModule,
|
2022-05-09 14:21:52 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "tools",
|
|
|
|
component: ToolsComponent,
|
2022-08-15 16:08:06 +02:00
|
|
|
canActivate: [OrganizationPermissionsGuard],
|
|
|
|
data: {
|
|
|
|
organizationPermissions: canAccessToolsTab,
|
|
|
|
},
|
2022-05-09 14:21:52 +02:00
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: "",
|
|
|
|
pathMatch: "full",
|
|
|
|
redirectTo: "import",
|
|
|
|
},
|
|
|
|
{
|
2022-06-28 22:24:21 +02:00
|
|
|
path: "",
|
|
|
|
loadChildren: () =>
|
|
|
|
import("./tools/import-export/org-import-export.module").then(
|
|
|
|
(m) => m.OrganizationImportExportModule
|
|
|
|
),
|
2022-05-09 14:21:52 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "exposed-passwords-report",
|
|
|
|
component: ExposedPasswordsReportComponent,
|
2022-08-15 16:08:06 +02:00
|
|
|
canActivate: [OrganizationPermissionsGuard],
|
2022-05-09 14:21:52 +02:00
|
|
|
data: {
|
|
|
|
titleId: "exposedPasswordsReport",
|
2022-08-15 16:08:06 +02:00
|
|
|
organizationPermissions: (org: Organization) => org.canAccessReports,
|
2022-05-09 14:21:52 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "inactive-two-factor-report",
|
|
|
|
component: InactiveTwoFactorReportComponent,
|
2022-08-15 16:08:06 +02:00
|
|
|
canActivate: [OrganizationPermissionsGuard],
|
2022-05-09 14:21:52 +02:00
|
|
|
data: {
|
|
|
|
titleId: "inactive2faReport",
|
2022-08-15 16:08:06 +02:00
|
|
|
organizationPermissions: (org: Organization) => org.canAccessReports,
|
2022-05-09 14:21:52 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "reused-passwords-report",
|
|
|
|
component: ReusedPasswordsReportComponent,
|
2022-08-15 16:08:06 +02:00
|
|
|
canActivate: [OrganizationPermissionsGuard],
|
2022-05-09 14:21:52 +02:00
|
|
|
data: {
|
|
|
|
titleId: "reusedPasswordsReport",
|
2022-08-15 16:08:06 +02:00
|
|
|
organizationPermissions: (org: Organization) => org.canAccessReports,
|
2022-05-09 14:21:52 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "unsecured-websites-report",
|
|
|
|
component: UnsecuredWebsitesReportComponent,
|
2022-08-15 16:08:06 +02:00
|
|
|
canActivate: [OrganizationPermissionsGuard],
|
2022-05-09 14:21:52 +02:00
|
|
|
data: {
|
|
|
|
titleId: "unsecuredWebsitesReport",
|
2022-08-15 16:08:06 +02:00
|
|
|
organizationPermissions: (org: Organization) => org.canAccessReports,
|
2022-05-09 14:21:52 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "weak-passwords-report",
|
|
|
|
component: WeakPasswordsReportComponent,
|
2022-08-15 16:08:06 +02:00
|
|
|
canActivate: [OrganizationPermissionsGuard],
|
2022-05-09 14:21:52 +02:00
|
|
|
data: {
|
|
|
|
titleId: "weakPasswordsReport",
|
2022-08-15 16:08:06 +02:00
|
|
|
organizationPermissions: (org: Organization) => org.canAccessReports,
|
2022-05-09 14:21:52 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "manage",
|
|
|
|
component: ManageComponent,
|
2022-08-15 16:08:06 +02:00
|
|
|
canActivate: [OrganizationPermissionsGuard],
|
2022-05-09 14:21:52 +02:00
|
|
|
data: {
|
2022-08-15 16:08:06 +02:00
|
|
|
organizationPermissions: canAccessManageTab,
|
2022-05-09 14:21:52 +02:00
|
|
|
},
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
path: "",
|
|
|
|
pathMatch: "full",
|
|
|
|
redirectTo: "people",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "collections",
|
|
|
|
component: CollectionsComponent,
|
2022-08-15 16:08:06 +02:00
|
|
|
canActivate: [OrganizationPermissionsGuard],
|
2022-05-09 14:21:52 +02:00
|
|
|
data: {
|
|
|
|
titleId: "collections",
|
2022-08-15 16:08:06 +02:00
|
|
|
organizationPermissions: (org: Organization) =>
|
|
|
|
org.canCreateNewCollections ||
|
|
|
|
org.canEditAnyCollection ||
|
|
|
|
org.canDeleteAnyCollection ||
|
|
|
|
org.canEditAssignedCollections ||
|
|
|
|
org.canDeleteAssignedCollections,
|
2022-05-09 14:21:52 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "events",
|
|
|
|
component: EventsComponent,
|
2022-08-15 16:08:06 +02:00
|
|
|
canActivate: [OrganizationPermissionsGuard],
|
2022-05-09 14:21:52 +02:00
|
|
|
data: {
|
|
|
|
titleId: "eventLogs",
|
2022-08-15 16:08:06 +02:00
|
|
|
organizationPermissions: (org: Organization) => org.canAccessEventLogs,
|
2022-05-09 14:21:52 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "groups",
|
|
|
|
component: GroupsComponent,
|
2022-08-15 16:08:06 +02:00
|
|
|
canActivate: [OrganizationPermissionsGuard],
|
2022-05-09 14:21:52 +02:00
|
|
|
data: {
|
|
|
|
titleId: "groups",
|
2022-08-15 16:08:06 +02:00
|
|
|
organizationPermissions: (org: Organization) => org.canManageGroups,
|
2022-05-09 14:21:52 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "people",
|
|
|
|
component: PeopleComponent,
|
2022-08-15 16:08:06 +02:00
|
|
|
canActivate: [OrganizationPermissionsGuard],
|
2022-05-09 14:21:52 +02:00
|
|
|
data: {
|
|
|
|
titleId: "people",
|
2022-08-15 16:08:06 +02:00
|
|
|
organizationPermissions: (org: Organization) =>
|
|
|
|
org.canManageUsers || org.canManageUsersPassword,
|
2022-05-09 14:21:52 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "policies",
|
|
|
|
component: PoliciesComponent,
|
2022-08-15 16:08:06 +02:00
|
|
|
canActivate: [OrganizationPermissionsGuard],
|
2022-05-09 14:21:52 +02:00
|
|
|
data: {
|
|
|
|
titleId: "policies",
|
2022-08-15 16:08:06 +02:00
|
|
|
organizationPermissions: (org: Organization) => org.canManagePolicies,
|
2022-05-09 14:21:52 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "settings",
|
|
|
|
component: SettingsComponent,
|
2022-08-15 16:08:06 +02:00
|
|
|
canActivate: [OrganizationPermissionsGuard],
|
|
|
|
data: { organizationPermissions: canAccessSettingsTab },
|
2022-05-09 14:21:52 +02:00
|
|
|
children: [
|
|
|
|
{ path: "", pathMatch: "full", redirectTo: "account" },
|
|
|
|
{ path: "account", component: AccountComponent, data: { titleId: "myOrganization" } },
|
|
|
|
{
|
|
|
|
path: "two-factor",
|
|
|
|
component: TwoFactorSetupComponent,
|
|
|
|
data: { titleId: "twoStepLogin" },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "billing",
|
|
|
|
component: OrganizationBillingComponent,
|
2022-08-15 16:08:06 +02:00
|
|
|
canActivate: [OrganizationPermissionsGuard],
|
|
|
|
data: {
|
|
|
|
titleId: "billing",
|
|
|
|
organizationPermissions: (org: Organization) => org.canManageBilling,
|
|
|
|
},
|
2022-05-09 14:21:52 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
path: "subscription",
|
|
|
|
component: OrganizationSubscriptionComponent,
|
|
|
|
data: { titleId: "subscription" },
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
@NgModule({
|
|
|
|
imports: [RouterModule.forChild(routes)],
|
|
|
|
exports: [RouterModule],
|
|
|
|
})
|
|
|
|
export class OrganizationsRoutingModule {}
|