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
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@46792 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
12aa6406eb
commit
490752b08e
|
@ -84,8 +84,8 @@
|
|||
|
||||
<span class="dropdown">
|
||||
|
||||
<select [(ngModel)]="authorId" name="select_author" >authorIds
|
||||
<option *ngFor=" let item of authorIds let i = index" [value]="authorIds[i]" (click)="getOrcidResultsById(i)" >{{authorGivenNames[i]}} {{authorFamilyNames[i]}} : {{item}} </option>
|
||||
<select [(ngModel)]="authorId" name="select_author" (ngModelChange)="getOrcidResultsById(authorId)" >authorIds
|
||||
<option *ngFor=" let item of authorIds let i = index" [value]="authorIds[i]">{{authorGivenNames[i]}} {{authorFamilyNames[i]}} : {{item}} </option> <!-- (click)="getOrcidResultsById(i)" -->
|
||||
</select>
|
||||
</span>
|
||||
|
||||
|
|
|
@ -270,7 +270,7 @@ private getCrossrefResults (term: string, size : number, page : number) {
|
|||
this.authorGivenNames, this.authorFamilyNames).subscribe(
|
||||
data => {
|
||||
if(data != null && data == true) {
|
||||
this.getOrcidResultsById(0);
|
||||
this.getOrcidResultsByIndex(0);
|
||||
}
|
||||
|
||||
this.orcidStatus = this.errorCodes.NONE;
|
||||
|
@ -299,7 +299,7 @@ private getCrossrefResults (term: string, size : number, page : number) {
|
|||
this.authorGivenNames, this.authorFamilyNames).subscribe(
|
||||
data => {
|
||||
if(data != null && data == true) {
|
||||
this.getOrcidResultsById(0);
|
||||
this.getOrcidResultsByIndex(0);
|
||||
}else{
|
||||
this.orcidStatus = this.errorCodes.ERROR;
|
||||
}
|
||||
|
@ -313,12 +313,20 @@ private getCrossrefResults (term: string, size : number, page : number) {
|
|||
}
|
||||
|
||||
|
||||
private getOrcidResultsById (index:number) {
|
||||
private getOrcidResultsByIndex (index:number) {
|
||||
if(this.authorIds.length > index) {
|
||||
this.orcidStatus = this.errorCodes.LOADING;
|
||||
let id = this.authorIds[index];
|
||||
this.authorGivenName = this.authorGivenNames[index];
|
||||
this.authorFamilyName = this.authorFamilyNames[index];
|
||||
this.getOrcidResultsById(id);
|
||||
}
|
||||
}
|
||||
private getOrcidResultsById (id:string) {
|
||||
|
||||
var index = this.authorIds.indexOf(id);
|
||||
this.authorGivenName = this.authorGivenNames[index];
|
||||
this.authorFamilyName = this.authorFamilyNames[index];
|
||||
this.authorId = id;
|
||||
console.info("getOrcidResultsById: "+id);
|
||||
this._searchOrcidService.searchOrcidPublications(id).subscribe(
|
||||
|
@ -352,7 +360,7 @@ private getCrossrefResults (term: string, size : number, page : number) {
|
|||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -5,6 +5,7 @@ import {ActivatedRoute, Router} from '@angular/router';
|
|||
import {ClaimsService} from '../service/claims.service';
|
||||
import {ModalLoading} from '../../../utils/modal/loading.component';
|
||||
import {AlertModal} from '../../../utils/modal/alert';
|
||||
import {Session} from '../../../login/utils/helper.class';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -19,14 +20,15 @@ export class DisplayClaimsComponent {
|
|||
|
||||
ngOnInit() {
|
||||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
if( this.myClaims == 'true' ){
|
||||
if( this.myClaims){
|
||||
this.fetchBy = "User";
|
||||
this.fetchId = Session.getUserEmail();
|
||||
}else{
|
||||
|
||||
this.fetchBy = params['fetchBy'];
|
||||
this.fetchBy = (this.types.indexOf(this.fetchBy) != -1)? this.fetchBy:'All';
|
||||
this.fetchId = params['fetchId'];
|
||||
this.fetchId=this.fetchId?this.fetchId:'';
|
||||
this.fetchId = this.fetchId?this.fetchId:'';
|
||||
|
||||
}
|
||||
|
||||
|
@ -43,47 +45,16 @@ export class DisplayClaimsComponent {
|
|||
this.getClaims();
|
||||
|
||||
});
|
||||
// this.sub = this.route.params.subscribe(params => {
|
||||
// console.info(this.isAdmin+" "+this.myClaims+" Fetch by: "+this.fetchBy+" Fetch id: "+this.fetchId);
|
||||
// if( this.myClaims == 'true' ){
|
||||
// console.info("Is myclaims");
|
||||
// this.fetchBy = "User";
|
||||
// }else{
|
||||
// console.info("Is admin");
|
||||
//
|
||||
// console.info(this.isAdmin);
|
||||
//
|
||||
// this.fetchBy = params['fetchBy'];
|
||||
// this.fetchBy = (this.types.indexOf(this.fetchBy) != -1)? this.fetchBy:'All';
|
||||
// this.fetchId = params['fetchId'];
|
||||
// console.info("Fetch by:"+this.fetchBy+"Fetch id:"+this.fetchId);
|
||||
// this.fetchId=this.fetchId?this.fetchId:'';
|
||||
//
|
||||
// }
|
||||
//
|
||||
// console.info(this.isAdmin+" "+this.myClaims+" Fetch by: "+this.fetchBy+" Fetch id: "+this.fetchId);
|
||||
// let page = (params['page']=== undefined)?1:+params['page'];
|
||||
// let size = (params['size']=== undefined)?10:+params['size'];
|
||||
//
|
||||
// this.keyword = (params['keyword']?params['keyword']:"");
|
||||
// this.inputkeyword = this.keyword;
|
||||
// this.page = ( page <= 0 ) ? 1 : page;
|
||||
// this.size = ( size <= 0 ) ? 10 : size;
|
||||
// this.entityTypes = []//(params['types']?params['types']:[]);
|
||||
// this.setTypes(params['types']); // check the appropriate checkboxes
|
||||
// this.setSortby(params['sort']);
|
||||
// this.getClaims();
|
||||
// console.info("params: "+params['page']+" page "+page +" this.page: "+this.page );
|
||||
// });
|
||||
|
||||
}
|
||||
ngOnDestroy() {
|
||||
this.sub.unsubscribe();
|
||||
}
|
||||
sub: any;
|
||||
//string because comes as input from component directive
|
||||
@Input() enableDelete: string = 'false';
|
||||
@Input() myClaims: string= 'false' ;
|
||||
@Input() isAdmin:string = 'false';
|
||||
@Input() enableDelete: boolean = false;
|
||||
@Input() myClaims: boolean= false ;
|
||||
@Input() isAdmin:boolean = false;
|
||||
page : number;
|
||||
size:number;
|
||||
sizes = [10,20,30,50];
|
||||
|
@ -198,9 +169,15 @@ export class DisplayClaimsComponent {
|
|||
this.getClaims();
|
||||
}
|
||||
getParameters(){
|
||||
let params={ page: this.page, size: this.size, types: this.entityTypes, fetchBy: this.fetchBy, fetchId:this.fetchId, keyword : this.keyword, sort: this.getSortby() };
|
||||
var params = {}
|
||||
if(this.myClaims){
|
||||
params={ page: this.page, size: this.size, types: this.entityTypes, keyword : this.keyword, sort: this.getSortby() };
|
||||
}else{
|
||||
params={ page: this.page, size: this.size, types: this.entityTypes, fetchBy: this.fetchBy, fetchId:this.fetchId, keyword : this.keyword, sort: this.getSortby() };
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
getParametersString(){
|
||||
var params='';
|
||||
params+=(this.page==1?"":(params.length>0?'&':'')+"page="+this.page);
|
||||
|
@ -212,7 +189,7 @@ export class DisplayClaimsComponent {
|
|||
}
|
||||
params+=(types.length>0)?"types="+types:"";
|
||||
|
||||
if(this.isAdmin === 'true'){
|
||||
if(this.isAdmin ){
|
||||
params+=(this.fetchBy=='All'?"":(params.length>0?'&':'')+"fetchBy="+this.fetchBy);
|
||||
params+=(this.fetchId==''?"":(params.length>0?'&':'')+"fetchId="+this.fetchId);
|
||||
}
|
||||
|
@ -294,24 +271,6 @@ export class DisplayClaimsComponent {
|
|||
this.entityTypes.push('context');
|
||||
}
|
||||
|
||||
// if(this.publicationCB == true && this.datasetCB == true && this.contextCB == true && this.projectCB == true ){
|
||||
// this.entityTypes="";
|
||||
// }else{
|
||||
// this.entityTypes = "";
|
||||
// if(this.publicationCB == true){
|
||||
// this.entityTypes = "publication";
|
||||
// }
|
||||
// if(this.datasetCB == true){
|
||||
// this.entityTypes += (this.entityTypes.length > 0?",":"")+"dataset";
|
||||
// }
|
||||
// if(this.contextCB == true){
|
||||
// this.entityTypes += (this.entityTypes.length > 0?",":"")+"context";
|
||||
// }
|
||||
// if(this.projectCB == true){
|
||||
// this.entityTypes += (this.entityTypes.length > 0?",":"")+"project";
|
||||
// }
|
||||
// }
|
||||
// console.debug("Type changed: "+this.entityTypes+" "+this.publicationCB+ this.datasetCB + this.contextCB + this.projectCB);
|
||||
this.goTo();
|
||||
}
|
||||
setTypes(types:string){
|
||||
|
|
|
@ -5,20 +5,15 @@ import {Observable} from 'rxjs/Observable';
|
|||
@Component({
|
||||
selector: 'claims-admin',
|
||||
template: `
|
||||
<div *ngIf="user" class="container">
|
||||
<div class="container">
|
||||
<div class="page-header">
|
||||
<h1> Claims Administrator </h1>
|
||||
</div>
|
||||
<div>
|
||||
<div class="uk-text-right"><a routerLink="/participate/claim">Add more Links?</a></div>
|
||||
<displayClaims enableDelete="false" myClaims="false" isAdim="true"></displayClaims>
|
||||
<displayClaims [enableDelete]=false [myClaims]=false [isAdmin]=true></displayClaims>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div *ngIf="!user" class="container">
|
||||
TODO login
|
||||
</div>
|
||||
`,
|
||||
|
||||
})
|
||||
|
@ -26,11 +21,6 @@ export class ClaimsAdminComponent {
|
|||
constructor ( ) {
|
||||
|
||||
}
|
||||
user:string="argirok@di.uoa.gr";
|
||||
ngOnInit() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ import {SearchDatasetsService} from '../../services/searchDatasets.service';
|
|||
(showChange)="showChange($event)" > </claim-selected-projects>
|
||||
</div>
|
||||
<claim-selected-results *ngIf=" linkTo =='result' " title="with other Research Results" [results]="results" [showSearch]="show=='claim'? false: true" [showAccessRights]="show=='claim'? true: false"
|
||||
bulkMode=false>
|
||||
[bulkMode]=false>
|
||||
</claim-selected-results>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -5,7 +5,7 @@ import {ClaimsService} from '../../claim-utils/service/claims.service';
|
|||
import {ModalLoading} from '../../../utils/modal/loading.component';
|
||||
import {AlertModal} from '../../../utils/modal/alert';
|
||||
import {Md5} from 'ts-md5/dist/md5';
|
||||
|
||||
import {Session} from '../../../login/utils/helper.class';
|
||||
@Component({
|
||||
selector: 'claim-insert',
|
||||
template: `
|
||||
|
@ -19,7 +19,7 @@ import {Md5} from 'ts-md5/dist/md5';
|
|||
<modal-loading [message]= "'Please wait...'"></modal-loading>
|
||||
<modal-alert (alertOutput)="confirmClose($event)">
|
||||
</modal-alert>
|
||||
<button *ngIf="claiming == false && showButton == true" (click)="validateInsertions()" class="uk-button uk-button-primary uk-align-right" >Finish</button>
|
||||
<button *ngIf="!claiming && showButton" (click)="validateInsertions()" class="uk-button uk-button-primary uk-align-right" >Finish</button>
|
||||
`
|
||||
})
|
||||
export class ClaimInsertComponent {
|
||||
|
@ -60,7 +60,8 @@ public validateInsertions(){
|
|||
}
|
||||
private insert(){
|
||||
this.claiming = true;
|
||||
var user="argirok@di.uoa.gr"
|
||||
var user=Session.getUserEmail();
|
||||
var jwt=Session.getUserJwt();
|
||||
this.loading.open();
|
||||
var claims = [];
|
||||
var directclaims = [];
|
||||
|
@ -161,6 +162,7 @@ private validateDates(){
|
|||
}
|
||||
private afterclaimsInsertion(insertedIds, errorInClaims){
|
||||
this.loading.close();
|
||||
this.claiming = false;
|
||||
if(errorInClaims.length == 0 && insertedIds.length > 0 ){
|
||||
// if(this.inline){
|
||||
// this.show = "end";
|
||||
|
@ -178,6 +180,8 @@ private errorsInClaimsInsertion(insertedIds, errorInClaims){
|
|||
this.errorMessage = "An Error Occured.";
|
||||
this.loading.close();
|
||||
this.error = true;
|
||||
this.claiming = false;
|
||||
this.showButton = true;
|
||||
// if(this.inline){
|
||||
// this.show = "error";
|
||||
// this.showChange.emit({
|
||||
|
|
|
@ -39,18 +39,18 @@ import {Dates} from '../../../utils/string-utils.class';
|
|||
</div>
|
||||
<!-- Crossref -->
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
|
||||
<!-- Openaire -->
|
||||
<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>
|
||||
<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>
|
||||
|
||||
<!-- Orcid -->
|
||||
<span *ngIf="pub.result['journal-title'] && pub.result['journal-title'].value " class="uk-article-meta">Journal: {{pub.result['journal-title'].value}}</span>
|
||||
<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>
|
||||
<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>
|
||||
<!-- Datacite -->
|
||||
<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>
|
||||
|
||||
<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>
|
||||
<br>****sliced***<br>
|
||||
</div>
|
||||
<div *ngIf="showAccessRights && pub.source != 'openaire' " class = "uk-width-3-10">
|
||||
<span *ngIf="showAccessRights && pub.source != 'openaire' " class="dropdown">
|
||||
|
|
|
@ -6,27 +6,22 @@ import {Observable} from 'rxjs/Observable';
|
|||
@Component({
|
||||
selector: 'my-claims',
|
||||
template: `
|
||||
<div *ngIf="user" class="container uk-margin-top">
|
||||
<div class="container uk-margin-top">
|
||||
<div class="page-header">
|
||||
<h1> My Linked research resutls</h1>
|
||||
</div>
|
||||
<div>
|
||||
<div class="uk-text-right"><a routerLink="/participate/claim">Add more Links?</a></div>
|
||||
<displayClaims enableDelete="false" myClaims="true" isAdmin="false" [fetchId]="user" ></displayClaims>
|
||||
<displayClaims [enableDelete]=false [myClaims]=true [isAdmin]=false ></displayClaims>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div *ngIf="!user" class="container">
|
||||
TODO login
|
||||
</div>
|
||||
`
|
||||
|
||||
})
|
||||
export class MyClaimsComponent {
|
||||
constructor () {
|
||||
}
|
||||
user:string="argirok@di.uoa.gr";
|
||||
ngOnInit() {
|
||||
|
||||
}
|
||||
|
|
|
@ -3,11 +3,12 @@ import { RouterModule } from '@angular/router';
|
|||
|
||||
import { DepositDatasetsComponent } from './depositDatasets.component';
|
||||
import { DepositDatasetsResultComponent } from './depositDatasetsResult.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: DepositDatasetsComponent }
|
||||
{ path: '', component: DepositDatasetsComponent, canActivate: [FreeGuard] }
|
||||
|
||||
])
|
||||
]
|
||||
|
|
|
@ -7,6 +7,7 @@ import { DepositDatasetsResultComponent } from './depositDatasetsResult.componen
|
|||
|
||||
import {DepositDatasetsRoutingModule} from './depositDatasets-routing.module';
|
||||
import {DepoditModule} from '../deposit.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -22,7 +23,7 @@ import {DepoditModule} from '../deposit.module';
|
|||
exports: [
|
||||
DepositDatasetsComponent,
|
||||
],
|
||||
providers: [
|
||||
providers: [FreeGuard
|
||||
]
|
||||
})
|
||||
export class DepositDatasetsModule { }
|
||||
|
|
|
@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { DepositDatasetsResultComponent } from './depositDatasetsResult.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: DepositDatasetsResultComponent }
|
||||
{ path: '', component: DepositDatasetsResultComponent, canActivate: [FreeGuard] }
|
||||
|
||||
])
|
||||
]
|
||||
|
|
|
@ -6,6 +6,7 @@ import { DepositDatasetsResultComponent } from './depositDatasetsResult.componen
|
|||
|
||||
import {DepositDatasetsResultsRoutingModule} from './depositDatasetsResults-routing.module';
|
||||
import {DepoditModule} from '../deposit.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -21,7 +22,7 @@ import {DepoditModule} from '../deposit.module';
|
|||
exports: [
|
||||
DepositDatasetsResultComponent,
|
||||
],
|
||||
providers: [
|
||||
providers: [FreeGuard
|
||||
]
|
||||
})
|
||||
export class DepositDatasetsResultsModule { }
|
||||
|
|
|
@ -114,7 +114,6 @@ export class DepositResultComponent {
|
|||
private route: ActivatedRoute,
|
||||
private _searchDataprovidersService: SearchDataprovidersService,
|
||||
private _organizationService: OrganizationService, private _meta: Meta) {
|
||||
console.info("depositResult constructor");
|
||||
|
||||
this.zenodo = OpenaireProperties.getZenodoURL();
|
||||
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
|
||||
|
|
|
@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { DepositPublicationsComponent } from './depositPublications.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: DepositPublicationsComponent }
|
||||
{ path: '', component: DepositPublicationsComponent, canActivate: [FreeGuard] }
|
||||
|
||||
])
|
||||
]
|
||||
|
|
|
@ -7,6 +7,7 @@ import { DepositPublicationsComponent } from './depositPublications.component';
|
|||
import {DepositPublicationsRoutingModule} from './depositPublications-routing.module';
|
||||
import {DepoditModule} from '../deposit.module';
|
||||
import {IFrameModule} from '../../utils/iframe.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -22,7 +23,7 @@ import {IFrameModule} from '../../utils/iframe.module';
|
|||
exports: [
|
||||
DepositPublicationsComponent,
|
||||
],
|
||||
providers: [
|
||||
providers: [FreeGuard
|
||||
]
|
||||
})
|
||||
export class DepositPublicationsModule { }
|
||||
|
|
|
@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { DepositPublicationsResultComponent } from './depositPublicationsResult.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: DepositPublicationsResultComponent }
|
||||
{ path: '', component: DepositPublicationsResultComponent, canActivate: [FreeGuard] }
|
||||
|
||||
])
|
||||
]
|
||||
|
|
|
@ -6,6 +6,7 @@ import { DepositPublicationsResultComponent } from './depositPublicationsResult.
|
|||
|
||||
import {DepositPublicationsResultRoutingModule} from './depositPublicationsResult-routing.module';
|
||||
import {DepoditModule} from '../deposit.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -21,7 +22,7 @@ import {DepoditModule} from '../deposit.module';
|
|||
exports: [
|
||||
DepositPublicationsResultComponent,
|
||||
],
|
||||
providers: [
|
||||
providers: [FreeGuard
|
||||
]
|
||||
})
|
||||
export class DepositPublicationsResultsModule { }
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import {HomeComponent} from './home.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: 'home', component: HomeComponent },
|
||||
|
||||
])
|
||||
]
|
||||
})
|
||||
export class HomeRoutingModule { }
|
|
@ -1,37 +0,0 @@
|
|||
import {Component} from '@angular/core';
|
||||
import {Router} from '@angular/router';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {Location} from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'home',
|
||||
template:`
|
||||
|
||||
<div class="uk-margin-top">
|
||||
<div class="page-header">
|
||||
<h1>Openaire Search</h1>
|
||||
</div>
|
||||
<div>
|
||||
<form class="uk-form">
|
||||
<input #term type="text" class="uk-form-medium uk-width-1-2" placeholder="Search for..." name="keyword" >
|
||||
<button class="uk-button" type="submit" (click)="searchTerm(term.value)" >Search</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
`
|
||||
})
|
||||
|
||||
export class HomeComponent {
|
||||
|
||||
constructor ( private _router: Router, private location: Location) {
|
||||
|
||||
}
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
searchTerm(term: string) {
|
||||
window.location.href="/search/find?keyword="+term;
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
import { NgModule} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import {HomeComponent} from './home.component';
|
||||
import { HomeRoutingModule } from './home-routing.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule,
|
||||
HomeRoutingModule
|
||||
],
|
||||
declarations: [
|
||||
HomeComponent
|
||||
],
|
||||
|
||||
exports: [
|
||||
HomeComponent
|
||||
]
|
||||
})
|
||||
export class HomeModule { }
|
|
@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { DataProviderComponent } from './dataProvider.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: DataProviderComponent }
|
||||
{ path: '', component: DataProviderComponent, canActivate: [FreeGuard] }
|
||||
])
|
||||
]
|
||||
})
|
||||
|
|
|
@ -26,22 +26,18 @@ import {ProjectsServiceModule} from '../../services/projectsService.module';
|
|||
import {PublicationsServiceModule} from '../../services/publicationsService.module';
|
||||
|
||||
import { DataProviderRoutingModule } from './dataProvider-routing.module';
|
||||
|
||||
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule, RouterModule,DataProviderRoutingModule,
|
||||
TabResultModule, IFrameModule, MetricsModule, LandingModule, DataProvidersServiceModule, DatasetsServiceModule, ProjectsServiceModule, PublicationsServiceModule
|
||||
|
||||
],
|
||||
declarations: [
|
||||
|
||||
PublicationsTabComponent, DatasetsTabComponent, StatisticsTabComponent, ProjectsTabComponent, DatasourcesTabComponent, OrganizationsTabComponent,
|
||||
imports:
|
||||
[CommonModule, FormsModule, RouterModule,DataProviderRoutingModule,
|
||||
TabResultModule, IFrameModule, MetricsModule, LandingModule, DataProvidersServiceModule, DatasetsServiceModule, ProjectsServiceModule, PublicationsServiceModule],
|
||||
declarations:
|
||||
[PublicationsTabComponent, DatasetsTabComponent, StatisticsTabComponent, ProjectsTabComponent, DatasourcesTabComponent, OrganizationsTabComponent,
|
||||
RelatedDatasourcesTabComponent, DataProviderComponent
|
||||
],
|
||||
providers:[
|
||||
DataProviderService
|
||||
DataProviderService, FreeGuard
|
||||
],
|
||||
exports: [
|
||||
DataProviderComponent
|
||||
|
|
|
@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { DatasetComponent } from './dataset.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: DatasetComponent }
|
||||
{ path: '', component: DatasetComponent, canActivate: [FreeGuard] }
|
||||
])
|
||||
]
|
||||
})
|
||||
|
|
|
@ -15,6 +15,7 @@ import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module';
|
|||
|
||||
import { ResultLandingModule } from '../resultLanding.module';
|
||||
import { LandingModule } from '../landing.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -26,7 +27,7 @@ import { LandingModule } from '../landing.module';
|
|||
DatasetComponent
|
||||
],
|
||||
providers:[
|
||||
DatasetService
|
||||
DatasetService, FreeGuard
|
||||
],
|
||||
exports: [
|
||||
DatasetComponent
|
||||
|
|
|
@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { HtmlProjectReportComponent } from './htmlProjectReport.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: HtmlProjectReportComponent }
|
||||
{ path: '', component: HtmlProjectReportComponent , canActivate: [FreeGuard]}
|
||||
])
|
||||
]
|
||||
})
|
||||
|
|
|
@ -8,6 +8,7 @@ import { CacheService } from '../../shared/cache.service';
|
|||
import {HtmlProjectReportService} from './htmlProjectReport.service';
|
||||
import {HtmlProjectReportComponent} from './htmlProjectReport.component';
|
||||
import { HtmlProjectReportRoutingModule } from './htmlProjectReport-routing.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -17,7 +18,7 @@ import { HtmlProjectReportRoutingModule } from './htmlProjectReport-routing.modu
|
|||
HtmlProjectReportComponent
|
||||
],
|
||||
providers:[
|
||||
HtmlProjectReportService,CacheService
|
||||
HtmlProjectReportService,CacheService, FreeGuard
|
||||
],
|
||||
exports: [
|
||||
HtmlProjectReportComponent
|
||||
|
|
|
@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { OrganizationComponent } from './organization.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: OrganizationComponent }
|
||||
{ path: '', component: OrganizationComponent, canActivate: [FreeGuard] }
|
||||
])
|
||||
]
|
||||
})
|
||||
|
|
|
@ -64,7 +64,6 @@ export class OrganizationComponent {
|
|||
private _searchPublicationsService: SearchPublicationsService,
|
||||
private _searchProjectsService: SearchProjectsService, private _meta: Meta) {
|
||||
|
||||
console.info('organization constructor');
|
||||
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import {PublicationsServiceModule} from '../../services/publicationsService.modu
|
|||
import {ProjectsServiceModule} from '../../services/projectsService.module';
|
||||
|
||||
import { SearchingProjectsTabModule} from '../searchingProjectsInTab.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -40,6 +41,7 @@ import { SearchingProjectsTabModule} from '../searchingProjectsInTab.module';
|
|||
OrganizationComponent,
|
||||
],
|
||||
providers:[
|
||||
FreeGuard
|
||||
],
|
||||
exports: [
|
||||
OrganizationComponent
|
||||
|
|
|
@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { PersonComponent } from './person.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: PersonComponent }
|
||||
{ path: '', component: PersonComponent, canActivate: [FreeGuard] }
|
||||
])
|
||||
]
|
||||
})
|
||||
|
|
|
@ -40,7 +40,6 @@ export class PersonComponent {
|
|||
private _searchPublicationsService: SearchPublicationsService,
|
||||
private _searchDatasetsService: SearchDatasetsService, private _meta: Meta) {
|
||||
|
||||
console.info('person constructor');
|
||||
this.fetchPublications = new FetchPublications( this._searchPublicationsService);
|
||||
this.fetchDatasets = new FetchDatasets( this._searchDatasetsService);
|
||||
// this.scrollUp = this._route.events.subscribe((path) => {
|
||||
|
|
|
@ -11,6 +11,7 @@ import { LandingModule } from '../landing.module';
|
|||
import {TabResultModule } from '../../searchPages/searchUtils/tabResult.module';
|
||||
import {DatasetsServiceModule} from '../../services/datasetsService.module';
|
||||
import {PublicationsServiceModule} from '../../services/publicationsService.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -24,7 +25,7 @@ import {PublicationsServiceModule} from '../../services/publicationsService.modu
|
|||
PersonComponent
|
||||
],
|
||||
providers:[
|
||||
PersonService
|
||||
PersonService, FreeGuard
|
||||
],
|
||||
exports: [
|
||||
PersonComponent
|
||||
|
|
|
@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import { PublicationComponent } from './publication.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: PublicationComponent }
|
||||
{ path: '', component: PublicationComponent, canActivate: [FreeGuard] }
|
||||
])
|
||||
]
|
||||
})
|
||||
|
|
|
@ -16,6 +16,7 @@ import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module';
|
|||
|
||||
import { ResultLandingModule } from '../resultLanding.module';
|
||||
import { LandingModule } from '../landing.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -26,7 +27,7 @@ import { LandingModule } from '../landing.module';
|
|||
PublicationComponent
|
||||
],
|
||||
providers:[
|
||||
PublicationService
|
||||
PublicationService, FreeGuard
|
||||
],
|
||||
exports: [
|
||||
PublicationComponent
|
||||
|
|
|
@ -41,7 +41,6 @@ export class ShowAuthorsComponent {
|
|||
private showAll: boolean = false;
|
||||
|
||||
constructor () {
|
||||
console.info('showAuthors constructor');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
|
|
@ -32,7 +32,6 @@ export class ShowIdentifiersComponent {
|
|||
pmcURL: string;
|
||||
|
||||
constructor () {
|
||||
console.info('showIdentifiers constructor');
|
||||
this.doiURL = OpenaireProperties.getDoiURL();
|
||||
this.pmcURL = OpenaireProperties.getPmcURL();
|
||||
}
|
||||
|
|
|
@ -62,7 +62,6 @@ export class ShowSubjectsComponent {
|
|||
private showClassifiedSbj: boolean = false;
|
||||
|
||||
constructor () {
|
||||
console.info('showSubjects constructor');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
|
|
@ -41,7 +41,6 @@ export class ShowTitleComponent {
|
|||
@Input() title: { [key: string]: string };
|
||||
|
||||
constructor () {
|
||||
console.info('title constructor');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
|
|
@ -17,7 +17,6 @@ export class TabPagingComponent {
|
|||
@Output() changeShowAll: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
constructor () {
|
||||
console.info('publication:paging constructor');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
|
|
@ -63,11 +63,9 @@ export class TabTableComponent {
|
|||
public searchLinkToDataset: string;
|
||||
|
||||
constructor () {
|
||||
console.info('tabTable constructor');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
console.info('tabTable ngOnInit');
|
||||
this.searchLinkToPublication = OpenaireProperties.getsearchLinkToPublication();
|
||||
this.searchLinkToDataset = OpenaireProperties.getsearchLinkToDataset();
|
||||
}
|
||||
|
|
|
@ -1,33 +1,39 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Router,CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot} from '@angular/router';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
|
||||
import {Session} from './utils/helper.class';
|
||||
@Injectable()
|
||||
export class AdminLoginGuard implements CanActivate {
|
||||
|
||||
constructor(private router: Router) {}
|
||||
|
||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
|
||||
console.log("AAA inside the AdminLoginGuard!")
|
||||
var user;
|
||||
var loggedIn = false;
|
||||
var isAdmin = false;
|
||||
var errorCode = 1;
|
||||
|
||||
if( typeof localStorage !== 'undefined') {
|
||||
if(localStorage.getItem("user")) {
|
||||
loggedIn = true;
|
||||
user = JSON.parse(localStorage.getItem("user"));
|
||||
if(user.role == 2){
|
||||
isAdmin = true;
|
||||
}
|
||||
if(Session.isLoggedIn()){
|
||||
loggedIn = true;
|
||||
if(!Session.isValidAndRemove()){
|
||||
loggedIn = false;
|
||||
errorCode = 3;
|
||||
}else {
|
||||
isAdmin = Session.isAdminUser();
|
||||
if(!isAdmin){
|
||||
errorCode = 2;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
errorCode =1;
|
||||
}
|
||||
|
||||
if(!loggedIn){
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": 1, "redirectUrl": state.url } });
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": errorCode, "redirectUrl": state.url } });
|
||||
|
||||
return false;
|
||||
}else if(!isAdmin){
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": 2, "redirectUrl": state.url } });
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": errorCode, "redirectUrl": state.url } });
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Router,CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot} from '@angular/router';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {Session} from './utils/helper.class';
|
||||
@Injectable()
|
||||
export class FreeGuard implements CanActivate {
|
||||
|
||||
constructor(private router: Router) {}
|
||||
|
||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
|
||||
var user;
|
||||
var valid = true;
|
||||
var loggedIn = false;
|
||||
var errorCode = 1;
|
||||
|
||||
if(Session.isLoggedIn()){
|
||||
loggedIn = true;
|
||||
if(!Session.isValidAndRemove()){
|
||||
loggedIn = false;
|
||||
valid = false;
|
||||
errorCode = 3;
|
||||
}
|
||||
}
|
||||
|
||||
if(!valid){
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": errorCode, "redirectUrl": state.url } });
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
import {Injectable} from '@angular/core';
|
||||
import {Http, Response, Headers, RequestOptions} from '@angular/http';
|
||||
import {Http, Response, Headers, RequestOptions, URLSearchParams} from '@angular/http';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import 'rxjs/add/observable/of';
|
||||
import 'rxjs/add/operator/do';
|
||||
|
@ -8,7 +8,7 @@ import 'rxjs/add/operator/share';
|
|||
import { CacheService } from '../shared/cache.service';
|
||||
import {PersonInfo} from '../utils/entities/personInfo';
|
||||
import {OpenaireProperties} from '../utils/properties/openaireProperties';
|
||||
import {User} from '../utils/entities/user';
|
||||
import {User,Session,MyJWT} from './utils/helper.class';
|
||||
|
||||
|
||||
@Injectable()
|
||||
|
@ -16,51 +16,28 @@ export class LoginService {
|
|||
|
||||
constructor(private http: Http, public _cache: CacheService) {}
|
||||
|
||||
authenticate (/*user: User*/username: string, password: string):any {
|
||||
/*
|
||||
authenticate (username: string, password: string):any {
|
||||
|
||||
|
||||
let headers = new Headers({ 'Content-Type': 'application/json' });
|
||||
let options = new RequestOptions({ headers: headers });
|
||||
let body = JSON.stringify( {"username":username, "password":password} );
|
||||
|
||||
return this.http.post(this.heroesUrl, { name }, options)
|
||||
.map(this.extractData)
|
||||
.catch(this.handleError);
|
||||
*/
|
||||
let url = OpenaireProperties.getLoginAPIURL()+username+"&password="+password;
|
||||
let key = url;
|
||||
if (this._cache.has(key)) {
|
||||
return Observable.of(this._cache.get(key));
|
||||
}
|
||||
return this.http.get(url)
|
||||
.map(res => <any> res.json())
|
||||
.map(res => this.parseUserInfo(res['data']))
|
||||
.do(res => {
|
||||
this._cache.set(key, res);
|
||||
});
|
||||
return this.http.post(OpenaireProperties.getLoginAPIURL(), body,options)
|
||||
.map(res => <any> res.json())
|
||||
.map(res =>this.parse(res['data']));
|
||||
|
||||
|
||||
// let url = OpenaireProperties.getLoginAPIURL()+"?username="+username+"&password="+password;
|
||||
// let key = url;
|
||||
// return this.http.get(url)
|
||||
// .map(res => <any> res.json())
|
||||
// .map(res =>this.parse(res['data']));
|
||||
|
||||
}
|
||||
private validateJWTFormat(data){
|
||||
|
||||
if(data == null || (data.indexOf(".") !=-1 && data.split('.').length != 3)){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
parse(data:any){
|
||||
return MyJWT.parseUserInfo(data);
|
||||
}
|
||||
private getPayload(data){
|
||||
var payload = data.split('.')[1];
|
||||
return atob(payload);
|
||||
}
|
||||
private parseUserInfo(data: any/*, user: User*/): User {
|
||||
if(this.validateJWTFormat(data)){
|
||||
var info = JSON.parse(this.getPayload(data));
|
||||
}
|
||||
var user: User = new User();
|
||||
|
||||
user.username = info.sub;
|
||||
user.email = info.email;
|
||||
user.id = info.userId;
|
||||
user.fullname = info.fullname;
|
||||
localStorage.setItem("user", JSON.stringify(user));
|
||||
|
||||
return user;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Router,CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot} from '@angular/router';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
import {Session} from './utils/helper.class';
|
||||
|
||||
@Injectable()
|
||||
export class LoginGuard implements CanActivate {
|
||||
|
@ -8,17 +9,21 @@ export class LoginGuard implements CanActivate {
|
|||
constructor(private router: Router) {}
|
||||
|
||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
|
||||
console.log("AAA inside the LoginGuard!")
|
||||
var user;
|
||||
var loggedIn = false;
|
||||
if( typeof localStorage !== 'undefined') {
|
||||
if(localStorage.getItem("user")) {
|
||||
user = JSON.parse(localStorage.getItem("user"));
|
||||
loggedIn = true;
|
||||
}
|
||||
var errorCode = 1;
|
||||
|
||||
if(Session.isLoggedIn()){
|
||||
loggedIn = true;
|
||||
if(!Session.isValidAndRemove()){
|
||||
loggedIn = false;
|
||||
errorCode = 3;
|
||||
}
|
||||
}else{
|
||||
errorCode = 1;
|
||||
}
|
||||
if(!loggedIn){
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": 1, "redirectUrl": state.url } });
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": errorCode, "redirectUrl": state.url } });
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
|
|
|
@ -3,27 +3,30 @@ import {Observable} from 'rxjs/Observable';
|
|||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
|
||||
import {LoginService} from './login.service';
|
||||
import {User} from '../utils/entities/user';
|
||||
|
||||
import {User,Session} from './utils/helper.class';
|
||||
import {RouterHelper} from '../utils/routerHelper.class';
|
||||
@Component({
|
||||
selector: 'user',
|
||||
template: `
|
||||
|
||||
<div class="uk-margin-top">
|
||||
<div *ngIf="!server" class="uk-margin-top">
|
||||
<div *ngIf="errorCode == '1'" class="uk-alert uk-alert-warning">
|
||||
The requested page requires authentication. Please login.
|
||||
</div>
|
||||
<div *ngIf="errorCode == '2'" class="uk-alert uk-alert-warning">
|
||||
You are not authorized to use the requested page
|
||||
</div>
|
||||
<div *ngIf="errorCode == '3'" class="uk-alert uk-alert-warning">
|
||||
The session has expired. Please log in again or continue <a (click)="redirect();">browsing as a guest</a>.
|
||||
</div>
|
||||
<form *ngIf="!loggedIn" class="uk-form uk-flex ">
|
||||
<fieldset>
|
||||
<legend>Login Form</legend>
|
||||
<div class="uk-form-row">
|
||||
<input placeholder="Text input" type="text" name="username" [(ngModel)]="username">
|
||||
<input placeholder="Username" type="text" name="username" [(ngModel)]="username">
|
||||
</div>
|
||||
<div class="uk-form-row">
|
||||
<input placeholder="Password input" type="password" name="password" [(ngModel)]="password">
|
||||
<input placeholder="Password" type="password" name="password" [(ngModel)]="password">
|
||||
</div>
|
||||
<div class="uk-form-row">
|
||||
<button (click)="login()" class="uk-button">Login</button>
|
||||
|
@ -40,48 +43,35 @@ import {User} from '../utils/entities/user';
|
|||
<button (click)="logout()" class="uk-button">Log out</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
`
|
||||
})
|
||||
|
||||
export class UserComponent {
|
||||
public user: User;
|
||||
public loggedIn: boolean = false;
|
||||
public server: boolean = true;
|
||||
public errorMessage: string;
|
||||
public username: string = "";
|
||||
public password: string = "";
|
||||
private sub:any;private sublogin:any;
|
||||
public errorCode: string = "";
|
||||
public redirectUrl: string = "";
|
||||
public routerHelper:RouterHelper = new RouterHelper();
|
||||
|
||||
constructor( private router: Router, private _loginService: LoginService, private route: ActivatedRoute ) {}
|
||||
|
||||
ngOnInit() {
|
||||
if( typeof localStorage !== 'undefined') {
|
||||
if(localStorage.getItem("user")) {
|
||||
this.user = JSON.parse(localStorage.getItem("user"));
|
||||
if(this.user && this.user.id){
|
||||
this.loggedIn = true;
|
||||
}else{
|
||||
this.loggedIn = false;
|
||||
}
|
||||
}
|
||||
if( typeof document !== 'undefined') {
|
||||
this.server = false;
|
||||
}
|
||||
this.loggedIn = Session.isLoggedIn();
|
||||
this.user = Session.getUser();
|
||||
this.errorMessage = "";
|
||||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
this.errorCode = params["errorCode"];
|
||||
this.redirectUrl = params["redirectUrl"];
|
||||
if( typeof localStorage !== 'undefined') {
|
||||
if(localStorage.getItem("user")) {
|
||||
this.user = JSON.parse(localStorage.getItem("user"));
|
||||
if(this.user && this.user.id){
|
||||
this.loggedIn = true;
|
||||
}else{
|
||||
this.loggedIn = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.loggedIn = Session.isLoggedIn();
|
||||
this.user = Session.getUser();
|
||||
this.errorMessage = "";
|
||||
});
|
||||
}
|
||||
|
@ -92,20 +82,39 @@ export class UserComponent {
|
|||
}
|
||||
}
|
||||
logout(){
|
||||
localStorage.removeItem("user");
|
||||
if(Session.isLoggedIn()){
|
||||
Session.removeUser();
|
||||
}
|
||||
this.loggedIn = false;
|
||||
this.user = new User();
|
||||
this.username = "";
|
||||
this.password = "";
|
||||
|
||||
this.redirect();
|
||||
this.redirect();
|
||||
|
||||
}
|
||||
redirect(){
|
||||
if(this.redirectUrl && this.redirectUrl != null && this.redirectUrl != ""){
|
||||
this.router.navigate([this.redirectUrl]);
|
||||
this.redirectUrl = decodeURIComponent(this.redirectUrl);
|
||||
var baseUrl = this.redirectUrl;
|
||||
var queryParams = "";
|
||||
var paramsArray =[];
|
||||
var valuesArray =[];
|
||||
if(this.redirectUrl.indexOf('?') != -1){
|
||||
baseUrl = this.redirectUrl.split('?')[0];
|
||||
queryParams = this.redirectUrl.split('?')[1];
|
||||
}
|
||||
if(queryParams != ""){
|
||||
var queryParamsArray = queryParams.split('&');
|
||||
for(var i = 0; i < queryParamsArray.length; i++){
|
||||
paramsArray.push(queryParamsArray[i].split("=")[0]);
|
||||
valuesArray.push(queryParamsArray[i].split("=")[1]);
|
||||
}
|
||||
this.router.navigate([baseUrl], { queryParams: this.routerHelper.createQueryParams(paramsArray,valuesArray)});
|
||||
}else{
|
||||
this.router.navigate([baseUrl]);
|
||||
}
|
||||
}else{
|
||||
this.router.navigate(['/user-info']);
|
||||
this.router.navigate(['/search/find']);
|
||||
}
|
||||
}
|
||||
login() {
|
||||
|
|
|
@ -3,35 +3,40 @@ import {Observable} from 'rxjs/Observable';
|
|||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {Location} from '@angular/common';
|
||||
import {LoginService} from './login.service';
|
||||
import {User} from '../utils/entities/user';
|
||||
import {User,Session} from './utils/helper.class';
|
||||
import {RouterHelper} from '../utils/routerHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'user-mini',
|
||||
template: `
|
||||
|
||||
<div class="uk-margin-top uk-margin-right uk-float-right">
|
||||
<span *ngIf="loggedIn" >Hello {{user.fullname}}!</span>
|
||||
<a routerLinkActive="router-link-active" routerLink="/user-info" [queryParams]="{redirectUrl: redirectUrl}" ><span *ngIf="loggedIn">Log out</span><span *ngIf="!loggedIn">Log in</span></a>
|
||||
<div *ngIf="!server" class="uk-margin-top uk-margin-right uk-float-right">
|
||||
<span *ngIf="loggedIn" >Hello <a (click)="gotoUserPage();" >{{user.fullname}}</a>!</span>
|
||||
<span *ngIf="!loggedIn" >Hello Guest!</span>
|
||||
<a *ngIf="!loggedIn" (click)="gotoUserPage();" >Log in</a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
`
|
||||
})
|
||||
|
||||
export class UserMiniComponent {
|
||||
public user: User;
|
||||
public loggedIn: boolean = false;
|
||||
public server: boolean = true;
|
||||
public routerHelper:RouterHelper = new RouterHelper();
|
||||
|
||||
public redirectUrl: string = "";
|
||||
private baseUrl = "user-info";
|
||||
sub:any;
|
||||
constructor( private router: Router, private route: ActivatedRoute, private location: Location) {}
|
||||
|
||||
ngOnInit() {
|
||||
if( typeof document !== 'undefined') {
|
||||
this.server = false;
|
||||
}
|
||||
this.initialize();
|
||||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
|
||||
this.initialize();
|
||||
this.initialize();
|
||||
});
|
||||
}
|
||||
ngOnDestroy(){
|
||||
|
@ -39,21 +44,28 @@ export class UserMiniComponent {
|
|||
}
|
||||
initialize(){
|
||||
this.redirectUrl = this.location.path();
|
||||
if( typeof localStorage !== 'undefined') {
|
||||
if(localStorage.getItem("user")) {
|
||||
this.user = JSON.parse(localStorage.getItem("user"));
|
||||
if(this.user && this.user.id){
|
||||
this.loggedIn = true;
|
||||
}else{
|
||||
this.loggedIn = false;
|
||||
}
|
||||
}else{
|
||||
this.loggedIn = false;
|
||||
}
|
||||
if(Session.isLoggedIn()){
|
||||
if(Session.isUserValid()){
|
||||
this.loggedIn = Session.isLoggedIn();
|
||||
this.user = Session.getUser();
|
||||
}else{
|
||||
Session.removeUser();
|
||||
this.loggedIn = false;
|
||||
this.user = null;
|
||||
}
|
||||
}else {
|
||||
this.loggedIn = false;
|
||||
this.user = null;
|
||||
}
|
||||
|
||||
}
|
||||
gotoUserPage(){
|
||||
this.redirectUrl = this.location.path();
|
||||
if(this.redirectUrl && this.redirectUrl != null && this.redirectUrl != "" && this.redirectUrl !="user-info"){
|
||||
this.router.navigate([this.baseUrl], { queryParams: this.routerHelper.createQueryParam("redirectUrl",this.redirectUrl )});
|
||||
}else{
|
||||
this.router.navigate([this.baseUrl]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,123 @@
|
|||
export class User {
|
||||
email:string;
|
||||
username: string;
|
||||
id: string;
|
||||
fullname: string;
|
||||
expirationDate: number;
|
||||
role:string;
|
||||
jwt:string;
|
||||
|
||||
}
|
||||
|
||||
export class Session{
|
||||
public static setUser(user:User): User {
|
||||
|
||||
localStorage.setItem("user", JSON.stringify(user));
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
public static removeUser() {
|
||||
if(Session.isLoggedIn()){
|
||||
localStorage.removeItem("user");
|
||||
}
|
||||
}
|
||||
public static getUser():User {
|
||||
if(Session.isLoggedIn()){
|
||||
return JSON.parse(localStorage.getItem("user"));
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public static isLoggedIn(): boolean {
|
||||
var loggedIn:boolean = false;
|
||||
var user:User = null;
|
||||
if( typeof localStorage !== 'undefined') {
|
||||
if(localStorage.getItem("user")) {
|
||||
user = JSON.parse(localStorage.getItem("user"));
|
||||
if(user && user.id){
|
||||
loggedIn = true;
|
||||
}else{
|
||||
loggedIn = false;
|
||||
}
|
||||
}else{
|
||||
loggedIn = false;
|
||||
}
|
||||
}else{
|
||||
loggedIn = false;
|
||||
}
|
||||
return loggedIn;
|
||||
}
|
||||
public static getUserJwt():string {
|
||||
if(Session.isLoggedIn()){
|
||||
return Session.getUser().jwt;
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
public static getUserEmail():string {
|
||||
if(Session.isLoggedIn()){
|
||||
return Session.getUser().email;
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
public static isAdminUser():boolean {
|
||||
if(Session.isLoggedIn()){
|
||||
return (Session.getUser().role == '2');
|
||||
}
|
||||
|
||||
}
|
||||
public static isUserValid() {
|
||||
if(Session.isLoggedIn()){
|
||||
var expires = Session.getUser().expirationDate;
|
||||
var now = new Date().getTime() / 1000;
|
||||
console.log(" is still valid ? "+(now < expires) + " now is:"+now + "expires at:"+expires);
|
||||
return now < expires;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static isValidAndRemove() {
|
||||
if(Session.isLoggedIn()){
|
||||
if(!Session.isUserValid()){
|
||||
Session.removeUser();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
export class MyJWT{
|
||||
private static validateJWTFormat(data){
|
||||
|
||||
if(data == null || (data.indexOf(".") !=-1 && data.split('.').length != 3)){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private static getPayload(data){
|
||||
var payload = data.split('.')[1];
|
||||
return atob(payload);
|
||||
}
|
||||
public static parseUserInfo(data: any): User {
|
||||
if(this.validateJWTFormat(data)){
|
||||
var info = JSON.parse(this.getPayload(data));
|
||||
}
|
||||
var user: User = new User();
|
||||
|
||||
user.username = info.sub;
|
||||
user.email = info.email;
|
||||
user.id = info.userId;
|
||||
user.fullname = info.fullname;
|
||||
user.role = info.role;
|
||||
user.jwt = data;
|
||||
user.expirationDate = info.exp;
|
||||
localStorage.setItem("user", JSON.stringify(user));
|
||||
return user;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import{AdvancedSearchDataProvidersComponent} from './advancedSearchDataProviders.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: AdvancedSearchDataProvidersComponent }
|
||||
{ path: '', component: AdvancedSearchDataProvidersComponent, canActivate: [FreeGuard] }
|
||||
|
||||
])
|
||||
]
|
||||
|
|
|
@ -8,6 +8,7 @@ import{AdvancedSearchDataProvidersComponent} from './advancedSearchDataProviders
|
|||
|
||||
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
|
||||
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -19,7 +20,7 @@ import {DataProvidersServiceModule} from '../../services/dataProvidersService.mo
|
|||
declarations: [
|
||||
AdvancedSearchDataProvidersComponent
|
||||
],
|
||||
providers:[
|
||||
providers:[FreeGuard
|
||||
],
|
||||
exports: [
|
||||
AdvancedSearchDataProvidersComponent
|
||||
|
|
|
@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import{AdvancedSearchDatasetsComponent} from './advancedSearchDatasets.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: AdvancedSearchDatasetsComponent }
|
||||
{ path: '', component: AdvancedSearchDatasetsComponent, canActivate: [FreeGuard] }
|
||||
|
||||
])
|
||||
]
|
||||
|
|
|
@ -8,6 +8,7 @@ import{AdvancedSearchDatasetsComponent} from './advancedSearchDatasets.component
|
|||
|
||||
import {DatasetsServiceModule} from '../../services/datasetsService.module';
|
||||
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -19,7 +20,7 @@ import {DatasetsServiceModule} from '../../services/datasetsService.module';
|
|||
declarations: [
|
||||
AdvancedSearchDatasetsComponent
|
||||
],
|
||||
providers:[
|
||||
providers:[FreeGuard
|
||||
],
|
||||
exports: [
|
||||
AdvancedSearchDatasetsComponent
|
||||
|
|
|
@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import{AdvancedSearchOrganizationsComponent} from './advancedSearchOrganizations.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: AdvancedSearchOrganizationsComponent }
|
||||
{ path: '', component: AdvancedSearchOrganizationsComponent , canActivate: [FreeGuard]}
|
||||
|
||||
])
|
||||
]
|
||||
|
|
|
@ -8,6 +8,7 @@ import{AdvancedSearchOrganizationsComponent} from './advancedSearchOrganizations
|
|||
|
||||
import {OrganizationsServiceModule} from '../../services/organizationsService.module';
|
||||
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -19,7 +20,7 @@ import {OrganizationsServiceModule} from '../../services/organizationsService.mo
|
|||
declarations: [
|
||||
AdvancedSearchOrganizationsComponent
|
||||
],
|
||||
providers:[
|
||||
providers:[FreeGuard
|
||||
],
|
||||
exports: [
|
||||
AdvancedSearchOrganizationsComponent
|
||||
|
|
|
@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import{AdvancedSearchPeopleComponent} from './advancedSearchPeople.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: AdvancedSearchPeopleComponent }
|
||||
{ path: '', component: AdvancedSearchPeopleComponent, canActivate: [FreeGuard] }
|
||||
|
||||
])
|
||||
]
|
||||
|
|
|
@ -8,6 +8,7 @@ import{AdvancedSearchPeopleComponent} from './advancedSearchPeople.component';
|
|||
|
||||
import {PeopleServiceModule} from '../../services/peopleService.module';
|
||||
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -19,7 +20,7 @@ import {PeopleServiceModule} from '../../services/peopleService.module';
|
|||
declarations: [
|
||||
AdvancedSearchPeopleComponent
|
||||
],
|
||||
providers:[
|
||||
providers:[FreeGuard
|
||||
],
|
||||
exports: [
|
||||
AdvancedSearchPeopleComponent
|
||||
|
|
|
@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import{AdvancedSearchProjectsComponent} from './advancedSearchProjects.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: AdvancedSearchProjectsComponent }
|
||||
{ path: '', component: AdvancedSearchProjectsComponent, canActivate: [FreeGuard] }
|
||||
|
||||
])
|
||||
]
|
||||
|
|
|
@ -8,6 +8,7 @@ import{AdvancedSearchProjectsComponent} from './advancedSearchProjects.component
|
|||
|
||||
import {ProjectsServiceModule} from '../../services/projectsService.module';
|
||||
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -19,7 +20,7 @@ import {ProjectsServiceModule} from '../../services/projectsService.module';
|
|||
declarations: [
|
||||
AdvancedSearchProjectsComponent
|
||||
],
|
||||
providers:[
|
||||
providers:[FreeGuard
|
||||
],
|
||||
exports: [
|
||||
AdvancedSearchProjectsComponent
|
||||
|
|
|
@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import{AdvancedSearchPublicationsComponent} from './advancedSearchPublications.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: AdvancedSearchPublicationsComponent }
|
||||
{ path: '', component: AdvancedSearchPublicationsComponent, canActivate: [FreeGuard] }
|
||||
|
||||
])
|
||||
]
|
||||
|
|
|
@ -8,6 +8,7 @@ import{AdvancedSearchPublicationsComponent} from './advancedSearchPublications.c
|
|||
|
||||
import {PublicationsServiceModule} from '../../services/publicationsService.module';
|
||||
import {AdvancedSearchPageModule} from '../searchUtils/advancedSearchPage.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -19,7 +20,7 @@ import {PublicationsServiceModule} from '../../services/publicationsService.modu
|
|||
declarations: [
|
||||
AdvancedSearchPublicationsComponent
|
||||
],
|
||||
providers:[
|
||||
providers:[FreeGuard
|
||||
],
|
||||
exports: [
|
||||
AdvancedSearchPublicationsComponent
|
||||
|
|
|
@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import{SearchCompatibleDataprovidersComponent} from './compatibleDataProviders.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: SearchCompatibleDataprovidersComponent }
|
||||
{ path: '', component: SearchCompatibleDataprovidersComponent, canActivate: [FreeGuard] }
|
||||
|
||||
])
|
||||
]
|
||||
|
|
|
@ -10,6 +10,8 @@ import {SearchResultsModule } from '../searchUtils/searchResults.module';
|
|||
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
|
||||
import {SearchFormModule} from '../searchUtils/searchForm.module';
|
||||
import {SearchPageModule} from '../searchUtils/searchPage.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule,
|
||||
|
@ -20,7 +22,7 @@ import {SearchPageModule} from '../searchUtils/searchPage.module';
|
|||
declarations: [
|
||||
SearchCompatibleDataprovidersComponent
|
||||
],
|
||||
providers:[
|
||||
providers:[FreeGuard
|
||||
],
|
||||
exports: [
|
||||
SearchCompatibleDataprovidersComponent
|
||||
|
|
|
@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import{SearchEntityRegistriesComponent} from './entityRegistries.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: SearchEntityRegistriesComponent }
|
||||
{ path: '', component: SearchEntityRegistriesComponent, canActivate: [FreeGuard] }
|
||||
|
||||
])
|
||||
]
|
||||
|
|
|
@ -10,6 +10,8 @@ import {SearchResultsModule } from '../searchUtils/searchResults.module';
|
|||
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
|
||||
import {SearchFormModule} from '../searchUtils/searchForm.module';
|
||||
import {SearchPageModule} from '../searchUtils/searchPage.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule,
|
||||
|
@ -20,7 +22,7 @@ import {SearchPageModule} from '../searchUtils/searchPage.module';
|
|||
declarations: [
|
||||
SearchEntityRegistriesComponent
|
||||
],
|
||||
providers:[
|
||||
providers:[FreeGuard
|
||||
],
|
||||
exports: [
|
||||
SearchEntityRegistriesComponent
|
||||
|
|
|
@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import{SearchComponent} from './search.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: SearchComponent }
|
||||
{ path: '', component: SearchComponent, canActivate: [FreeGuard] }
|
||||
|
||||
])
|
||||
]
|
||||
|
|
|
@ -16,6 +16,7 @@ import {OrganizationsServiceModule} from '../../services/organizationsService.mo
|
|||
import {PeopleServiceModule} from '../../services/peopleService.module';
|
||||
import {BrowseEntitiesModule} from '../searchUtils/browseEntities.module';
|
||||
import {SearchFormModule} from '../searchUtils/searchForm.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -28,7 +29,7 @@ import {SearchFormModule} from '../searchUtils/searchForm.module';
|
|||
declarations: [
|
||||
SearchComponent
|
||||
],
|
||||
providers:[
|
||||
providers:[FreeGuard
|
||||
],
|
||||
exports: [
|
||||
SearchComponent
|
||||
|
|
|
@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import{SearchDataprovidersComponent} from './searchDataproviders.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: SearchDataprovidersComponent }
|
||||
{ path: '', component: SearchDataprovidersComponent, canActivate: [FreeGuard] }
|
||||
|
||||
])
|
||||
]
|
||||
|
|
|
@ -10,6 +10,8 @@ import {SearchResultsModule } from '../searchUtils/searchResults.module';
|
|||
import {DataProvidersServiceModule} from '../../services/dataProvidersService.module';
|
||||
import {SearchFormModule} from '../searchUtils/searchForm.module';
|
||||
import {SearchPageModule} from '../searchUtils/searchPage.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule,
|
||||
|
@ -21,7 +23,7 @@ import {SearchPageModule} from '../searchUtils/searchPage.module';
|
|||
declarations: [
|
||||
SearchDataprovidersComponent
|
||||
],
|
||||
providers:[
|
||||
providers:[FreeGuard
|
||||
],
|
||||
exports: [
|
||||
SearchDataprovidersComponent
|
||||
|
|
|
@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import{SearchDatasetsComponent} from './searchDatasets.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: SearchDatasetsComponent }
|
||||
{ path: '', component: SearchDatasetsComponent, canActivate: [FreeGuard] }
|
||||
|
||||
])
|
||||
]
|
||||
|
|
|
@ -10,6 +10,8 @@ import {SearchResultsModule } from '../searchUtils/searchResults.module';
|
|||
import {DatasetsServiceModule} from '../../services/datasetsService.module';
|
||||
import {SearchFormModule} from '../searchUtils/searchForm.module';
|
||||
import {SearchPageModule} from '../searchUtils/searchPage.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule,
|
||||
|
@ -21,7 +23,7 @@ import {SearchPageModule} from '../searchUtils/searchPage.module';
|
|||
declarations: [
|
||||
SearchDatasetsComponent
|
||||
],
|
||||
providers:[
|
||||
providers:[FreeGuard
|
||||
],
|
||||
exports: [
|
||||
SearchDatasetsComponent
|
||||
|
|
|
@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import{SearchOrganizationsComponent} from './searchOrganizations.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: SearchOrganizationsComponent }
|
||||
{ path: '', component: SearchOrganizationsComponent, canActivate: [FreeGuard] }
|
||||
|
||||
])
|
||||
]
|
||||
|
|
|
@ -10,6 +10,8 @@ import {SearchResultsModule } from '../searchUtils/searchResults.module';
|
|||
import {OrganizationsServiceModule} from '../../services/organizationsService.module';
|
||||
import {SearchFormModule} from '../searchUtils/searchForm.module';
|
||||
import {SearchPageModule} from '../searchUtils/searchPage.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule,
|
||||
|
@ -21,7 +23,7 @@ import {SearchPageModule} from '../searchUtils/searchPage.module';
|
|||
declarations: [
|
||||
SearchOrganizationsComponent
|
||||
],
|
||||
providers:[
|
||||
providers:[FreeGuard
|
||||
],
|
||||
exports: [
|
||||
SearchOrganizationsComponent
|
||||
|
|
|
@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import{SearchPeopleComponent} from './searchPeople.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: SearchPeopleComponent }
|
||||
{ path: '', component: SearchPeopleComponent, canActivate: [FreeGuard] }
|
||||
|
||||
])
|
||||
]
|
||||
|
|
|
@ -10,6 +10,8 @@ import {SearchResultsModule } from '../searchUtils/searchResults.module';
|
|||
import {PeopleServiceModule} from '../../services/peopleService.module';
|
||||
import {SearchFormModule} from '../searchUtils/searchForm.module';
|
||||
import {SearchPageModule} from '../searchUtils/searchPage.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule,
|
||||
|
@ -21,7 +23,7 @@ import {SearchPageModule} from '../searchUtils/searchPage.module';
|
|||
declarations: [
|
||||
SearchPeopleComponent
|
||||
],
|
||||
providers:[
|
||||
providers:[FreeGuard
|
||||
],
|
||||
exports: [
|
||||
SearchPeopleComponent
|
||||
|
|
|
@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import{SearchProjectsComponent} from './searchProjects.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: SearchProjectsComponent }
|
||||
{ path: '', component: SearchProjectsComponent, canActivate: [FreeGuard] }
|
||||
|
||||
])
|
||||
]
|
||||
|
|
|
@ -10,6 +10,8 @@ import {SearchResultsModule } from '../searchUtils/searchResults.module';
|
|||
import {ProjectsServiceModule} from '../../services/projectsService.module';
|
||||
import {SearchFormModule} from '../searchUtils/searchForm.module';
|
||||
import {SearchPageModule} from '../searchUtils/searchPage.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule,
|
||||
|
@ -21,7 +23,7 @@ import {SearchPageModule} from '../searchUtils/searchPage.module';
|
|||
declarations: [
|
||||
SearchProjectsComponent
|
||||
],
|
||||
providers:[
|
||||
providers:[FreeGuard
|
||||
],
|
||||
exports: [
|
||||
SearchProjectsComponent
|
||||
|
|
|
@ -2,11 +2,12 @@ import { NgModule } from '@angular/core';
|
|||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import{SearchPublicationsComponent} from './searchPublications.component';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: SearchPublicationsComponent }
|
||||
{ path: '', component: SearchPublicationsComponent, canActivate: [FreeGuard] }
|
||||
|
||||
])
|
||||
]
|
||||
|
|
|
@ -10,6 +10,8 @@ import {SearchResultsModule } from '../searchUtils/searchResults.module';
|
|||
import {PublicationsServiceModule} from '../../services/publicationsService.module';
|
||||
import {SearchFormModule} from '../searchUtils/searchForm.module';
|
||||
import {SearchPageModule} from '../searchUtils/searchPage.module';
|
||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule,
|
||||
|
@ -21,7 +23,7 @@ import {SearchPageModule} from '../searchUtils/searchPage.module';
|
|||
declarations: [
|
||||
SearchPublicationsComponent
|
||||
],
|
||||
providers:[
|
||||
providers:[FreeGuard
|
||||
],
|
||||
exports: [
|
||||
SearchPublicationsComponent
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
export class User {
|
||||
email:string;
|
||||
username: string;
|
||||
id: string;
|
||||
fullname: string;
|
||||
}
|
|
@ -55,7 +55,6 @@ export class ExportCSVComponent {
|
|||
linkname: string = "Download CSV";
|
||||
|
||||
constructor () {
|
||||
console.info('export constructor');
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
|
|
@ -31,7 +31,7 @@ export class OpenaireProperties {
|
|||
private static metricsAPIURL = "http://vatopedi.di.uoa.gr:8080/stats/";
|
||||
private static framesAPIURL = "http://vatopedi.di.uoa.gr/stats2/";
|
||||
|
||||
private static loginAPIURL = "http://mpagasas.di.uoa.gr:8080/uoa-user-management-1.0.0-SNAPSHOT/api/users/authenticate?username=";
|
||||
private static loginAPIURL = "http://mpagasas.di.uoa.gr:8080/uoa-user-management-1.0.0-SNAPSHOT/api/users/authenticates";
|
||||
|
||||
// public claimsAPIURL = "http://rudie.di.uoa.gr:8080/dnet-openaire-connector-service-1.0.0-SNAPSHOT/rest/claimsService/"
|
||||
private static claimsAPIURL = "http://scoobydoo.di.uoa.gr:8080/dnet-openaire-connector-service-1.0.0-SNAPSHOT/rest/claimsService/";
|
||||
|
|
|
@ -59,7 +59,6 @@ export class ShowDataProvidersComponent {
|
|||
"organizations": {"name": string, "url": string}[]}[];
|
||||
|
||||
constructor () {
|
||||
console.info('showDataProviders constructor');
|
||||
}
|
||||
|
||||
ngOnInit() {}
|
||||
|
|
|
@ -16,8 +16,8 @@ export const routes: string[] = [
|
|||
'search/advanced/people','search/advanced/publications','search/advanced/projects','search/advanced/datasets','search/advanced/dataproviders','search/advanced/organizations',
|
||||
'participate/deposit-publications','participate/deposit-datasets','participate/deposit-publications-result','participate/deposit-datasets-result',
|
||||
'search/data-providers','search/entity-registries', 'project-report',
|
||||
'claims','myclaims','participate/claim', 'participate/bulk-claim',
|
||||
'claims','myclaims','participate/claim', 'participate/direct-claim',
|
||||
'test', 'user-info',
|
||||
'error'
|
||||
'**','error'
|
||||
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue