[master | ADDED | WIP]: Add sandbox guard for managers.

This commit is contained in:
Konstantinos Triantafyllou 2023-12-22 19:13:26 +02:00
parent 5888d9e3ff
commit fcde529e5a
5 changed files with 27 additions and 8 deletions

View File

@ -7,12 +7,13 @@ import {RoleVerificationModule} from "../openaireLibrary/role-verification/role-
import {IconsModule} from "../openaireLibrary/utils/icons/icons.module";
import {IconsService} from "../openaireLibrary/utils/icons/icons.service";
import {open_access} from "../openaireLibrary/utils/icons/icons";
import {SandboxGuard} from "../shared/sandbox.guard";
const routes: Route[] = [
{
path: '', component: NationalComponent, children: [
{path: 'search', loadChildren: () => import('../search/search.module').then(m => m.SearchModule), data: {activeMenuItem: "national"}},
{path: '', loadChildren: () => import('../shared/monitor/monitor.module').then(m => m.MonitorModule), data: {activeMenuItem: "national"}},
{path: 'search', loadChildren: () => import('../search/search.module').then(m => m.SearchModule), data: {activeMenuItem: "national"}, canActivateChild: [SandboxGuard]},
{path: '', loadChildren: () => import('../shared/monitor/monitor.module').then(m => m.MonitorModule), data: {activeMenuItem: "national"}, canActivateChild: [SandboxGuard]},
], data: {stakeholder: 'irish'}
}
];

View File

@ -10,13 +10,14 @@ import {EntityMetadataModule} from "../openaireLibrary/landingPages/landing-util
import {IconsService} from "../openaireLibrary/utils/icons/icons.service";
import {open_access} from "../openaireLibrary/utils/icons/icons";
import {LogoUrlPipeModule} from "../openaireLibrary/utils/pipes/logoUrlPipe.module";
import {SandboxGuard} from "../shared/sandbox.guard";
const routes: Route[] = [
{
path: '', component: RepositoryComponent, children: [
{path: '', loadChildren: () => import('./browse-repositories/browse-repositories.module').then(m => m.BrowseRepositoriesModule)},
{path: ':stakeholder/search', loadChildren: () => import('../search/resultLanding.module').then(m => m.ResultLandingModule)},
{path: ':stakeholder', loadChildren: () => import('../shared/monitor/monitor.module').then(m => m.MonitorModule)}
{path: ':stakeholder/search', loadChildren: () => import('../search/resultLanding.module').then(m => m.ResultLandingModule), canActivateChild: [SandboxGuard]},
{path: ':stakeholder', loadChildren: () => import('../shared/monitor/monitor.module').then(m => m.MonitorModule), canActivateChild: [SandboxGuard]}
]
}
];

View File

@ -8,13 +8,14 @@ import {IconsModule} from "../openaireLibrary/utils/icons/icons.module";
import {LogoUrlPipeModule} from "../openaireLibrary/utils/pipes/logoUrlPipe.module";
import {IconsService} from "../openaireLibrary/utils/icons/icons.service";
import {open_access} from "../openaireLibrary/utils/icons/icons";
import {SandboxGuard} from "../shared/sandbox.guard";
const routes: Route[] = [
{
path: '', component: RfoComponent, children: [
{path: '', loadChildren: () => import('../shared/browse-stakeholders/browse-stakeholders.module').then(m => m.BrowseStakeholdersModule)},
{path: ':stakeholder/search', loadChildren: () => import('../search/resultLanding.module').then(m => m.ResultLandingModule)},
{path: ':stakeholder', loadChildren: () => import('../shared/monitor/monitor.module').then(m => m.MonitorModule)}
{path: ':stakeholder/search', loadChildren: () => import('../search/resultLanding.module').then(m => m.ResultLandingModule), canActivateChild: [SandboxGuard]},
{path: ':stakeholder', loadChildren: () => import('../shared/monitor/monitor.module').then(m => m.MonitorModule), canActivateChild: [SandboxGuard]}
]
}
];

View File

@ -8,13 +8,14 @@ import {IconsModule} from "../openaireLibrary/utils/icons/icons.module";
import {LogoUrlPipeModule} from "../openaireLibrary/utils/pipes/logoUrlPipe.module";
import {IconsService} from "../openaireLibrary/utils/icons/icons.service";
import {open_access} from "../openaireLibrary/utils/icons/icons";
import {SandboxGuard} from "../shared/sandbox.guard";
const routes: Route[] = [
{
path: '', component: RpoComponent, children: [
{path: '', loadChildren: () => import('../shared/browse-stakeholders/browse-stakeholders.module').then(m => m.BrowseStakeholdersModule)},
{path: ':stakeholder/search', loadChildren: () => import('../search/resultLanding.module').then(m => m.ResultLandingModule)},
{path: ':stakeholder', loadChildren: () => import('../shared/monitor/monitor.module').then(m => m.MonitorModule)}
{path: ':stakeholder/search', loadChildren: () => import('../search/resultLanding.module').then(m => m.ResultLandingModule), canActivateChild: [SandboxGuard]},
{path: ':stakeholder', loadChildren: () => import('../shared/monitor/monitor.module').then(m => m.MonitorModule), canActivateChild: [SandboxGuard]}
]
}
];

View File

@ -0,0 +1,15 @@
import {AdminDashboardGuard} from "../openaireLibrary/monitor-admin/utils/adminDashboard.guard";
import {Injectable} from "@angular/core";
import {ActivatedRouteSnapshot, RouterStateSnapshot, UrlTree} from "@angular/router";
import {Observable} from "rxjs";
import {properties} from "../../environments/environment";
@Injectable({
providedIn: 'root'
})
export class SandboxGuard extends AdminDashboardGuard {
canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
return properties.environment != 'beta' || super.canActivateChild(childRoute, state);
}
}