fix: move org create into parent routing module (#2765)

This commit is contained in:
Max Peintner 2021-12-01 14:42:15 +01:00 committed by GitHub
parent 30c130f102
commit 524f8e7a84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 173 additions and 172 deletions

View File

@ -4,154 +4,157 @@ import { QuicklinkStrategy } from 'ngx-quicklink';
import { AuthGuard } from './guards/auth.guard'; import { AuthGuard } from './guards/auth.guard';
import { RoleGuard } from './guards/role.guard'; import { RoleGuard } from './guards/role.guard';
import { OrgCreateComponent } from './pages/org-create/org-create.component';
const routes: Routes = [ const routes: Routes = [
{ {
path: '', path: '',
loadChildren: () => import('./pages/home/home.module').then(m => m.HomeModule), loadChildren: () => import('./pages/home/home.module').then((m) => m.HomeModule),
canActivate: [AuthGuard], canActivate: [AuthGuard],
},
{
path: 'firststeps',
loadChildren: () => import('./modules/onboarding/onboarding.module')
.then(m => m.OnboardingModule),
canActivate: [AuthGuard, RoleGuard],
data: {
roles: ['iam.write'],
},
},
{
path: 'granted-projects',
loadChildren: () => import('./pages/projects/granted-projects/granted-projects.module')
.then(m => m.GrantedProjectsModule),
canActivate: [AuthGuard, RoleGuard],
data: {
roles: ['project.grant.read'],
},
},
{
path: 'projects',
loadChildren: () => import('./pages/projects/owned-projects/owned-projects.module')
.then(m => m.OwnedProjectsModule),
canActivate: [AuthGuard, RoleGuard],
data: {
roles: ['project.read'],
},
},
{
path: 'users',
canActivate: [AuthGuard],
children: [
{
path: 'list',
loadChildren: () => import('src/app/pages/users/user-list/user-list.module')
.then(m => m.UserListModule),
canActivate: [RoleGuard],
data: {
roles: ['user.read'],
},
},
{
path: '',
loadChildren: () => import('src/app/pages/users/user-detail/user-detail.module')
.then(m => m.UserDetailModule),
},
],
},
{
path: 'iam',
loadChildren: () => import('./pages/iam/iam.module').then(m => m.IamModule),
canActivate: [AuthGuard, RoleGuard],
data: {
roles: ['iam.read', 'iam.write'],
},
},
{
path: 'org',
loadChildren: () => import('./pages/orgs/orgs.module').then(m => m.OrgsModule),
canActivate: [AuthGuard, RoleGuard],
data: {
roles: ['org.read'],
},
},
{
path: 'actions',
loadChildren: () => import('./pages/actions/actions.module').then(m => m.ActionsModule),
canActivate: [AuthGuard, RoleGuard],
data: {
roles: ['org.read'],
},
}, },
{ {
path: 'grants', path: 'firststeps',
loadChildren: () => import('./pages/grants/grants.module').then(m => m.GrantsModule), loadChildren: () => import('./modules/onboarding/onboarding.module').then((m) => m.OnboardingModule),
canActivate: [AuthGuard, RoleGuard], canActivate: [AuthGuard, RoleGuard],
data: {
roles: ['iam.write'],
},
},
{
path: 'granted-projects',
loadChildren: () =>
import('./pages/projects/granted-projects/granted-projects.module').then((m) => m.GrantedProjectsModule),
canActivate: [AuthGuard, RoleGuard],
data: {
roles: ['project.grant.read'],
},
},
{
path: 'projects',
loadChildren: () => import('./pages/projects/owned-projects/owned-projects.module').then((m) => m.OwnedProjectsModule),
canActivate: [AuthGuard, RoleGuard],
data: {
roles: ['project.read'],
},
},
{
path: 'users',
canActivate: [AuthGuard],
children: [
{
path: 'list',
loadChildren: () => import('src/app/pages/users/user-list/user-list.module').then((m) => m.UserListModule),
canActivate: [RoleGuard],
data: { data: {
roles: ['user.grant.read'], roles: ['user.read'],
}, },
},
{
path: '',
loadChildren: () => import('src/app/pages/users/user-detail/user-detail.module').then((m) => m.UserDetailModule),
},
],
},
{
path: 'iam',
loadChildren: () => import('./pages/iam/iam.module').then((m) => m.IamModule),
canActivate: [AuthGuard, RoleGuard],
data: {
roles: ['iam.read', 'iam.write'],
}, },
{ },
path: 'grant-create', {
canActivate: [AuthGuard], path: 'org',
children: [ loadChildren: () => import('./pages/orgs/orgs.module').then((m) => m.OrgsModule),
{ canActivate: [AuthGuard, RoleGuard],
path: 'project/:projectid/grant/:grantid', data: {
loadChildren: () => import('src/app/pages/user-grant-create/user-grant-create.module') roles: ['org.read'],
.then(m => m.UserGrantCreateModule),
canActivate: [RoleGuard],
data: {
roles: ['user.grant.write'],
},
},
{
path: 'project/:projectid',
loadChildren: () => import('src/app/pages/user-grant-create/user-grant-create.module')
.then(m => m.UserGrantCreateModule),
canActivate: [RoleGuard],
data: {
roles: ['user.grant.write'],
},
},
{
path: 'user/:userid',
loadChildren: () => import('src/app/pages/user-grant-create/user-grant-create.module')
.then(m => m.UserGrantCreateModule),
canActivate: [RoleGuard],
data: {
roles: ['user.grant.write'],
},
},
{
path: '',
loadChildren: () => import('src/app/pages/user-grant-create/user-grant-create.module')
.then(m => m.UserGrantCreateModule),
canActivate: [RoleGuard],
data: {
roles: ['user.grant.write'],
},
},
],
}, },
{ },
path: 'signedout', {
loadChildren: () => import('./pages/signedout/signedout.module').then(m => m.SignedoutModule), path: 'org/create',
component: OrgCreateComponent,
canActivate: [RoleGuard],
data: {
roles: ['(org.create)?(iam.write)?'],
}, },
{ loadChildren: () => import('./pages/org-create/org-create.module').then((m) => m.OrgCreateModule),
path: '**', },
redirectTo: '/', {
path: 'actions',
loadChildren: () => import('./pages/actions/actions.module').then((m) => m.ActionsModule),
canActivate: [AuthGuard, RoleGuard],
data: {
roles: ['org.read'],
}, },
},
{
path: 'grants',
loadChildren: () => import('./pages/grants/grants.module').then((m) => m.GrantsModule),
canActivate: [AuthGuard, RoleGuard],
data: {
roles: ['user.grant.read'],
},
},
{
path: 'grant-create',
canActivate: [AuthGuard],
children: [
{
path: 'project/:projectid/grant/:grantid',
loadChildren: () =>
import('src/app/pages/user-grant-create/user-grant-create.module').then((m) => m.UserGrantCreateModule),
canActivate: [RoleGuard],
data: {
roles: ['user.grant.write'],
},
},
{
path: 'project/:projectid',
loadChildren: () =>
import('src/app/pages/user-grant-create/user-grant-create.module').then((m) => m.UserGrantCreateModule),
canActivate: [RoleGuard],
data: {
roles: ['user.grant.write'],
},
},
{
path: 'user/:userid',
loadChildren: () =>
import('src/app/pages/user-grant-create/user-grant-create.module').then((m) => m.UserGrantCreateModule),
canActivate: [RoleGuard],
data: {
roles: ['user.grant.write'],
},
},
{
path: '',
loadChildren: () =>
import('src/app/pages/user-grant-create/user-grant-create.module').then((m) => m.UserGrantCreateModule),
canActivate: [RoleGuard],
data: {
roles: ['user.grant.write'],
},
},
],
},
{
path: 'signedout',
loadChildren: () => import('./pages/signedout/signedout.module').then((m) => m.SignedoutModule),
},
{
path: '**',
redirectTo: '/',
},
]; ];
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forRoot( RouterModule.forRoot(routes, {
routes, preloadingStrategy: QuicklinkStrategy,
{ relativeLinkResolution: 'legacy',
preloadingStrategy: QuicklinkStrategy, }),
relativeLinkResolution: 'legacy', ],
}, exports: [RouterModule],
),
],
exports: [RouterModule],
}) })
export class AppRoutingModule { } export class AppRoutingModule {}

View File

@ -4,25 +4,15 @@ import { RoleGuard } from 'src/app/guards/role.guard';
import { FeatureServiceType } from 'src/app/modules/features/features.component'; import { FeatureServiceType } from 'src/app/modules/features/features.component';
import { PolicyComponentServiceType, PolicyComponentType } from 'src/app/modules/policies/policy-component-types.enum'; import { PolicyComponentServiceType, PolicyComponentType } from 'src/app/modules/policies/policy-component-types.enum';
import { OrgCreateComponent } from './org-create/org-create.component';
import { OrgDetailComponent } from './org-detail/org-detail.component'; import { OrgDetailComponent } from './org-detail/org-detail.component';
const routes: Routes = [ const routes: Routes = [
{
path: 'create',
component: OrgCreateComponent,
canActivate: [RoleGuard],
data: {
roles: ['(org.create)?(iam.write)?'],
},
loadChildren: () => import('./org-create/org-create.module').then(m => m.OrgCreateModule),
},
{ {
path: 'idp', path: 'idp',
children: [ children: [
{ {
path: 'create', path: 'create',
loadChildren: () => import('src/app/modules/idp-create/idp-create.module').then(m => m.IdpCreateModule), loadChildren: () => import('src/app/modules/idp-create/idp-create.module').then((m) => m.IdpCreateModule),
canActivate: [RoleGuard], canActivate: [RoleGuard],
data: { data: {
roles: ['org.idp.write'], roles: ['org.idp.write'],
@ -31,7 +21,7 @@ const routes: Routes = [
}, },
{ {
path: ':id', path: ':id',
loadChildren: () => import('src/app/modules/idp/idp.module').then(m => m.IdpModule), loadChildren: () => import('src/app/modules/idp/idp.module').then((m) => m.IdpModule),
canActivate: [RoleGuard], canActivate: [RoleGuard],
data: { data: {
roles: ['org.idp.read'], roles: ['org.idp.read'],
@ -42,7 +32,7 @@ const routes: Routes = [
}, },
{ {
path: 'features', path: 'features',
loadChildren: () => import('src/app/modules/features/features.module').then(m => m.FeaturesModule), loadChildren: () => import('src/app/modules/features/features.module').then((m) => m.FeaturesModule),
canActivate: [RoleGuard], canActivate: [RoleGuard],
data: { data: {
roles: ['features.read'], roles: ['features.read'],
@ -57,78 +47,86 @@ const routes: Routes = [
data: { data: {
serviceType: PolicyComponentServiceType.MGMT, serviceType: PolicyComponentServiceType.MGMT,
}, },
loadChildren: () => import('src/app/modules/policies/password-age-policy/password-age-policy.module') loadChildren: () =>
.then(m => m.PasswordAgePolicyModule), import('src/app/modules/policies/password-age-policy/password-age-policy.module').then(
(m) => m.PasswordAgePolicyModule,
),
}, },
{ {
path: PolicyComponentType.LOCKOUT, path: PolicyComponentType.LOCKOUT,
data: { data: {
serviceType: PolicyComponentServiceType.MGMT, serviceType: PolicyComponentServiceType.MGMT,
}, },
loadChildren: () => import('src/app/modules/policies/password-lockout-policy/password-lockout-policy.module') loadChildren: () =>
.then(m => m.PasswordLockoutPolicyModule), import('src/app/modules/policies/password-lockout-policy/password-lockout-policy.module').then(
(m) => m.PasswordLockoutPolicyModule,
),
}, },
{ {
path: PolicyComponentType.PRIVATELABEL, path: PolicyComponentType.PRIVATELABEL,
data: { data: {
serviceType: PolicyComponentServiceType.MGMT, serviceType: PolicyComponentServiceType.MGMT,
}, },
loadChildren: () => import('src/app/modules/policies/private-labeling-policy/private-labeling-policy.module') loadChildren: () =>
.then(m => m.PrivateLabelingPolicyModule), import('src/app/modules/policies/private-labeling-policy/private-labeling-policy.module').then(
(m) => m.PrivateLabelingPolicyModule,
),
}, },
{ {
path: PolicyComponentType.COMPLEXITY, path: PolicyComponentType.COMPLEXITY,
data: { data: {
serviceType: PolicyComponentServiceType.MGMT, serviceType: PolicyComponentServiceType.MGMT,
}, },
loadChildren: () => import('src/app/modules/policies/password-complexity-policy/password-complexity-policy.module') loadChildren: () =>
.then(m => m.PasswordComplexityPolicyModule), import('src/app/modules/policies/password-complexity-policy/password-complexity-policy.module').then(
(m) => m.PasswordComplexityPolicyModule,
),
}, },
{ {
path: PolicyComponentType.IAM, path: PolicyComponentType.IAM,
data: { data: {
serviceType: PolicyComponentServiceType.MGMT, serviceType: PolicyComponentServiceType.MGMT,
}, },
loadChildren: () => import('src/app/modules/policies/org-iam-policy/org-iam-policy.module') loadChildren: () =>
.then(m => m.OrgIamPolicyModule), import('src/app/modules/policies/org-iam-policy/org-iam-policy.module').then((m) => m.OrgIamPolicyModule),
}, },
{ {
path: PolicyComponentType.LOGIN, path: PolicyComponentType.LOGIN,
data: { data: {
serviceType: PolicyComponentServiceType.MGMT, serviceType: PolicyComponentServiceType.MGMT,
}, },
loadChildren: () => import('src/app/modules/policies/login-policy/login-policy.module') loadChildren: () =>
.then(m => m.LoginPolicyModule), import('src/app/modules/policies/login-policy/login-policy.module').then((m) => m.LoginPolicyModule),
}, },
{ {
path: PolicyComponentType.MESSAGETEXTS, path: PolicyComponentType.MESSAGETEXTS,
data: { data: {
serviceType: PolicyComponentServiceType.MGMT, serviceType: PolicyComponentServiceType.MGMT,
}, },
loadChildren: () => import('src/app/modules/policies/message-texts/message-texts.module') loadChildren: () =>
.then(m => m.MessageTextsPolicyModule), import('src/app/modules/policies/message-texts/message-texts.module').then((m) => m.MessageTextsPolicyModule),
}, },
{ {
path: PolicyComponentType.LOGINTEXTS, path: PolicyComponentType.LOGINTEXTS,
data: { data: {
serviceType: PolicyComponentServiceType.MGMT, serviceType: PolicyComponentServiceType.MGMT,
}, },
loadChildren: () => import('src/app/modules/policies/login-texts/login-texts.module') loadChildren: () =>
.then(m => m.LoginTextsPolicyModule), import('src/app/modules/policies/login-texts/login-texts.module').then((m) => m.LoginTextsPolicyModule),
}, },
{ {
path: PolicyComponentType.PRIVACYPOLICY, path: PolicyComponentType.PRIVACYPOLICY,
data: { data: {
serviceType: PolicyComponentServiceType.MGMT, serviceType: PolicyComponentServiceType.MGMT,
}, },
loadChildren: () => import('src/app/modules/policies/privacy-policy/privacy-policy.module') loadChildren: () =>
.then(m => m.PrivacyPolicyModule), import('src/app/modules/policies/privacy-policy/privacy-policy.module').then((m) => m.PrivacyPolicyModule),
}, },
], ],
}, },
{ {
path: 'members', path: 'members',
loadChildren: () => import('./org-members/org-members.module').then(m => m.OrgMembersModule), loadChildren: () => import('./org-members/org-members.module').then((m) => m.OrgMembersModule),
}, },
{ {
path: '', path: '',
@ -136,7 +134,7 @@ const routes: Routes = [
}, },
{ {
path: 'overview', path: 'overview',
loadChildren: () => import('./org-list/org-list.module').then(m => m.OrgListModule), loadChildren: () => import('./org-list/org-list.module').then((m) => m.OrgListModule),
}, },
]; ];
@ -144,4 +142,4 @@ const routes: Routes = [
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(routes)],
exports: [RouterModule], exports: [RouterModule],
}) })
export class OrgsRoutingModule { } export class OrgsRoutingModule {}