Project

General

Profile

« Previous | Next » 

Revision 46792

fix dropdown change in orcid tab of claim| add free guard in every route with no authentication required | add '*' route in server in order to show erro page not json-no contnet| Claims: get user mail from Session -jwt,tidy up display claims component (myclaims, claims)| remove folder src/app/home | LOgin: change login method to post, redirect after login/logout using queryparams of the current page, add Session helper class

View differences:

modules/uoa-services-portal/trunk/portal-2/src/app/home/home.component.ts
1
import {Component} from '@angular/core';
2
import {Router} from '@angular/router';
3
import {Observable}       from 'rxjs/Observable';
4
import {Location} from '@angular/common';
5

  
6
@Component({
7
    selector: 'home',
8
    template:`
9

  
10
    <div class="uk-margin-top">
11
      <div class="page-header">
12
          <h1>Openaire Search</h1>
13
      </div>
14
      <div>
15
        <form class="uk-form">
16
               <input #term type="text" class="uk-form-medium  uk-width-1-2" placeholder="Search for..."  name="keyword" >
17
                 <button class="uk-button" type="submit" (click)="searchTerm(term.value)" >Search</button>
18
          </form>
19
      </div>
20
    </div>
21

  
22

  
23
`
24
 })
25

  
26
export class HomeComponent {
27

  
28
  constructor ( private _router: Router, private location: Location) {
29

  
30
  }
31
  ngOnInit() {
32
}
33

  
34
  searchTerm(term: string) {
35
        window.location.href="/search/find?keyword="+term;
36
  }
37
}
modules/uoa-services-portal/trunk/portal-2/src/app/home/home.module.ts
1
import { NgModule}            from '@angular/core';
2
import { CommonModule }        from '@angular/common';
3
import { FormsModule }         from '@angular/forms';
4

  
5
import {HomeComponent} from './home.component';
6
import { HomeRoutingModule } from './home-routing.module';
7

  
8
@NgModule({
9
  imports: [
10
    CommonModule, FormsModule,
11
    HomeRoutingModule
12
  ],
13
  declarations: [
14
HomeComponent
15
],
16

  
17
  exports: [
18
    HomeComponent
19
    ]
20
})
21
export class HomeModule { }
modules/uoa-services-portal/trunk/portal-2/src/app/home/home-routing.module.ts
1
import { NgModule } from '@angular/core';
2
import { RouterModule } from '@angular/router';
3

  
4
import {HomeComponent} from './home.component';
5

  
6
@NgModule({
7
  imports: [
8
    RouterModule.forChild([
9
      { path: 'home', component: HomeComponent },
10

  
11
    ])
12
  ]
13
})
14
export class HomeRoutingModule { }
modules/uoa-services-portal/trunk/portal-2/src/app/utils/entities/user.ts
1
export class User {
2
    email:string;
3
    username: string;
4
    id: string;
5
    fullname: string;
6
}
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchDataProviders-routing.module.ts
2 2
import { RouterModule } from '@angular/router';
3 3

  
4 4
import{SearchDataprovidersComponent} from './searchDataproviders.component';
5
import {FreeGuard} from'../../login/freeGuard.guard';
5 6

  
6 7
@NgModule({
7 8
  imports: [
8 9
    RouterModule.forChild([
9
     	{ path: '', component: SearchDataprovidersComponent }
10
     	{ path: '', component: SearchDataprovidersComponent, canActivate: [FreeGuard]  }
10 11

  
11 12
    ])
12 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchDatasets-routing.module.ts
2 2
import { RouterModule } from '@angular/router';
3 3

  
4 4
import{SearchDatasetsComponent} from './searchDatasets.component';
5
import {FreeGuard} from'../../login/freeGuard.guard';
5 6

  
6 7
@NgModule({
7 8
  imports: [
8 9
    RouterModule.forChild([
9
     	{ path: '', component: SearchDatasetsComponent }
10
     	{ path: '', component: SearchDatasetsComponent, canActivate: [FreeGuard]  }
10 11

  
11 12
    ])
12 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchDatasets.module.ts
10 10
import {DatasetsServiceModule} from '../../services/datasetsService.module';
11 11
import {SearchFormModule} from  '../searchUtils/searchForm.module';
12 12
import {SearchPageModule} from '../searchUtils/searchPage.module';
13
import {FreeGuard} from'../../login/freeGuard.guard';
14

  
13 15
@NgModule({
14 16
  imports: [
15 17
    CommonModule, FormsModule,
......
21 23
  declarations: [
22 24
    SearchDatasetsComponent
23 25
   ],
24
  providers:[
26
  providers:[FreeGuard
25 27
    ],
26 28
  exports: [
27 29
    SearchDatasetsComponent
modules/uoa-services-portal/trunk/portal-2/src/app/deposit/datasets/depositDatasets.module.ts
7 7

  
8 8
import {DepositDatasetsRoutingModule} from './depositDatasets-routing.module';
9 9
import {DepoditModule} from '../deposit.module';
10
import {FreeGuard} from'../../login/freeGuard.guard';
10 11

  
11 12
@NgModule({
12 13
  imports: [
......
22 23
  exports: [
23 24
    DepositDatasetsComponent,
24 25
   ],
25
  providers:    [
26
  providers:    [FreeGuard
26 27
  ]
27 28
})
28 29
export class DepositDatasetsModule { }
modules/uoa-services-portal/trunk/portal-2/src/app/deposit/depositResult.component.ts
114 114
        private  route: ActivatedRoute,
115 115
        private _searchDataprovidersService: SearchDataprovidersService,
116 116
        private _organizationService: OrganizationService, private _meta: Meta) {
117
            console.info("depositResult constructor");
118 117

  
119 118
            this.zenodo = OpenaireProperties.getZenodoURL();
120 119
            this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
modules/uoa-services-portal/trunk/portal-2/src/app/deposit/publications/depositPublications-routing.module.ts
2 2
import { RouterModule } from '@angular/router';
3 3

  
4 4
import { DepositPublicationsComponent } from './depositPublications.component';
5
import {FreeGuard} from'../../login/freeGuard.guard';
5 6

  
6 7
@NgModule({
7 8
  imports: [
8 9
    RouterModule.forChild([
9
      { path: '', component: DepositPublicationsComponent }
10
      { path: '', component: DepositPublicationsComponent, canActivate: [FreeGuard]  }
10 11

  
11 12
    ])
12 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchOrganizations-routing.module.ts
2 2
import { RouterModule } from '@angular/router';
3 3

  
4 4
import{SearchOrganizationsComponent} from './searchOrganizations.component';
5
import {FreeGuard} from'../../login/freeGuard.guard';
5 6

  
6 7
@NgModule({
7 8
  imports: [
8 9
    RouterModule.forChild([
9
     	{ path: '', component: SearchOrganizationsComponent }
10
     	{ path: '', component: SearchOrganizationsComponent, canActivate: [FreeGuard]  }
10 11

  
11 12
    ])
12 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/deposit/datasets/depositDatasetsResults-routing.module.ts
2 2
import { RouterModule } from '@angular/router';
3 3

  
4 4
import { DepositDatasetsResultComponent } from './depositDatasetsResult.component';
5
import {FreeGuard} from'../../login/freeGuard.guard';
5 6

  
6 7
@NgModule({
7 8
  imports: [
8 9
    RouterModule.forChild([
9
     	{ path: '', component: DepositDatasetsResultComponent }
10
     	{ path: '', component: DepositDatasetsResultComponent, canActivate: [FreeGuard]  }
10 11

  
11 12
    ])
12 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/deposit/datasets/depositDatasets-routing.module.ts
3 3

  
4 4
import { DepositDatasetsComponent } from './depositDatasets.component';
5 5
import { DepositDatasetsResultComponent } from './depositDatasetsResult.component';
6
import {FreeGuard} from'../../login/freeGuard.guard';
6 7

  
7 8
@NgModule({
8 9
  imports: [
9 10
    RouterModule.forChild([
10
     	{ path: '', component: DepositDatasetsComponent }
11
     	{ path: '', component: DepositDatasetsComponent, canActivate: [FreeGuard]  }
11 12

  
12 13
    ])
13 14
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/deposit/publications/depositPublicationsResult-routing.module.ts
2 2
import { RouterModule } from '@angular/router';
3 3

  
4 4
import { DepositPublicationsResultComponent } from './depositPublicationsResult.component';
5
import {FreeGuard} from'../../login/freeGuard.guard';
5 6

  
6 7
@NgModule({
7 8
  imports: [
8 9
    RouterModule.forChild([
9
      { path: '', component: DepositPublicationsResultComponent }
10
      { path: '', component: DepositPublicationsResultComponent, canActivate: [FreeGuard]  }
10 11

  
11 12
    ])
12 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/utils/exportCSV.class.ts
55 55
     linkname: string = "Download CSV";
56 56

  
57 57
    constructor () {
58
        console.info('export constructor');
59 58
    }
60 59

  
61 60
    ngOnInit() {
modules/uoa-services-portal/trunk/portal-2/src/app/utils/properties/openaireProperties.ts
31 31
    private static metricsAPIURL = "http://vatopedi.di.uoa.gr:8080/stats/";
32 32
    private static framesAPIURL = "http://vatopedi.di.uoa.gr/stats2/";
33 33

  
34
    private static loginAPIURL = "http://mpagasas.di.uoa.gr:8080/uoa-user-management-1.0.0-SNAPSHOT/api/users/authenticate?username=";
34
    private static loginAPIURL = "http://mpagasas.di.uoa.gr:8080/uoa-user-management-1.0.0-SNAPSHOT/api/users/authenticates";
35 35

  
36 36
    // public claimsAPIURL      = "http://rudie.di.uoa.gr:8080/dnet-openaire-connector-service-1.0.0-SNAPSHOT/rest/claimsService/"
37 37
    private static claimsAPIURL = "http://scoobydoo.di.uoa.gr:8080/dnet-openaire-connector-service-1.0.0-SNAPSHOT/rest/claimsService/";
modules/uoa-services-portal/trunk/portal-2/src/app/utils/showDataProviders.component.ts
59 59
                    "organizations": {"name": string, "url": string}[]}[];
60 60

  
61 61
constructor () {
62
    console.info('showDataProviders constructor');
63 62
}
64 63

  
65 64
ngOnInit() {}
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/find/mainSearch.module.ts
16 16
import {PeopleServiceModule} from '../../services/peopleService.module';
17 17
import {BrowseEntitiesModule} from '../searchUtils/browseEntities.module';
18 18
import {SearchFormModule} from  '../searchUtils/searchForm.module';
19
import {FreeGuard} from'../../login/freeGuard.guard';
19 20

  
20 21
@NgModule({
21 22
  imports: [
......
28 29
  declarations: [
29 30
    SearchComponent
30 31
   ],
31
  providers:[
32
  providers:[FreeGuard
32 33
    ],
33 34
  exports: [
34 35
    SearchComponent
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/find/mainSearch-routing.module.ts
2 2
import { RouterModule } from '@angular/router';
3 3

  
4 4
import{SearchComponent} from './search.component';
5
import {FreeGuard} from'../../login/freeGuard.guard';
5 6

  
6 7
@NgModule({
7 8
  imports: [
8 9
    RouterModule.forChild([
9
     	{ path: '', component: SearchComponent }
10
     	{ path: '', component: SearchComponent, canActivate: [FreeGuard] }
10 11

  
11 12
    ])
12 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders-routing.module.ts
2 2
import { RouterModule } from '@angular/router';
3 3

  
4 4
import{AdvancedSearchDataProvidersComponent} from './advancedSearchDataProviders.component';
5
import {FreeGuard} from'../../login/freeGuard.guard';
5 6

  
6 7
@NgModule({
7 8
  imports: [
8 9
    RouterModule.forChild([
9
     	{ path: '', component: AdvancedSearchDataProvidersComponent }
10
     	{ path: '', component: AdvancedSearchDataProvidersComponent, canActivate: [FreeGuard] }
10 11

  
11 12
    ])
12 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/advanced/advancedSearchPublications.module.ts
8 8

  
9 9
import {PublicationsServiceModule} from '../../services/publicationsService.module';
10 10
 import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
11
 import {FreeGuard} from'../../login/freeGuard.guard';
11 12

  
12 13
@NgModule({
13 14
  imports: [
......
19 20
  declarations: [
20 21
    AdvancedSearchPublicationsComponent
21 22
   ],
22
  providers:[
23
  providers:[FreeGuard
23 24
    ],
24 25
  exports: [
25 26
    AdvancedSearchPublicationsComponent
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/advanced/advancedSearchDatasets-routing.module.ts
2 2
import { RouterModule } from '@angular/router';
3 3

  
4 4
import{AdvancedSearchDatasetsComponent} from './advancedSearchDatasets.component';
5
import {FreeGuard} from'../../login/freeGuard.guard';
5 6

  
6 7
@NgModule({
7 8
  imports: [
8 9
    RouterModule.forChild([
9
     	{ path: '', component: AdvancedSearchDatasetsComponent }
10
     	{ path: '', component: AdvancedSearchDatasetsComponent, canActivate: [FreeGuard] }
10 11

  
11 12
    ])
12 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders.module.ts
8 8

  
9 9
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
10 10
 import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
11
 import {FreeGuard} from'../../login/freeGuard.guard';
11 12

  
12 13
@NgModule({
13 14
  imports: [
......
19 20
  declarations: [
20 21
    AdvancedSearchDataProvidersComponent
21 22
   ],
22
  providers:[
23
  providers:[FreeGuard
23 24
    ],
24 25
  exports: [
25 26
    AdvancedSearchDataProvidersComponent
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/advanced/advancedSearchDatasets.module.ts
8 8

  
9 9
import {DatasetsServiceModule} from '../../services/datasetsService.module';
10 10
 import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
11
 import {FreeGuard} from'../../login/freeGuard.guard';
11 12

  
12 13
@NgModule({
13 14
  imports: [
......
19 20
  declarations: [
20 21
    AdvancedSearchDatasetsComponent
21 22
   ],
22
  providers:[
23
  providers:[FreeGuard
23 24
    ],
24 25
  exports: [
25 26
    AdvancedSearchDatasetsComponent
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/advanced/advancedSearchPeople-routing.module.ts
2 2
import { RouterModule } from '@angular/router';
3 3

  
4 4
import{AdvancedSearchPeopleComponent} from './advancedSearchPeople.component';
5
import {FreeGuard} from'../../login/freeGuard.guard';
5 6

  
6 7
@NgModule({
7 8
  imports: [
8 9
    RouterModule.forChild([
9
     	{ path: '', component: AdvancedSearchPeopleComponent }
10
     	{ path: '', component: AdvancedSearchPeopleComponent, canActivate: [FreeGuard] }
10 11

  
11 12
    ])
12 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations-routing.module.ts
2 2
import { RouterModule } from '@angular/router';
3 3

  
4 4
import{AdvancedSearchOrganizationsComponent} from './advancedSearchOrganizations.component';
5
import {FreeGuard} from'../../login/freeGuard.guard';
5 6

  
6 7
@NgModule({
7 8
  imports: [
8 9
    RouterModule.forChild([
9
     	{ path: '', component: AdvancedSearchOrganizationsComponent }
10
     	{ path: '', component: AdvancedSearchOrganizationsComponent , canActivate: [FreeGuard]}
10 11

  
11 12
    ])
12 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/advanced/advancedSearchProjects-routing.module.ts
2 2
import { RouterModule } from '@angular/router';
3 3

  
4 4
import{AdvancedSearchProjectsComponent} from './advancedSearchProjects.component';
5
import {FreeGuard} from'../../login/freeGuard.guard';
5 6

  
6 7
@NgModule({
7 8
  imports: [
8 9
    RouterModule.forChild([
9
     	{ path: '', component: AdvancedSearchProjectsComponent }
10
     	{ path: '', component: AdvancedSearchProjectsComponent, canActivate: [FreeGuard] }
10 11

  
11 12
    ])
12 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/advanced/advancedSearchPublications-routing.module.ts
2 2
import { RouterModule } from '@angular/router';
3 3

  
4 4
import{AdvancedSearchPublicationsComponent} from './advancedSearchPublications.component';
5
import {FreeGuard} from'../../login/freeGuard.guard';
5 6

  
6 7
@NgModule({
7 8
  imports: [
8 9
    RouterModule.forChild([
9
     	{ path: '', component: AdvancedSearchPublicationsComponent }
10
     	{ path: '', component: AdvancedSearchPublicationsComponent, canActivate: [FreeGuard] }
10 11

  
11 12
    ])
12 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/advanced/advancedSearchPeople.module.ts
8 8

  
9 9
import {PeopleServiceModule} from '../../services/peopleService.module';
10 10
 import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
11
 import {FreeGuard} from'../../login/freeGuard.guard';
11 12

  
12 13
@NgModule({
13 14
  imports: [
......
19 20
  declarations: [
20 21
    AdvancedSearchPeopleComponent
21 22
   ],
22
  providers:[
23
  providers:[FreeGuard
23 24
    ],
24 25
  exports: [
25 26
    AdvancedSearchPeopleComponent
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations.module.ts
8 8

  
9 9
import {OrganizationsServiceModule} from '../../services/organizationsService.module';
10 10
 import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
11
 import {FreeGuard} from'../../login/freeGuard.guard';
11 12

  
12 13
@NgModule({
13 14
  imports: [
......
19 20
  declarations: [
20 21
    AdvancedSearchOrganizationsComponent
21 22
   ],
22
  providers:[
23
  providers:[FreeGuard
23 24
    ],
24 25
  exports: [
25 26
    AdvancedSearchOrganizationsComponent
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/advanced/advancedSearchProjects.module.ts
8 8

  
9 9
import {ProjectsServiceModule} from '../../services/projectsService.module';
10 10
 import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
11
 import {FreeGuard} from'../../login/freeGuard.guard';
11 12

  
12 13
@NgModule({
13 14
  imports: [
......
19 20
  declarations: [
20 21
    AdvancedSearchProjectsComponent
21 22
   ],
22
  providers:[
23
  providers:[FreeGuard
23 24
    ],
24 25
  exports: [
25 26
    AdvancedSearchProjectsComponent
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.module.ts
10 10
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
11 11
import {SearchFormModule} from  '../searchUtils/searchForm.module';
12 12
import {SearchPageModule} from '../searchUtils/searchPage.module';
13
import {FreeGuard} from'../../login/freeGuard.guard';
14

  
13 15
@NgModule({
14 16
  imports: [
15 17
    CommonModule, FormsModule,
......
20 22
  declarations: [
21 23
    SearchCompatibleDataprovidersComponent
22 24
   ],
23
  providers:[
25
  providers:[FreeGuard
24 26
    ],
25 27
  exports: [
26 28
    SearchCompatibleDataprovidersComponent
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders-routing.module.ts
2 2
import { RouterModule } from '@angular/router';
3 3

  
4 4
import{SearchCompatibleDataprovidersComponent} from './compatibleDataProviders.component';
5
import {FreeGuard} from'../../login/freeGuard.guard';
5 6

  
6 7
@NgModule({
7 8
  imports: [
8 9
    RouterModule.forChild([
9
     	{ path: '', component: SearchCompatibleDataprovidersComponent }
10
     	{ path: '', component: SearchCompatibleDataprovidersComponent, canActivate: [FreeGuard]  }
10 11

  
11 12
    ])
12 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/dataProviders/entityRegistries.module.ts
10 10
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
11 11
import {SearchFormModule} from  '../searchUtils/searchForm.module';
12 12
import {SearchPageModule} from '../searchUtils/searchPage.module';
13
import {FreeGuard} from'../../login/freeGuard.guard';
14

  
13 15
@NgModule({
14 16
  imports: [
15 17
    CommonModule, FormsModule,
......
20 22
  declarations: [
21 23
    SearchEntityRegistriesComponent
22 24
   ],
23
  providers:[
25
  providers:[FreeGuard
24 26
    ],
25 27
  exports: [
26 28
    SearchEntityRegistriesComponent
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/dataProviders/entityRegistries-routing.module.ts
2 2
import { RouterModule } from '@angular/router';
3 3

  
4 4
import{SearchEntityRegistriesComponent} from './entityRegistries.component';
5
import {FreeGuard} from'../../login/freeGuard.guard';
5 6

  
6 7
@NgModule({
7 8
  imports: [
8 9
    RouterModule.forChild([
9
     	{ path: '', component: SearchEntityRegistriesComponent }
10
     	{ path: '', component: SearchEntityRegistriesComponent, canActivate: [FreeGuard]  }
10 11

  
11 12
    ])
12 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchPublications-routing.module.ts
2 2
import { RouterModule } from '@angular/router';
3 3

  
4 4
import{SearchPublicationsComponent} from './searchPublications.component';
5
import {FreeGuard} from'../../login/freeGuard.guard';
5 6

  
6 7
@NgModule({
7 8
  imports: [
8 9
    RouterModule.forChild([
9
     	{ path: '', component: SearchPublicationsComponent }
10
     	{ path: '', component: SearchPublicationsComponent, canActivate: [FreeGuard]  }
10 11

  
11 12
    ])
12 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchPeople.module.ts
10 10
import {PeopleServiceModule} from '../../services/peopleService.module';
11 11
import {SearchFormModule} from  '../searchUtils/searchForm.module';
12 12
import {SearchPageModule} from '../searchUtils/searchPage.module';
13
import {FreeGuard} from'../../login/freeGuard.guard';
14

  
13 15
@NgModule({
14 16
  imports: [
15 17
    CommonModule, FormsModule,
......
21 23
  declarations: [
22 24
    SearchPeopleComponent
23 25
   ],
24
  providers:[
26
  providers:[FreeGuard
25 27
    ],
26 28
  exports: [
27 29
    SearchPeopleComponent
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchOrganizations.module.ts
10 10
import {OrganizationsServiceModule} from '../../services/organizationsService.module';
11 11
import {SearchFormModule} from  '../searchUtils/searchForm.module';
12 12
import {SearchPageModule} from '../searchUtils/searchPage.module';
13
import {FreeGuard} from'../../login/freeGuard.guard';
14

  
13 15
@NgModule({
14 16
  imports: [
15 17
    CommonModule, FormsModule,
......
21 23
  declarations: [
22 24
    SearchOrganizationsComponent
23 25
   ],
24
  providers:[
26
  providers:[FreeGuard
25 27
    ],
26 28
  exports: [
27 29
    SearchOrganizationsComponent
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchProjects.module.ts
10 10
import {ProjectsServiceModule} from '../../services/projectsService.module';
11 11
import {SearchFormModule} from  '../searchUtils/searchForm.module';
12 12
import {SearchPageModule} from '../searchUtils/searchPage.module';
13
import {FreeGuard} from'../../login/freeGuard.guard';
14

  
13 15
@NgModule({
14 16
  imports: [
15 17
    CommonModule, FormsModule,
......
21 23
  declarations: [
22 24
    SearchProjectsComponent
23 25
   ],
24
  providers:[
26
  providers:[FreeGuard
25 27
    ],
26 28
  exports: [
27 29
    SearchProjectsComponent
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchPublications.module.ts
10 10
import {PublicationsServiceModule} from '../../services/publicationsService.module';
11 11
import {SearchFormModule} from  '../searchUtils/searchForm.module';
12 12
import {SearchPageModule} from '../searchUtils/searchPage.module';
13
import {FreeGuard} from'../../login/freeGuard.guard';
14

  
13 15
@NgModule({
14 16
  imports: [
15 17
    CommonModule, FormsModule,
......
21 23
  declarations: [
22 24
    SearchPublicationsComponent
23 25
   ],
24
  providers:[
26
  providers:[FreeGuard
25 27
    ],
26 28
  exports: [
27 29
    SearchPublicationsComponent
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchDataProviders.module.ts
10 10
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
11 11
import {SearchFormModule} from  '../searchUtils/searchForm.module';
12 12
import {SearchPageModule} from '../searchUtils/searchPage.module';
13
import {FreeGuard} from'../../login/freeGuard.guard';
14

  
13 15
@NgModule({
14 16
  imports: [
15 17
    CommonModule, FormsModule,
......
21 23
  declarations: [
22 24
    SearchDataprovidersComponent
23 25
   ],
24
  providers:[
26
  providers:[FreeGuard
25 27
    ],
26 28
  exports: [
27 29
    SearchDataprovidersComponent
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchPeople-routing.module.ts
2 2
import { RouterModule } from '@angular/router';
3 3

  
4 4
import{SearchPeopleComponent} from './searchPeople.component';
5
import {FreeGuard} from'../../login/freeGuard.guard';
5 6

  
6 7
@NgModule({
7 8
  imports: [
8 9
    RouterModule.forChild([
9
     	{ path: '', component: SearchPeopleComponent }
10
     	{ path: '', component: SearchPeopleComponent, canActivate: [FreeGuard]  }
10 11

  
11 12
    ])
12 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/searchPages/simple/searchProjects-routing.module.ts
2 2
import { RouterModule } from '@angular/router';
3 3

  
4 4
import{SearchProjectsComponent} from './searchProjects.component';
5
import {FreeGuard} from'../../login/freeGuard.guard';
5 6

  
6 7
@NgModule({
7 8
  imports: [
8 9
    RouterModule.forChild([
9
     	{ path: '', component: SearchProjectsComponent }
10
     	{ path: '', component: SearchProjectsComponent, canActivate: [FreeGuard]  }
10 11

  
11 12
    ])
12 13
  ]
modules/uoa-services-portal/trunk/portal-2/src/app/deposit/datasets/depositDatasetsResults.module.ts
6 6

  
7 7
import {DepositDatasetsResultsRoutingModule} from './depositDatasetsResults-routing.module';
8 8
import {DepoditModule} from '../deposit.module';
9
import {FreeGuard} from'../../login/freeGuard.guard';
9 10

  
10 11
@NgModule({
11 12
  imports: [
......
21 22
  exports: [
22 23
    DepositDatasetsResultComponent,
23 24
   ],
24
  providers:    [
25
  providers:    [FreeGuard
25 26
  ]
26 27
})
27 28
export class DepositDatasetsResultsModule { }
modules/uoa-services-portal/trunk/portal-2/src/app/deposit/publications/depositPublicationsResults.module.ts
6 6

  
7 7
import {DepositPublicationsResultRoutingModule} from './depositPublicationsResult-routing.module';
8 8
import {DepoditModule} from '../deposit.module';
9
import {FreeGuard} from'../../login/freeGuard.guard';
9 10

  
10 11
@NgModule({
11 12
  imports: [
......
21 22
  exports: [
22 23
    DepositPublicationsResultComponent,
23 24
   ],
24
  providers:    [
25
  providers:    [FreeGuard
25 26
  ]
26 27
})
27 28
export class DepositPublicationsResultsModule { }
modules/uoa-services-portal/trunk/portal-2/src/app/deposit/publications/depositPublications.module.ts
7 7
import {DepositPublicationsRoutingModule} from './depositPublications-routing.module';
8 8
import {DepoditModule} from '../deposit.module';
9 9
import {IFrameModule} from '../../utils/iframe.module';
10
import {FreeGuard} from'../../login/freeGuard.guard';
10 11

  
11 12
@NgModule({
12 13
  imports: [
......
22 23
  exports: [
23 24
    DepositPublicationsComponent,
24 25
   ],
25
  providers:    [
26
  providers:    [FreeGuard
26 27
  ]
27 28
})
28 29
export class DepositPublicationsModule { }
modules/uoa-services-portal/trunk/portal-2/src/app/claims/claim-utils/claimResultSearchForm.component.html
84 84

  
85 85
                 <span class="dropdown">
86 86

  
87
                   <select   [(ngModel)]="authorId" name="select_author"  >authorIds
88
                      <option *ngFor=" let item of authorIds let i = index"   [value]="authorIds[i]" (click)="getOrcidResultsById(i)" >{{authorGivenNames[i]}} {{authorFamilyNames[i]}} : {{item}} </option>
87
                   <select   [(ngModel)]="authorId" name="select_author" (ngModelChange)="getOrcidResultsById(authorId)"  >authorIds
88
                      <option *ngFor=" let item of authorIds let i = index"   [value]="authorIds[i]">{{authorGivenNames[i]}} {{authorFamilyNames[i]}} : {{item}} </option> <!-- (click)="getOrcidResultsById(i)" -->
89 89
                   </select>
90 90
                 </span>
91 91

  
modules/uoa-services-portal/trunk/portal-2/src/app/claims/claimsAdmin/claimsAdmin.component.ts
5 5
@Component({
6 6
    selector: 'claims-admin',
7 7
    template: `
8
    <div *ngIf="user" class="container">
8
    <div class="container">
9 9
      <div class="page-header">
10 10
          <h1> Claims Administrator </h1>
11 11
      </div>
12 12
      <div>
13 13
        <div class="uk-text-right"><a  routerLink="/participate/claim">Add more Links?</a></div>
14
        <displayClaims enableDelete="false" myClaims="false" isAdim="true"></displayClaims>
14
        <displayClaims [enableDelete]=false [myClaims]=false [isAdmin]=true></displayClaims>
15 15
      </div>
16 16
    </div>
17

  
18

  
19
    <div *ngIf="!user" class="container">
20
      TODO login
21
    </div>
22 17
    `,
23 18

  
24 19
})
......
26 21
  constructor ( ) {
27 22

  
28 23
  }
29
user:string="argirok@di.uoa.gr";
30 24
  ngOnInit() {
31

  
32

  
33 25
  }
34

  
35

  
36 26
}
modules/uoa-services-portal/trunk/portal-2/src/app/claims/claim-utils/displayClaims/displayClaims.component.ts
5 5
import {ClaimsService} from '../service/claims.service';
6 6
import {ModalLoading} from '../../../utils/modal/loading.component';
7 7
import {AlertModal} from '../../../utils/modal/alert';
8
import {Session} from '../../../login/utils/helper.class';
8 9

  
9 10

  
10 11
@Component({
......
19 20

  
20 21
  ngOnInit() {
21 22
     this.sub = this.route.queryParams.subscribe(params => {
22
      if( this.myClaims == 'true' ){
23
      if( this.myClaims){
23 24
          this.fetchBy = "User";
25
          this.fetchId = Session.getUserEmail();
24 26
      }else{
25 27

  
26 28
        this.fetchBy = params['fetchBy'];
27 29
        this.fetchBy = (this.types.indexOf(this.fetchBy) != -1)? this.fetchBy:'All';
28 30
        this.fetchId = params['fetchId'];
29
        this.fetchId=this.fetchId?this.fetchId:'';
31
        this.fetchId = this.fetchId?this.fetchId:'';
30 32

  
31 33
      }
32 34

  
......
43 45
      this.getClaims();
44 46

  
45 47
    });
46
    // this.sub = this.route.params.subscribe(params => {
47
    //   console.info(this.isAdmin+"  "+this.myClaims+" Fetch by: "+this.fetchBy+" Fetch id: "+this.fetchId);
48
    //   if( this.myClaims == 'true' ){
49
    //     console.info("Is myclaims");
50
    //       this.fetchBy = "User";
51
    //   }else{
52
    //     console.info("Is admin");
53
    //
54
    //     console.info(this.isAdmin);
55
    //
56
    //     this.fetchBy = params['fetchBy'];
57
    //     this.fetchBy = (this.types.indexOf(this.fetchBy) != -1)? this.fetchBy:'All';
58
    //     this.fetchId = params['fetchId'];
59
    //     console.info("Fetch by:"+this.fetchBy+"Fetch id:"+this.fetchId);
60
    //     this.fetchId=this.fetchId?this.fetchId:'';
61
    //
62
    //   }
63
    //
64
    //   console.info(this.isAdmin+"  "+this.myClaims+" Fetch by: "+this.fetchBy+" Fetch id: "+this.fetchId);
65
    //   let page = (params['page']=== undefined)?1:+params['page'];
66
    //   let size = (params['size']=== undefined)?10:+params['size'];
67
    //
68
    //   this.keyword = (params['keyword']?params['keyword']:"");
69
    //   this.inputkeyword = this.keyword;
70
    //   this.page = ( page <= 0 ) ? 1 : page;
71
    //   this.size = ( size <= 0 ) ? 10 : size;
72
    //   this.entityTypes = []//(params['types']?params['types']:[]);
73
    //   this.setTypes(params['types']); // check the appropriate checkboxes
74
    //   this.setSortby(params['sort']);
75
    //   this.getClaims();
76
    //   console.info("params: "+params['page']+"   page "+page +" this.page: "+this.page );
77
    // });
48

  
78 49
  }
79 50
  ngOnDestroy() {
80 51
    this.sub.unsubscribe();
81 52
  }
82 53
    sub: any;
83 54
  //string because comes as input from component directive
84
  @Input() enableDelete: string = 'false';
85
  @Input() myClaims: string= 'false' ;
86
  @Input() isAdmin:string = 'false';
55
  @Input() enableDelete: boolean = false;
56
  @Input() myClaims: boolean= false ;
57
  @Input() isAdmin:boolean = false;
87 58
  page : number;
88 59
  size:number;
89 60
  sizes = [10,20,30,50];
......
198 169
    this.getClaims();
199 170
  }
200 171
  getParameters(){
201
    let params={ page: this.page, size: this.size, types: this.entityTypes, fetchBy: this.fetchBy, fetchId:this.fetchId, keyword : this.keyword, sort: this.getSortby()  };
172
    var params = {}
173
    if(this.myClaims){
174
       params={ page: this.page, size: this.size, types: this.entityTypes, keyword : this.keyword, sort: this.getSortby()  };
175
    }else{
176
      params={ page: this.page, size: this.size, types: this.entityTypes, fetchBy: this.fetchBy, fetchId:this.fetchId, keyword : this.keyword, sort: this.getSortby()  };
177
    }
202 178
    return params;
203 179
  }
180

  
204 181
  getParametersString(){
205 182
    var params='';
206 183
    params+=(this.page==1?"":(params.length>0?'&':'')+"page="+this.page);
......
212 189
    }
213 190
    params+=(types.length>0)?"types="+types:"";
214 191

  
215
    if(this.isAdmin === 'true'){
192
    if(this.isAdmin ){
216 193
      params+=(this.fetchBy=='All'?"":(params.length>0?'&':'')+"fetchBy="+this.fetchBy);
217 194
      params+=(this.fetchId==''?"":(params.length>0?'&':'')+"fetchId="+this.fetchId);
218 195
    }
......
294 271
       this.entityTypes.push('context');
295 272
     }
296 273

  
297
    //  if(this.publicationCB  == true && this.datasetCB  == true && this.contextCB  == true && this.projectCB  == true ){
298
    //    this.entityTypes="";
299
    //  }else{
300
    //    this.entityTypes = "";
301
    //    if(this.publicationCB == true){
302
    //      this.entityTypes = "publication";
303
    //    }
304
    //    if(this.datasetCB  == true){
305
    //      this.entityTypes += (this.entityTypes.length > 0?",":"")+"dataset";
306
    //    }
307
    //    if(this.contextCB  == true){
308
    //      this.entityTypes += (this.entityTypes.length > 0?",":"")+"context";
309
    //    }
310
    //    if(this.projectCB  == true){
311
    //      this.entityTypes += (this.entityTypes.length > 0?",":"")+"project";
312
    //    }
313
    //  }
314
    //  console.debug("Type changed: "+this.entityTypes+"   "+this.publicationCB+ this.datasetCB + this.contextCB  + this.projectCB);
315 274
     this.goTo();
316 275
   }
317 276
   setTypes(types:string){
modules/uoa-services-portal/trunk/portal-2/src/app/claims/claim-utils/claimResultSearchForm.component.ts
270 270
      this.authorGivenNames, this.authorFamilyNames).subscribe(
271 271
        data => {
272 272
          if(data != null && data == true) {
273
            this.getOrcidResultsById(0);
273
            this.getOrcidResultsByIndex(0);
274 274
          }
275 275

  
276 276
          this.orcidStatus = this.errorCodes.NONE;
......
299 299
        this.authorGivenNames, this.authorFamilyNames).subscribe(
300 300
          data => {
301 301
            if(data != null && data == true) {
302
              this.getOrcidResultsById(0);
302
              this.getOrcidResultsByIndex(0);
303 303
            }else{
304 304
              this.orcidStatus = this.errorCodes.ERROR;
305 305
            }
......
313 313
      }
314 314

  
315 315

  
316
      private    getOrcidResultsById (index:number) {
316
      private    getOrcidResultsByIndex (index:number) {
317 317
        if(this.authorIds.length > index) {
318 318
          this.orcidStatus = this.errorCodes.LOADING;
319 319
          let id = this.authorIds[index];
320 320
          this.authorGivenName = this.authorGivenNames[index];
321 321
          this.authorFamilyName = this.authorFamilyNames[index];
322
          this.getOrcidResultsById(id);
323
        }
324
      }
325
      private    getOrcidResultsById (id:string) {
326

  
327
          var index = this.authorIds.indexOf(id);
328
          this.authorGivenName = this.authorGivenNames[index];
329
          this.authorFamilyName = this.authorFamilyNames[index];
322 330
          this.authorId = id;
323 331
          console.info("getOrcidResultsById: "+id);
324 332
          this._searchOrcidService.searchOrcidPublications(id).subscribe(
......
352 360
            }
353 361
          );
354 362

  
355
        }
363

  
356 364
      }
357 365

  
358 366
/*
modules/uoa-services-portal/trunk/portal-2/src/app/claims/linking/selected/selectedResults.component.ts
39 39
                        </div>
40 40
                        <!-- Crossref -->
41 41
                        <span *ngIf="pub.result.publisher" class="uk-article-meta">Publisher: {{pub.result.publisher}}</span><span *ngIf="pub.date"  class="uk-article-meta" >({{pub.date.substring(0,4)}})</span>
42
                        <div *ngIf="pub.result.author && pub.result.author.length > 0" class="uk-article-meta">Authors: <span *ngFor="let author of pub.result.author  let i = index">{{author.family}} {{author.given}}{{(i < (pub.result.author.length-1))?"; ":""}}</span></div>
43
                        <div *ngIf="pub.result.editor && pub.result.editor.length" class="uk-article-meta">Editors: <span *ngFor="let author of pub.result.editor  let i = index">{{author.family}} {{author.given}}{{(i < (pub.result.editor.length-1))?"; ":""}}</span></div>
42
                        <div *ngIf="pub.result.author && pub.result.author.length > 0" class="uk-article-meta">Authors: <span *ngFor="let author of pub.result.author.slice(0,10)  let i = index">{{author.family}} {{author.given}}{{(i < (pub.result.author.slice(0,10).length-1))?"; ":""}}</span></div>
43
                        <div *ngIf="pub.result.editor && pub.result.editor.length" class="uk-article-meta">Editors: <span *ngFor="let author of pub.result.editor.slice(0,10)  let i = index">{{author.family}} {{author.given}}{{(i < (pub.result.editor.slice(0,10).length-1))?"; ":""}}</span></div>
44 44

  
45 45
                        <!-- Openaire -->
46
                        <div *ngIf="pub.result.authors && pub.result.authors.length >0 " class="uk-article-meta">Authors: <span *ngFor="let author of pub.result.authors let i = index">{{author.name}}{{(i < (pub.result.authors.length-1))?"; ":""}}</span></div>
46
                        <div *ngIf="pub.result.authors && pub.result.authors.length >0 " class="uk-article-meta">Authors: <span *ngFor="let author of pub.result.authors.slice(0,10) let i = index">{{author.name}}{{(i < (pub.result.authors.slice(0,10).length-1))?"; ":""}}</span></div>
47 47

  
48 48
                        <!-- Orcid -->
49 49
                        <span  *ngIf="pub.result['journal-title'] && pub.result['journal-title'].value " class="uk-article-meta">Journal: {{pub.result['journal-title'].value}}</span>
50
                        <div *ngIf="pub.result.contributors && pub.result.contributors.length > 0" class="uk-article-meta">Authors: <span *ngFor="let author of pub.result.contributors let i = index">{{author}}{{(i < (pub.result.contributors.length-1))?"; ":""}}</span></div>
50
                        <div *ngIf="pub.result.contributors && pub.result.contributors.length > 0" class="uk-article-meta">Authors: <span *ngFor="let author of pub.result.contributors.slice(0,10) let i = index">{{author}}{{(i < (pub.result.contributors.slice(0,10).length-1))?"; ":""}}</span></div>
51 51
                        <!-- Datacite -->
52
                       <div *ngIf="pub.result.creator" class="uk-article-meta">Authors: <span *ngFor="let author of pub.result.creator let i = index">{{author}}{{(i < (pub.result.creator.length-1))?"; ":""}}</span></div>
53

  
52
                       <div *ngIf="pub.result.creator" class="uk-article-meta">Authors: <span *ngFor="let author of pub.result.creator.slice(0,10) let i = index">{{author}}{{(i < (pub.result.creator.slice(0,10).length-1))?"; ":""}}</span></div>
53
<br>****sliced***<br>
54 54
                    </div>
55 55
                    <div *ngIf="showAccessRights  && pub.source != 'openaire' "  class = "uk-width-3-10">
56 56
                      <span *ngIf="showAccessRights  && pub.source != 'openaire' " class="dropdown">
modules/uoa-services-portal/trunk/portal-2/src/app/login/loginGuard.guard.ts
1 1
import { Injectable } from '@angular/core';
2 2
import { Router,CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot} from '@angular/router';
3 3
import {Observable}       from 'rxjs/Observable';
4
import {Session} from './utils/helper.class';
4 5

  
5 6
@Injectable()
6 7
export class LoginGuard implements CanActivate {
......
8 9
  constructor(private router: Router) {}
9 10

  
10 11
  canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
11
    console.log("AAA inside the LoginGuard!")
12 12
    var user;
13 13
    var loggedIn = false;
14
    if( typeof localStorage !== 'undefined') {
15
        if(localStorage.getItem("user")) {
16
             user = JSON.parse(localStorage.getItem("user"));
17
             loggedIn = true;
18
        }
14
    var errorCode = 1;
15

  
16
    if(Session.isLoggedIn()){
17
      loggedIn = true;
18
      if(!Session.isValidAndRemove()){
19
        loggedIn = false;
20
        errorCode = 3;
21
      }
22
    }else{
23
      errorCode = 1;
19 24
    }
20 25
    if(!loggedIn){
21
      this.router.navigate(['/user-info'], { queryParams: { "errorCode": 1, "redirectUrl":  state.url } });
26
      this.router.navigate(['/user-info'], { queryParams: { "errorCode": errorCode, "redirectUrl":  state.url } });
22 27
      return false;
23 28
    }else{
24 29
      return true;
modules/uoa-services-portal/trunk/portal-2/src/app/claims/directLinking/directLinking.component.ts
51 51
                     (showChange)="showChange($event)"   > </claim-selected-projects>
52 52
            </div>
53 53
            <claim-selected-results *ngIf=" linkTo =='result'  " title="with other Research Results"   [results]="results"    [showSearch]="show=='claim'? false: true"  [showAccessRights]="show=='claim'? true: false"
54
                            bulkMode=false>
54
                            [bulkMode]=false>
55 55
            </claim-selected-results>
56 56

  
57 57
    </div>
modules/uoa-services-portal/trunk/portal-2/src/app/login/utils/helper.class.ts
1
export class User {
2
    email:string;
3
    username: string;
4
    id: string;
5
    fullname: string;
6
    expirationDate: number;
7
    role:string;
8
    jwt:string;
9

  
10
}
11

  
12
export class Session{
13
  public static setUser(user:User): User {
14

  
15
      localStorage.setItem("user", JSON.stringify(user));
16

  
17
      return user;
18
  }
19

  
20
  public static removeUser() {
21
    if(Session.isLoggedIn()){
22
        localStorage.removeItem("user");
23
    }
24
  }
25
  public static getUser():User {
26
    if(Session.isLoggedIn()){
27
        return JSON.parse(localStorage.getItem("user"));
28
    }else{
29
      return null;
30
    }
31
  }
32
  public static isLoggedIn(): boolean {
33
      var loggedIn:boolean = false;
34
      var user:User = null;
35
    if( typeof localStorage !== 'undefined') {
36
        if(localStorage.getItem("user")) {
37
          user = JSON.parse(localStorage.getItem("user"));
38
            if(user && user.id){
39
              loggedIn = true;
40
            }else{
41
              loggedIn = false;
42
            }
43
          }else{
44
              loggedIn = false;
45
          }
46
      }else{
47
          loggedIn = false;
48
      }
49
      return loggedIn;
50
  }
51
  public static getUserJwt():string {
52
      if(Session.isLoggedIn()){
53
          return Session.getUser().jwt;
54
      }else{
55
        return null;
56
      }
57

  
58
  }
59
  public static getUserEmail():string {
60
      if(Session.isLoggedIn()){
61
          return Session.getUser().email;
62
      }else{
63
        return null;
64
      }
65

  
66
  }
67
  public static isAdminUser():boolean {
68
      if(Session.isLoggedIn()){
69
          return (Session.getUser().role == '2');
70
      }
71

  
72
  }
73
  public static isUserValid() {
74
    if(Session.isLoggedIn()){
75
        var expires = Session.getUser().expirationDate;
76
        var now = new Date().getTime() / 1000;
77
        console.log(" is still valid ? "+(now < expires)  + " now is:"+now + "expires at:"+expires);
78
        return now < expires;
79
    }
80
    return false;
81
  }
82
  public static isValidAndRemove() {
83
    if(Session.isLoggedIn()){
84
        if(!Session.isUserValid()){
85
          Session.removeUser();
86
          return false;
87
        }
88
    }
89
    return true;
90
  }
91

  
92
}
93
export  class MyJWT{
94
  private static validateJWTFormat(data){
95

  
96
    if(data == null || (data.indexOf(".") !=-1 && data.split('.').length != 3)){
97
      return false;
98
    }
99
    return true;
100
  }
101
  private static getPayload(data){
102
    var payload = data.split('.')[1];
103
    return atob(payload);
104
  }
105
  public static parseUserInfo(data: any): User {
106
      if(this.validateJWTFormat(data)){
107
        var info = JSON.parse(this.getPayload(data));
108
      }
109
      var user: User = new User();
110

  
111
      user.username = info.sub;
112
      user.email = info.email;
113
      user.id = info.userId;
114
      user.fullname = info.fullname;
115
      user.role = info.role;
116
      user.jwt = data;
117
      user.expirationDate = info.exp;
118
      localStorage.setItem("user", JSON.stringify(user));
119
      return user;
120
  }
121

  
122

  
123
}
modules/uoa-services-portal/trunk/portal-2/src/app/login/adminLoginGuard.guard.ts
1 1
import { Injectable } from '@angular/core';
2 2
import { Router,CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot} from '@angular/router';
3 3
import {Observable}       from 'rxjs/Observable';
4

  
4
import {Session} from './utils/helper.class';
5 5
@Injectable()
6 6
export class AdminLoginGuard implements CanActivate {
7 7

  
8 8
  constructor(private router: Router) {}
9 9

  
10 10
  canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
11
    console.log("AAA inside the AdminLoginGuard!")
12 11
    var user;
13 12
    var loggedIn = false;
14 13
    var isAdmin = false;
14
    var errorCode = 1;
15 15

  
16
    if( typeof localStorage !== 'undefined') {
17
        if(localStorage.getItem("user")) {
18
             loggedIn = true;
19
             user = JSON.parse(localStorage.getItem("user"));
20
             if(user.role == 2){
21
               isAdmin = true;
22
           }
16
    if(Session.isLoggedIn()){
17
      loggedIn = true;
18
      if(!Session.isValidAndRemove()){
19
        loggedIn = false;
20
        errorCode = 3;
21
      }else {
22
        isAdmin = Session.isAdminUser();
23
        if(!isAdmin){
24
          errorCode = 2;
23 25
        }
26
      }
27
    }else{
28
      errorCode =1;
24 29
    }
30

  
25 31
    if(!loggedIn){
26
      this.router.navigate(['/user-info'], { queryParams: { "errorCode": 1, "redirectUrl":  state.url } });
32
      this.router.navigate(['/user-info'], { queryParams: { "errorCode": errorCode, "redirectUrl":  state.url } });
27 33

  
28 34
      return false;
29 35
    }else if(!isAdmin){
30
        this.router.navigate(['/user-info'], { queryParams: { "errorCode": 2, "redirectUrl":  state.url } });
36
        this.router.navigate(['/user-info'], { queryParams: { "errorCode": errorCode, "redirectUrl":  state.url } });
31 37
        return false;
32 38
      }else{
33 39
      return true;
modules/uoa-services-portal/trunk/portal-2/src/app/landingPages/dataProvider/dataProvider-routing.module.ts
2 2
import { RouterModule } from '@angular/router';
3 3

  
4 4
import { DataProviderComponent } from './dataProvider.component';
5
import {FreeGuard} from'../../login/freeGuard.guard';
5 6

  
6 7
@NgModule({
7 8
 imports: [
8 9
  RouterModule.forChild([
9
    { path: '', component: DataProviderComponent }
10
    { path: '', component: DataProviderComponent, canActivate: [FreeGuard] }
10 11
  ])
11 12
]
12 13
})
modules/uoa-services-portal/trunk/portal-2/src/app/landingPages/htmlProjectReport/htmlProjectReport.module.ts
8 8
import {HtmlProjectReportService} from './htmlProjectReport.service';
9 9
import {HtmlProjectReportComponent} from './htmlProjectReport.component';
10 10
import { HtmlProjectReportRoutingModule } from './htmlProjectReport-routing.module';
11
import {FreeGuard} from'../../login/freeGuard.guard';
11 12

  
12 13
@NgModule({
13 14
  imports: [
......
17 18
  HtmlProjectReportComponent
18 19
  ],
19 20
  providers:[
20
    HtmlProjectReportService,CacheService
21
    HtmlProjectReportService,CacheService, FreeGuard
21 22
   ],
22 23
  exports: [
23 24
  HtmlProjectReportComponent
modules/uoa-services-portal/trunk/portal-2/src/app/landingPages/organization/organization.component.ts
64 64
                 private _searchPublicationsService: SearchPublicationsService,
65 65
                 private _searchProjectsService: SearchProjectsService, private _meta: Meta) {
66 66

  
67
            console.info('organization constructor');
68 67
            this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
69 68
    }
70 69

  
modules/uoa-services-portal/trunk/portal-2/src/app/landingPages/person/person-routing.module.ts
2 2
import { RouterModule } from '@angular/router';
3 3

  
4 4
import { PersonComponent } from './person.component';
5
import {FreeGuard} from'../../login/freeGuard.guard';
5 6

  
6 7
@NgModule({
7 8
 imports: [
8 9
  RouterModule.forChild([
9
    { path: '', component: PersonComponent }
10
    { path: '', component: PersonComponent, canActivate: [FreeGuard] }
10 11
  ])
11 12
]
12 13
})
modules/uoa-services-portal/trunk/portal-2/src/app/landingPages/publication/publication-routing.module.ts
2 2
import { RouterModule } from '@angular/router';
3 3

  
4 4
import { PublicationComponent } from './publication.component';
5
import {FreeGuard} from'../../login/freeGuard.guard';
5 6

  
6 7
@NgModule({
7 8
 imports: [
8 9
  RouterModule.forChild([
9
    { path: '', component: PublicationComponent }
10
    { path: '', component: PublicationComponent, canActivate: [FreeGuard] }
10 11
  ])
11 12
]
12 13
})
modules/uoa-services-portal/trunk/portal-2/src/app/claims/linking/insertClaim/insertClaim.component.ts
5 5
import {ModalLoading} from '../../../utils/modal/loading.component';
6 6
import {AlertModal} from '../../../utils/modal/alert';
7 7
import {Md5} from 'ts-md5/dist/md5';
8

  
8
import {Session} from '../../../login/utils/helper.class';
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff