[Library | Trunk]: Remove dashboards-users component
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60248 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
1e62eb090c
commit
4fd68f81e6
|
@ -1,9 +0,0 @@
|
|||
<ng-template #tabs>
|
||||
<ul class="uk-tab customTabs admin uk-flex uk-flex-center uk-flex-left@m" uk-tab>
|
||||
<li [class.uk-active]="tab === 'manager'"><a (click)="changeTab('manager')"><span class="title">Managers</span></a></li>
|
||||
<li [class.uk-active]="tab === 'member'"><a (click)="changeTab('member')"><span class="title">Members</span></a></li>
|
||||
</ul>
|
||||
</ng-template>
|
||||
<role-users [id]="id" [type]="type" [name]="name" [link]="link" [isPortalAdmin]="isPortalAdmin" [role]="tab" [messages]="messages">
|
||||
<ng-container [ngTemplateOutlet]="tabs"></ng-container>
|
||||
</role-users>
|
|
@ -1,40 +0,0 @@
|
|||
import {Component, Input, OnInit} from "@angular/core";
|
||||
import {UserManagementService} from "../../services/user-management.service";
|
||||
import {Session, User} from "../../login/utils/helper.class";
|
||||
|
||||
@Component({
|
||||
selector: 'dashboard-users',
|
||||
templateUrl: 'dashboard-users.component.html'
|
||||
})
|
||||
export class DashboardUsersComponent implements OnInit{
|
||||
|
||||
@Input()
|
||||
public id: string;
|
||||
@Input()
|
||||
public type: string;
|
||||
@Input()
|
||||
public name: string;
|
||||
@Input()
|
||||
public link: string;
|
||||
@Input()
|
||||
public messages: Map<"member" | "manager", string> = null;
|
||||
public user: User;
|
||||
public tab: "manager" | "member" = 'manager';
|
||||
|
||||
constructor(private userManagementService: UserManagementService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.userManagementService.getUserInfo().subscribe(user => {
|
||||
this.user = user;
|
||||
});
|
||||
}
|
||||
|
||||
changeTab(tab: "manager" | "member") {
|
||||
this.tab = tab;
|
||||
}
|
||||
|
||||
public get isPortalAdmin() {
|
||||
return Session.isPortalAdministrator(this.user) || Session.isCurator(this.type, this.user);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
import {NgModule} from "@angular/core";
|
||||
import {DashboardUsersComponent} from "./dashboard-users.component";
|
||||
import {CommonModule} from "@angular/common";
|
||||
import {RoleUsersModule} from "./role-users/role-users.module";
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, RoleUsersModule],
|
||||
declarations: [DashboardUsersComponent],
|
||||
exports: [DashboardUsersComponent]
|
||||
})
|
||||
export class DashboardUsersModule {}
|
|
@ -5,7 +5,7 @@ import {AlertModal} from "../../../utils/modal/alert";
|
|||
import {UserRegistryService} from "../../../services/user-registry.service";
|
||||
import {EnvProperties} from "../../../utils/properties/env-properties";
|
||||
import {properties} from "../../../../../environments/environment";
|
||||
import {Session} from "../../../login/utils/helper.class";
|
||||
import {Session, User} from "../../../login/utils/helper.class";
|
||||
import {UserManagementService} from "../../../services/user-management.service";
|
||||
import {Router} from "@angular/router";
|
||||
import {LoginErrorCodes} from "../../../login/utils/guardHelper.class";
|
||||
|
@ -29,11 +29,10 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
|||
@Input()
|
||||
public link: string;
|
||||
@Input()
|
||||
public isPortalAdmin: boolean = false;
|
||||
@Input()
|
||||
public role: "member" | "manager" = "manager";
|
||||
@Input()
|
||||
public messages: Map<"member" | "manager", string> = null;
|
||||
public message: string = null;
|
||||
public user: User = null;
|
||||
public active: any[];
|
||||
public pending: any[];
|
||||
public showActive: boolean = true;
|
||||
|
@ -59,16 +58,7 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
|||
ngOnInit() {
|
||||
this.updateLists();
|
||||
this.userManagementService.getUserInfo().subscribe(user => {
|
||||
if(user) {
|
||||
if(!Session.isPortalAdministrator(user) && !Session.isCurator(this.type, user) && !Session.isManager(this.type, this.id, user)) {
|
||||
this.router.navigate(['/user-info'], {
|
||||
queryParams: {
|
||||
"errorCode": LoginErrorCodes.NOT_AUTHORIZED,
|
||||
"redirectUrl": this.router.url
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
this.user = user;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -232,4 +222,8 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
|||
this.loadPending = false;
|
||||
});
|
||||
}
|
||||
|
||||
public get isPortalAdmin() {
|
||||
return Session.isPortalAdministrator(this.user) || Session.isCurator(this.type, this.user);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue