Commit cf60758d authored by Homada.Boumedane's avatar Homada.Boumedane Committed by Florent Poittevin
Browse files

refactor(dlcm-portal): deactivate guard

Add deactivate guard in admin's feature
parent 1e5e144d
......@@ -10,7 +10,6 @@ import {
} from "@app/shared/enums/routes.enum";
import {ApplicationRoleGuardService} from "@app/shared/guards/application-role-guard.service";
import {AuthGuardService} from "@shared/guards/auth-guard.service";
import {CanDeactivateGuard} from "@shared/services/can-deactivate-guard.service";
import {TRANSLATE} from "solidify-frontend";
const routes: Routes = [
......@@ -26,7 +25,7 @@ const routes: Routes = [
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.license.root"),
},
canActivate: [AuthGuardService, ApplicationRoleGuardService, CanDeactivateGuard],
canActivate: [AuthGuardService, ApplicationRoleGuardService],
},
{
path: AdminRoutesEnum.institution,
......@@ -35,7 +34,7 @@ const routes: Routes = [
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.institution.root"),
},
canActivate: [AuthGuardService, ApplicationRoleGuardService, CanDeactivateGuard],
canActivate: [AuthGuardService, ApplicationRoleGuardService],
},
{
path: AdminRoutesEnum.fundingAgencies,
......@@ -44,7 +43,7 @@ const routes: Routes = [
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.funding-agencies.root"),
},
canActivate: [AuthGuardService, ApplicationRoleGuardService, CanDeactivateGuard],
canActivate: [AuthGuardService, ApplicationRoleGuardService],
},
{
path: AdminRoutesEnum.oauth2client,
......@@ -53,7 +52,7 @@ const routes: Routes = [
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.oauth2Client.root"),
},
canActivate: [AuthGuardService, ApplicationRoleGuardService, CanDeactivateGuard],
canActivate: [AuthGuardService, ApplicationRoleGuardService],
},
{
path: AdminRoutesEnum.organizationalUnit,
......@@ -62,7 +61,16 @@ const routes: Routes = [
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.organizationalUnit.root"),
},
canActivate: [AuthGuardService, ApplicationRoleGuardService, CanDeactivateGuard],
canActivate: [AuthGuardService, ApplicationRoleGuardService],
},
{
path: AdminRoutesEnum.submissionPolicy,
// @ts-ignore Dynamic import
loadChildren: () => import("./submission-policy/submission-policy.module").then(m => m.AdminSubmissionPolicyModule),
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.submissionPolicy.root"),
},
canActivate: [AuthGuardService, ApplicationRoleGuardService],
},
{
path: AdminRoutesEnum.person,
......@@ -71,7 +79,7 @@ const routes: Routes = [
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.person.root"),
},
canActivate: [AuthGuardService, ApplicationRoleGuardService, CanDeactivateGuard],
canActivate: [AuthGuardService, ApplicationRoleGuardService],
},
{
path: AdminRoutesEnum.preservationPolicy,
......@@ -80,7 +88,7 @@ const routes: Routes = [
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.preservationPolicy.root"),
},
canActivate: [AuthGuardService, ApplicationRoleGuardService, CanDeactivateGuard],
canActivate: [AuthGuardService, ApplicationRoleGuardService],
},
{
path: AdminRoutesEnum.role,
......@@ -89,7 +97,7 @@ const routes: Routes = [
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.role.root"),
},
canActivate: [AuthGuardService, ApplicationRoleGuardService, CanDeactivateGuard],
canActivate: [AuthGuardService, ApplicationRoleGuardService],
},
{
path: AdminRoutesEnum.user,
......@@ -98,7 +106,7 @@ const routes: Routes = [
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.user.root"),
},
canActivate: [AuthGuardService, ApplicationRoleGuardService, CanDeactivateGuard],
canActivate: [AuthGuardService, ApplicationRoleGuardService],
},
];
......
......@@ -11,6 +11,7 @@ import {
AdminRoutesEnum,
AppRoutesEnum,
} from "@shared/enums/routes.enum";
import {CanDeactivateGuard} from "@shared/services/can-deactivate-guard.service";
import {TRANSLATE} from "solidify-frontend";
const routes: Routes = [
......@@ -34,6 +35,7 @@ const routes: Routes = [
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.funding-agencies.detail"),
},
canDeactivate: [CanDeactivateGuard]
},
{
component: AdminFundingAgenciesCreateRoutable,
......@@ -41,6 +43,7 @@ const routes: Routes = [
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.funding-agencies.create"),
},
canDeactivate: [CanDeactivateGuard]
},
];
......
......@@ -11,6 +11,7 @@ import {
AdminRoutesEnum,
AppRoutesEnum,
} from "@shared/enums/routes.enum";
import {CanDeactivateGuard} from "@shared/services/can-deactivate-guard.service";
import {TRANSLATE} from "solidify-frontend";
const routes: Routes = [
......@@ -34,6 +35,7 @@ const routes: Routes = [
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.institution.create"),
},
canDeactivate: [CanDeactivateGuard]
},
{
path: AdminRoutesEnum.institutionEdit + AppRoutesEnum.separator + AppRoutesEnum.paramId,
......@@ -41,6 +43,7 @@ const routes: Routes = [
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.institution.edit"),
},
canDeactivate: [CanDeactivateGuard]
},
];
......
......@@ -11,6 +11,7 @@ import {
AdminRoutesEnum,
AppRoutesEnum,
} from "@shared/enums/routes.enum";
import {CanDeactivateGuard} from "@shared/services/can-deactivate-guard.service";
import {TRANSLATE} from "solidify-frontend";
const routes: Routes = [
......@@ -27,6 +28,7 @@ const routes: Routes = [
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.license.create"),
},
canDeactivate: [CanDeactivateGuard]
},
{
path: AdminRoutesEnum.licenseEdit + AppRoutesEnum.separator + AppRoutesEnum.paramId,
......@@ -34,6 +36,7 @@ const routes: Routes = [
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.license.edit"),
},
canDeactivate: [CanDeactivateGuard]
},
{
path: AdminRoutesEnum.licenseDetail + AppRoutesEnum.separator + AppRoutesEnum.paramId,
......
......@@ -11,6 +11,7 @@ import {
AdminRoutesEnum,
AppRoutesEnum,
} from "@shared/enums/routes.enum";
import {CanDeactivateGuard} from "@shared/services/can-deactivate-guard.service";
import {TRANSLATE} from "solidify-frontend";
const routes: Routes = [
......@@ -22,18 +23,19 @@ const routes: Routes = [
},
},
{
component: AdminOAuth2ClientCreateRoutable,
path: AdminRoutesEnum.oauth2clientCreate,
path: AdminRoutesEnum.oauth2clientDetail + AppRoutesEnum.separator + AppRoutesEnum.paramId,
component: AdminOAuth2ClientDetailRoutable,
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.oauth2Client.create"),
breadcrumb: TRANSLATE("breadcrumb.admin.oauth2Client.detail"),
},
},
{
path: AdminRoutesEnum.oauth2clientDetail + AppRoutesEnum.separator + AppRoutesEnum.paramId,
component: AdminOAuth2ClientDetailRoutable,
component: AdminOAuth2ClientCreateRoutable,
path: AdminRoutesEnum.oauth2clientCreate,
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.oauth2Client.detail"),
breadcrumb: TRANSLATE("breadcrumb.admin.oauth2Client.create"),
},
canDeactivate: [CanDeactivateGuard]
},
{
path: AdminRoutesEnum.oauth2clientEdit + AppRoutesEnum.separator + AppRoutesEnum.paramId,
......@@ -41,6 +43,7 @@ const routes: Routes = [
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.oauth2Client.edit"),
},
canDeactivate: [CanDeactivateGuard]
},
];
......
......@@ -11,6 +11,7 @@ import {
AdminRoutesEnum,
AppRoutesEnum,
} from "@shared/enums/routes.enum";
import {CanDeactivateGuard} from "@shared/services/can-deactivate-guard.service";
import {TRANSLATE} from "solidify-frontend";
const routes: Routes = [
......@@ -34,6 +35,7 @@ const routes: Routes = [
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.organizationalUnit.edit"),
},
canDeactivate: [CanDeactivateGuard]
},
{
path: AdminRoutesEnum.organizationalUnitCreate,
......@@ -41,6 +43,7 @@ const routes: Routes = [
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.organizationalUnit.create"),
},
canDeactivate: [CanDeactivateGuard]
},
];
......
......@@ -13,6 +13,7 @@ import {
AppRoutesEnum,
} from "@shared/enums/routes.enum";
import {ApplicationRoleGuardService} from "@shared/guards/application-role-guard.service";
import {CanDeactivateGuard} from "@shared/services/can-deactivate-guard.service";
import {TRANSLATE} from "solidify-frontend";
const routes: Routes = [
......@@ -39,6 +40,7 @@ const routes: Routes = [
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.person.create"),
},
canDeactivate: [CanDeactivateGuard]
},
{
path: AdminRoutesEnum.personEdit + AppRoutesEnum.separator + AppRoutesEnum.paramId,
......@@ -46,6 +48,7 @@ const routes: Routes = [
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.person.edit"),
},
canDeactivate: [CanDeactivateGuard]
},
];
......
import {AdminOrgunitRoutingModule} from "@admin/orgunit/orgunit-routing.module";
import {AdminPersonDeleteDialog} from "@admin/person/components/dialogs/admin-person-delete.dialog";
import {AdminPersonForm} from "@admin/person/components/presentationals/admin-person-form";
import {AdminPersonCreateRoutable} from "@admin/person/components/routables/create/admin-person-create.routable";
import {AdminPersonDetailRoutable} from "@admin/person/components/routables/detail/admin-person-detail.routable";
import {AdminPersonEditRoutable} from "@admin/person/components/routables/edit/admin-person-edit.routable";
import {AdminPersonListRoutable} from "@admin/person/components/routables/list/admin-person-list-routable";
import {AdminPersonRoutingModule} from "@admin/person/person-routing.module";
import {AdminPersonState} from "@admin/person/stores/admin-person.state";
import {NgModule} from "@angular/core";
import {SharedModule} from "@app/shared/shared.module";
......@@ -34,7 +34,7 @@ const presentationals = [
],
imports: [
SharedModule,
AdminOrgunitRoutingModule,
AdminPersonRoutingModule,
TranslateModule.forChild({}),
NgxsModule.forFeature([
AdminPersonState,
......
......@@ -11,6 +11,7 @@ import {
AdminRoutesEnum,
AppRoutesEnum,
} from "@shared/enums/routes.enum";
import {CanDeactivateGuard} from "@shared/services/can-deactivate-guard.service";
import {TRANSLATE} from "solidify-frontend";
const routes: Routes = [
......@@ -22,25 +23,27 @@ const routes: Routes = [
},
},
{
path: AdminRoutesEnum.preservationPolicy + AppRoutesEnum.separator + AdminRoutesEnum.preservationPolicyDetail + AppRoutesEnum.separator + AppRoutesEnum.paramId,
path: AdminRoutesEnum.preservationPolicyDetail + AppRoutesEnum.separator + AppRoutesEnum.paramId,
component: AdminPreservationPolicyDetailRoutable,
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.preservationPolicy.detail"),
},
},
{
path: AdminRoutesEnum.preservationPolicy + AppRoutesEnum.separator + AdminRoutesEnum.preservationPolicyCreate,
path: AdminRoutesEnum.preservationPolicyCreate,
component: AdminPreservationPolicyCreateRoutable,
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.preservationPolicy.create"),
},
canDeactivate: [CanDeactivateGuard]
},
{
path: AdminRoutesEnum.preservationPolicy + AppRoutesEnum.separator + AdminRoutesEnum.preservationPolicyEdit + AppRoutesEnum.separator + AppRoutesEnum.paramId,
path: AdminRoutesEnum.preservationPolicyEdit + AppRoutesEnum.separator + AppRoutesEnum.paramId,
component: AdminPreservationPolicyEditRoutable,
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.preservationPolicy.edit"),
},
canDeactivate: [CanDeactivateGuard]
},
];
......
......@@ -11,6 +11,7 @@ import {
AdminRoutesEnum,
AppRoutesEnum,
} from "@shared/enums/routes.enum";
import {CanDeactivateGuard} from "@shared/services/can-deactivate-guard.service";
import {TRANSLATE} from "solidify-frontend";
const routes: Routes = [
......@@ -22,18 +23,19 @@ const routes: Routes = [
},
},
{
component: AdminRoleCreateRoutable,
path: AdminRoutesEnum.roleCreate,
path: AdminRoutesEnum.roleDetail + AppRoutesEnum.separator + AppRoutesEnum.paramId,
component: AdminRoleDetailRoutable,
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.role.create"),
breadcrumb: TRANSLATE("breadcrumb.admin.role.detail"),
},
},
{
path: AdminRoutesEnum.roleDetail + AppRoutesEnum.separator + AppRoutesEnum.paramId,
component: AdminRoleDetailRoutable,
component: AdminRoleCreateRoutable,
path: AdminRoutesEnum.roleCreate,
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.role.detail"),
breadcrumb: TRANSLATE("breadcrumb.admin.role.create"),
},
canDeactivate: [CanDeactivateGuard]
},
{
path: AdminRoutesEnum.roleEdit + AppRoutesEnum.separator + AppRoutesEnum.paramId,
......@@ -41,6 +43,7 @@ const routes: Routes = [
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.role.edit"),
},
canDeactivate: [CanDeactivateGuard]
},
];
......
......@@ -11,6 +11,7 @@ import {
AdminRoutesEnum,
AppRoutesEnum,
} from "@shared/enums/routes.enum";
import {CanDeactivateGuard} from "@shared/services/can-deactivate-guard.service";
import {TRANSLATE} from "solidify-frontend";
const routes: Routes = [
......@@ -22,25 +23,27 @@ const routes: Routes = [
},
},
{
path: AdminRoutesEnum.submissionPolicy + AppRoutesEnum.separator + AdminRoutesEnum.submissionPolicyDetail + AppRoutesEnum.separator + AppRoutesEnum.paramId,
path: AdminRoutesEnum.submissionPolicyDetail + AppRoutesEnum.separator + AppRoutesEnum.paramId,
component: AdminSubmissionPolicyDetailRoutable,
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.submissionPolicy.detail"),
},
},
{
path: AdminRoutesEnum.submissionPolicy + AppRoutesEnum.separator + AdminRoutesEnum.submissionPolicyEdit + AppRoutesEnum.separator + AppRoutesEnum.paramId,
path: AdminRoutesEnum.submissionPolicyEdit + AppRoutesEnum.separator + AppRoutesEnum.paramId,
component: AdminSubmissionPolicyEditRoutable,
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.submissionPolicy.edit"),
},
canDeactivate: [CanDeactivateGuard]
},
{
path: AdminRoutesEnum.submissionPolicy + AppRoutesEnum.separator + AdminRoutesEnum.submissionPolicyCreate,
path: AdminRoutesEnum.submissionPolicyCreate,
component: AdminSubmissionPolicyCreateRoutable,
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.submissionPolicy.create"),
},
canDeactivate: [CanDeactivateGuard]
},
];
......
......@@ -13,6 +13,7 @@ import {
AppRoutesEnum,
} from "@shared/enums/routes.enum";
import {ApplicationRoleGuardService} from "@shared/guards/application-role-guard.service";
import {CanDeactivateGuard} from "@shared/services/can-deactivate-guard.service";
import {TRANSLATE} from "solidify-frontend";
const routes: Routes = [
......@@ -39,6 +40,7 @@ const routes: Routes = [
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.user.create"),
},
canDeactivate: [CanDeactivateGuard]
},
{
path: AdminRoutesEnum.userEdit + AppRoutesEnum.separator + AppRoutesEnum.paramId,
......@@ -46,6 +48,7 @@ const routes: Routes = [
data: {
breadcrumb: TRANSLATE("breadcrumb.admin.user.edit"),
},
canDeactivate: [CanDeactivateGuard]
},
];
......
......@@ -67,5 +67,5 @@ export class CustomMatPaginatorIntlService extends MatPaginatorIntl implements O
const startIndex = page * pageSize;
const endIndex = startIndex < length ? Math.min(startIndex + pageSize, length) : startIndex + pageSize;
return `${startIndex + 1} - ${endIndex} ${this.ofLabel} ${length}`;
};
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment