-
-
`
})
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() {
diff --git a/portal-2/src/app/login/userMini.component.ts b/portal-2/src/app/login/userMini.component.ts
index b3f6a442..f9fb8a74 100644
--- a/portal-2/src/app/login/userMini.component.ts
+++ b/portal-2/src/app/login/userMini.component.ts
@@ -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: `
-
-
Hello {{user.fullname}}!
-
Log outLog in
+
-
-
`
})
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]);
+ }
}
-
}
diff --git a/portal-2/src/app/login/utils/helper.class.ts b/portal-2/src/app/login/utils/helper.class.ts
new file mode 100644
index 00000000..a00a9b47
--- /dev/null
+++ b/portal-2/src/app/login/utils/helper.class.ts
@@ -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;
+ }
+
+
+}
diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders-routing.module.ts b/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders-routing.module.ts
index 981e2fbf..4c3fb074 100644
--- a/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders-routing.module.ts
+++ b/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders-routing.module.ts
@@ -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] }
])
]
diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders.module.ts b/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders.module.ts
index 22dff9a1..b9f00af4 100644
--- a/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders.module.ts
+++ b/portal-2/src/app/searchPages/advanced/advancedSearchDataProviders.module.ts
@@ -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
diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchDatasets-routing.module.ts b/portal-2/src/app/searchPages/advanced/advancedSearchDatasets-routing.module.ts
index d3c04537..700d65f3 100644
--- a/portal-2/src/app/searchPages/advanced/advancedSearchDatasets-routing.module.ts
+++ b/portal-2/src/app/searchPages/advanced/advancedSearchDatasets-routing.module.ts
@@ -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] }
])
]
diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchDatasets.module.ts b/portal-2/src/app/searchPages/advanced/advancedSearchDatasets.module.ts
index 3f4b53fe..5a38795c 100644
--- a/portal-2/src/app/searchPages/advanced/advancedSearchDatasets.module.ts
+++ b/portal-2/src/app/searchPages/advanced/advancedSearchDatasets.module.ts
@@ -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
diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations-routing.module.ts b/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations-routing.module.ts
index 73bf1720..c04401bc 100644
--- a/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations-routing.module.ts
+++ b/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations-routing.module.ts
@@ -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]}
])
]
diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations.module.ts b/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations.module.ts
index dce63f08..aff4b1c7 100644
--- a/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations.module.ts
+++ b/portal-2/src/app/searchPages/advanced/advancedSearchOrganizations.module.ts
@@ -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
diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchPeople-routing.module.ts b/portal-2/src/app/searchPages/advanced/advancedSearchPeople-routing.module.ts
index 76ab818f..5bd4d9a5 100644
--- a/portal-2/src/app/searchPages/advanced/advancedSearchPeople-routing.module.ts
+++ b/portal-2/src/app/searchPages/advanced/advancedSearchPeople-routing.module.ts
@@ -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] }
])
]
diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchPeople.module.ts b/portal-2/src/app/searchPages/advanced/advancedSearchPeople.module.ts
index 8192f3c1..7500f792 100644
--- a/portal-2/src/app/searchPages/advanced/advancedSearchPeople.module.ts
+++ b/portal-2/src/app/searchPages/advanced/advancedSearchPeople.module.ts
@@ -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
diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchProjects-routing.module.ts b/portal-2/src/app/searchPages/advanced/advancedSearchProjects-routing.module.ts
index 2948f8da..edf916e8 100644
--- a/portal-2/src/app/searchPages/advanced/advancedSearchProjects-routing.module.ts
+++ b/portal-2/src/app/searchPages/advanced/advancedSearchProjects-routing.module.ts
@@ -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] }
])
]
diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchProjects.module.ts b/portal-2/src/app/searchPages/advanced/advancedSearchProjects.module.ts
index caa7787d..6357286b 100644
--- a/portal-2/src/app/searchPages/advanced/advancedSearchProjects.module.ts
+++ b/portal-2/src/app/searchPages/advanced/advancedSearchProjects.module.ts
@@ -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
diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchPublications-routing.module.ts b/portal-2/src/app/searchPages/advanced/advancedSearchPublications-routing.module.ts
index 97a2fda8..f56f4348 100644
--- a/portal-2/src/app/searchPages/advanced/advancedSearchPublications-routing.module.ts
+++ b/portal-2/src/app/searchPages/advanced/advancedSearchPublications-routing.module.ts
@@ -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] }
])
]
diff --git a/portal-2/src/app/searchPages/advanced/advancedSearchPublications.module.ts b/portal-2/src/app/searchPages/advanced/advancedSearchPublications.module.ts
index c6f0cfcd..35f5ac18 100644
--- a/portal-2/src/app/searchPages/advanced/advancedSearchPublications.module.ts
+++ b/portal-2/src/app/searchPages/advanced/advancedSearchPublications.module.ts
@@ -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
diff --git a/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders-routing.module.ts b/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders-routing.module.ts
index 4e474f98..58111a67 100644
--- a/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders-routing.module.ts
+++ b/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders-routing.module.ts
@@ -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] }
])
]
diff --git a/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.module.ts b/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.module.ts
index d5497968..ecf4518f 100644
--- a/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.module.ts
+++ b/portal-2/src/app/searchPages/dataProviders/compatibleDataProviders.module.ts
@@ -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
diff --git a/portal-2/src/app/searchPages/dataProviders/entityRegistries-routing.module.ts b/portal-2/src/app/searchPages/dataProviders/entityRegistries-routing.module.ts
index ab2bb1ab..46ea5b44 100644
--- a/portal-2/src/app/searchPages/dataProviders/entityRegistries-routing.module.ts
+++ b/portal-2/src/app/searchPages/dataProviders/entityRegistries-routing.module.ts
@@ -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] }
])
]
diff --git a/portal-2/src/app/searchPages/dataProviders/entityRegistries.module.ts b/portal-2/src/app/searchPages/dataProviders/entityRegistries.module.ts
index 0512597c..a05f1dd4 100644
--- a/portal-2/src/app/searchPages/dataProviders/entityRegistries.module.ts
+++ b/portal-2/src/app/searchPages/dataProviders/entityRegistries.module.ts
@@ -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
diff --git a/portal-2/src/app/searchPages/find/mainSearch-routing.module.ts b/portal-2/src/app/searchPages/find/mainSearch-routing.module.ts
index 362ef038..ab4c3d22 100644
--- a/portal-2/src/app/searchPages/find/mainSearch-routing.module.ts
+++ b/portal-2/src/app/searchPages/find/mainSearch-routing.module.ts
@@ -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] }
])
]
diff --git a/portal-2/src/app/searchPages/find/mainSearch.module.ts b/portal-2/src/app/searchPages/find/mainSearch.module.ts
index b2faad07..4d63b1b3 100644
--- a/portal-2/src/app/searchPages/find/mainSearch.module.ts
+++ b/portal-2/src/app/searchPages/find/mainSearch.module.ts
@@ -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
diff --git a/portal-2/src/app/searchPages/simple/searchDataProviders-routing.module.ts b/portal-2/src/app/searchPages/simple/searchDataProviders-routing.module.ts
index 70ce05a6..fefe1cc3 100644
--- a/portal-2/src/app/searchPages/simple/searchDataProviders-routing.module.ts
+++ b/portal-2/src/app/searchPages/simple/searchDataProviders-routing.module.ts
@@ -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] }
])
]
diff --git a/portal-2/src/app/searchPages/simple/searchDataProviders.module.ts b/portal-2/src/app/searchPages/simple/searchDataProviders.module.ts
index 21cb9fd6..03e24660 100644
--- a/portal-2/src/app/searchPages/simple/searchDataProviders.module.ts
+++ b/portal-2/src/app/searchPages/simple/searchDataProviders.module.ts
@@ -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
diff --git a/portal-2/src/app/searchPages/simple/searchDatasets-routing.module.ts b/portal-2/src/app/searchPages/simple/searchDatasets-routing.module.ts
index 8eaaabff..a3f3e976 100644
--- a/portal-2/src/app/searchPages/simple/searchDatasets-routing.module.ts
+++ b/portal-2/src/app/searchPages/simple/searchDatasets-routing.module.ts
@@ -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] }
])
]
diff --git a/portal-2/src/app/searchPages/simple/searchDatasets.module.ts b/portal-2/src/app/searchPages/simple/searchDatasets.module.ts
index 63cf2ee7..d686200d 100644
--- a/portal-2/src/app/searchPages/simple/searchDatasets.module.ts
+++ b/portal-2/src/app/searchPages/simple/searchDatasets.module.ts
@@ -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
diff --git a/portal-2/src/app/searchPages/simple/searchOrganizations-routing.module.ts b/portal-2/src/app/searchPages/simple/searchOrganizations-routing.module.ts
index f1dda3f6..cb8ff00d 100644
--- a/portal-2/src/app/searchPages/simple/searchOrganizations-routing.module.ts
+++ b/portal-2/src/app/searchPages/simple/searchOrganizations-routing.module.ts
@@ -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] }
])
]
diff --git a/portal-2/src/app/searchPages/simple/searchOrganizations.module.ts b/portal-2/src/app/searchPages/simple/searchOrganizations.module.ts
index ba4d802f..4f50fe2a 100644
--- a/portal-2/src/app/searchPages/simple/searchOrganizations.module.ts
+++ b/portal-2/src/app/searchPages/simple/searchOrganizations.module.ts
@@ -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
diff --git a/portal-2/src/app/searchPages/simple/searchPeople-routing.module.ts b/portal-2/src/app/searchPages/simple/searchPeople-routing.module.ts
index 26d6a609..210130c7 100644
--- a/portal-2/src/app/searchPages/simple/searchPeople-routing.module.ts
+++ b/portal-2/src/app/searchPages/simple/searchPeople-routing.module.ts
@@ -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] }
])
]
diff --git a/portal-2/src/app/searchPages/simple/searchPeople.module.ts b/portal-2/src/app/searchPages/simple/searchPeople.module.ts
index 746d398f..2cdc30de 100644
--- a/portal-2/src/app/searchPages/simple/searchPeople.module.ts
+++ b/portal-2/src/app/searchPages/simple/searchPeople.module.ts
@@ -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
diff --git a/portal-2/src/app/searchPages/simple/searchProjects-routing.module.ts b/portal-2/src/app/searchPages/simple/searchProjects-routing.module.ts
index 46a2f5cd..11f2e575 100644
--- a/portal-2/src/app/searchPages/simple/searchProjects-routing.module.ts
+++ b/portal-2/src/app/searchPages/simple/searchProjects-routing.module.ts
@@ -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] }
])
]
diff --git a/portal-2/src/app/searchPages/simple/searchProjects.module.ts b/portal-2/src/app/searchPages/simple/searchProjects.module.ts
index f7642d80..083f430e 100644
--- a/portal-2/src/app/searchPages/simple/searchProjects.module.ts
+++ b/portal-2/src/app/searchPages/simple/searchProjects.module.ts
@@ -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
diff --git a/portal-2/src/app/searchPages/simple/searchPublications-routing.module.ts b/portal-2/src/app/searchPages/simple/searchPublications-routing.module.ts
index 9ac5a5db..ace89403 100644
--- a/portal-2/src/app/searchPages/simple/searchPublications-routing.module.ts
+++ b/portal-2/src/app/searchPages/simple/searchPublications-routing.module.ts
@@ -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] }
])
]
diff --git a/portal-2/src/app/searchPages/simple/searchPublications.module.ts b/portal-2/src/app/searchPages/simple/searchPublications.module.ts
index 7cd16867..20ea399e 100644
--- a/portal-2/src/app/searchPages/simple/searchPublications.module.ts
+++ b/portal-2/src/app/searchPages/simple/searchPublications.module.ts
@@ -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
diff --git a/portal-2/src/app/utils/entities/user.ts b/portal-2/src/app/utils/entities/user.ts
deleted file mode 100644
index aaed5ab0..00000000
--- a/portal-2/src/app/utils/entities/user.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-export class User {
- email:string;
- username: string;
- id: string;
- fullname: string;
-}
diff --git a/portal-2/src/app/utils/exportCSV.class.ts b/portal-2/src/app/utils/exportCSV.class.ts
index ca4f4918..c5e39a33 100644
--- a/portal-2/src/app/utils/exportCSV.class.ts
+++ b/portal-2/src/app/utils/exportCSV.class.ts
@@ -55,7 +55,6 @@ export class ExportCSVComponent {
linkname: string = "Download CSV";
constructor () {
- console.info('export constructor');
}
ngOnInit() {
diff --git a/portal-2/src/app/utils/properties/openaireProperties.ts b/portal-2/src/app/utils/properties/openaireProperties.ts
index 8bdd8eef..429864c6 100644
--- a/portal-2/src/app/utils/properties/openaireProperties.ts
+++ b/portal-2/src/app/utils/properties/openaireProperties.ts
@@ -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/";
diff --git a/portal-2/src/app/utils/showDataProviders.component.ts b/portal-2/src/app/utils/showDataProviders.component.ts
index 853a8b1f..a4f88fc2 100644
--- a/portal-2/src/app/utils/showDataProviders.component.ts
+++ b/portal-2/src/app/utils/showDataProviders.component.ts
@@ -59,7 +59,6 @@ export class ShowDataProvidersComponent {
"organizations": {"name": string, "url": string}[]}[];
constructor () {
- console.info('showDataProviders constructor');
}
ngOnInit() {}
diff --git a/portal-2/src/server.routes.ts b/portal-2/src/server.routes.ts
index 8ca19d00..9b08ec01 100644
--- a/portal-2/src/server.routes.ts
+++ b/portal-2/src/server.routes.ts
@@ -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'
];