Add subscribe Guard in linking and direct linking

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@51827 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2018-04-16 11:50:13 +00:00
parent f452a63947
commit f39f19a147
4 changed files with 12 additions and 6 deletions

View File

@ -5,12 +5,13 @@ import { OpenaireDirectLinkingComponent } from './directLinking.component';
import {LoginGuard} from '../../openaireLibrary/login/loginGuard.guard'; import {LoginGuard} from '../../openaireLibrary/login/loginGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'; import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
import {ConnectSubscriberGuard} from '../../openaireLibrary/connect/communityGuard/connectSubscriber.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: OpenaireDirectLinkingComponent, canActivate: [IsRouteEnabled, LoginGuard], data: { { path: '', component: OpenaireDirectLinkingComponent, canActivate: [IsRouteEnabled, LoginGuard, ConnectSubscriberGuard], data: {
redirect: '/error' redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder]}, }, canDeactivate: [PreviousRouteRecorder]},
]) ])

View File

@ -7,12 +7,14 @@ import {DirectLinkingRoutingModule} from './directLinking-routing.module';
import {LoginGuard} from '../../openaireLibrary/login/loginGuard.guard'; import {LoginGuard} from '../../openaireLibrary/login/loginGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'; import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
import {ConnectSubscriberGuard} from '../../openaireLibrary/connect/communityGuard/connectSubscriber.guard';
import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
@NgModule({ @NgModule({
imports: [ imports: [
SharedModule, DirectLinkingModule, DirectLinkingRoutingModule SharedModule, DirectLinkingModule, DirectLinkingRoutingModule
], ],
providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled], providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled, ConnectSubscriberGuard, CommunityService],
declarations: [ declarations: [
OpenaireDirectLinkingComponent OpenaireDirectLinkingComponent
], exports:[OpenaireDirectLinkingComponent] ], exports:[OpenaireDirectLinkingComponent]

View File

@ -5,12 +5,13 @@ import { OpenaireLinkingComponent } from './linkingGeneric.component';
import {LoginGuard} from '../../openaireLibrary/login/loginGuard.guard'; import {LoginGuard} from '../../openaireLibrary/login/loginGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'; import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
import {ConnectSubscriberGuard} from '../../openaireLibrary/connect/communityGuard/connectSubscriber.guard';
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forChild([ RouterModule.forChild([
{ path: '', component: OpenaireLinkingComponent, canActivate: [IsRouteEnabled, LoginGuard], data: { { path: '', component: OpenaireLinkingComponent, canActivate: [IsRouteEnabled, LoginGuard, ConnectSubscriberGuard], data: {
redirect: '/error' redirect: '/error'
}, canDeactivate: [PreviousRouteRecorder]}, }, canDeactivate: [PreviousRouteRecorder]},
]) ])

View File

@ -7,12 +7,14 @@ import{ LinkingGenericModule} from '../../openaireLibrary/claims/linking/linki
import {LoginGuard} from '../../openaireLibrary/login/loginGuard.guard'; import {LoginGuard} from '../../openaireLibrary/login/loginGuard.guard';
import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard'; import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard';
import {ConnectSubscriberGuard} from '../../openaireLibrary/connect/communityGuard/connectSubscriber.guard';
import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
@NgModule({ @NgModule({
imports: [ imports: [
SharedModule, LinkingRoutingModule, LinkingGenericModule SharedModule, LinkingRoutingModule, LinkingGenericModule
], ],
providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled], providers:[LoginGuard, PreviousRouteRecorder, IsRouteEnabled, ConnectSubscriberGuard, CommunityService],
declarations: [ declarations: [
OpenaireLinkingComponent OpenaireLinkingComponent
], exports:[ ], exports:[