[Library | Trunk]: Delete some unusage files

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60692 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2021-03-22 17:00:49 +00:00
parent ed98b169f6
commit bdd90b9d6c
6 changed files with 6 additions and 146 deletions

View File

@ -1,19 +0,0 @@
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
import {CommunityErrorPageComponent} from './communityErrorPage.component';
@NgModule({
imports: [
CommonModule, FormsModule
],
providers: [],
declarations: [
CommunityErrorPageComponent
],
exports: [
CommunityErrorPageComponent
]
})
export class CommunityErrorModule { }

View File

@ -1,49 +0,0 @@
import {Component, OnInit} from '@angular/core';
import {Location} from '@angular/common';
import {ActivatedRoute} from '@angular/router';
import {Title, Meta} from '@angular/platform-browser';
@Component({
selector: 'community-error',
template: `
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
<div uk-grid uk-grid>
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
<div class="uk-container">
<h2>
There is no community selected or the requested page is not available at this type of community!
</h2>
<br>
<p>
If you are a community manager, click to manage from user menu.
</p>
</div>
</div>
</div>
</div>
`
})
export class CommunityErrorPageComponent implements OnInit {
public page: string;
constructor (private _location: Location, private _meta: Meta,
private _title: Title, private route: ActivatedRoute) {
const title = 'OpenAIRE | Error page';
this._meta.updateTag({content: title}, "property='og:title'");
this._title.setTitle(title);
this.page = _location.path(true);
}
ngOnInit() {
this.route.queryParams.subscribe(data => {
this.page = data['page'];
if (!this.page) {
this.page = this._location.path(true);
}
});
}
}

View File

@ -1,27 +1,22 @@
import {map, filter, mergeMap, take} from 'rxjs/operators';
import {filter, map, mergeMap, take} from 'rxjs/operators';
import {Injectable} from '@angular/core';
import {
Router,
CanActivate,
ActivatedRouteSnapshot,
CanActivate,
CanActivateChild,
Router,
RouterStateSnapshot,
CanLoad, Route, UrlSegment, CanActivateChild, UrlTree
UrlTree
} from '@angular/router';
import {Observable, of, Subscription} from 'rxjs';
import {Observable, of} from 'rxjs';
import {Session} from '../../login/utils/helper.class';
import {LoginErrorCodes} from '../../login/utils/guardHelper.class';
import {CommunityService} from '../community/community.service';
import {EnvironmentSpecificService} from '../../utils/properties/environment-specific.service';
import {ConnectHelper} from '../connectHelper';
import {StringUtils} from '../../utils/string-utils.class';
import {UserManagementService} from "../../services/user-management.service";
import {properties} from "../../../../environments/environment";
@Injectable()
export class ConnectAdminLoginGuard implements CanActivate, CanActivateChild {
constructor(private router: Router,
private propertiesService: EnvironmentSpecificService,
private userManagementService: UserManagementService) {
}

View File

@ -1,62 +0,0 @@
import {Injectable} from '@angular/core';
import {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot} from '@angular/router';
import {Observable} from 'rxjs';
import {filter, map, mergeMap, take} from "rxjs/operators";
import {UserManagementService} from "../../services/user-management.service";
import {EnvironmentSpecificService} from "../../utils/properties/environment-specific.service";
import {Session} from "../../login/utils/helper.class";
@Injectable()
export class IsCommunityOrAdmin implements CanActivate {
constructor(private router: Router,
private userManagementService: UserManagementService,
private propertiesService: EnvironmentSpecificService) {
}
/*
//TODO add login guard and simplify this method
check(community: string): Observable<boolean> | boolean {
return this.userManagementService.getUserInfo(false).pipe(take(1),map(user => {
if (community && community !== 'undefined' || Session.isPortalAdministrator(user)) {
return true;
} else {
this.router.navigate(['/errorCommunity']);
return false;
}
}));
}
*/
check(community: string): Observable<boolean> | boolean {
if (community && community !== 'undefined') {
return true;
} else {
const obs = this.propertiesService.subscribeEnvironment().pipe(mergeMap(properties => {
return this.userManagementService.getUserInfo(false).pipe(map(user => {
return Session.isPortalAdministrator(user);
}));
}));
obs.pipe(filter( isAdmin => !isAdmin)).subscribe( () => {
this.router.navigate(['/errorCommunity']);
});
return obs;
}
}
/*
check(community: string): Observable<boolean> | boolean {
if(Session.isLoggedIn() && Session.isPortalAdministrator()) {
return true;
}
else if (community && community !== 'undefined') {
return true;
} else {
this.router.navigate(['errorcommunity']);
return false;
}
}*/
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
return this.check(route.queryParams['communityId']);
}
}

View File

@ -1,8 +1,6 @@
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {CommonModule} from '@angular/common';
import {IsCommunity} from '../../connect/communityGuard/isCommunity.guard';
import {ConnectAdminLoginGuard} from '../../connect/communityGuard/connectAdminLoginGuard.guard';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {AlertModalModule} from '../../utils/modal/alertModal.module';
import {SafeHtmlPipeModule} from '../../utils/pipes/safeHTMLPipe.module';

View File

@ -1,8 +1,6 @@
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {CommonModule} from '@angular/common';
import {IsCommunity} from '../../connect/communityGuard/isCommunity.guard';
import {ConnectAdminLoginGuard} from '../../connect/communityGuard/connectAdminLoginGuard.guard';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {AlertModalModule} from '../../utils/modal/alertModal.module';
import {PageHelpContentsComponent} from './page-help-contents.component';
@ -28,7 +26,6 @@ import {HTMLToStringPipeModule} from '../../utils/pipes/HTMLToStringPipe.module'
declarations: [
PageHelpContentsComponent
],
providers: [IsCommunity, ConnectAdminLoginGuard],
exports: [PageHelpContentsComponent]
})
export class PageHelpContentsModule {