[master | WIP]: Add users page in admin of dashboards. Add role verification in national monitor.
This commit is contained in:
parent
b84e25e8ff
commit
003a720502
|
@ -48,6 +48,9 @@ export class AdminComponent extends SidebarBaseComponent implements OnInit {
|
|||
this.layoutService.setRootClass(this.stakeholder.type);
|
||||
this.sideBarItems.push(new MenuItem("general", "General", "", "/admin/" + this.stakeholder.alias, false, [], [], {}, {name: 'badge'}));
|
||||
this.sideBarItems.push(new MenuItem("indicators", "Indicators", "", "/admin/" + this.stakeholder.alias + '/indicators', false, [], [], {}, {name: 'bar_chart'}, null, "uk-visible@m"));
|
||||
if (this.stakeholder.defaultId) {
|
||||
this.sideBarItems.push(new MenuItem("users", "Users", "", "/admin/" + this.stakeholder.alias + '/users', false, [], [], {}, {name: 'group'}, null, "uk-visible@m", "/admin/" + this.stakeholder.alias + "/users"));
|
||||
}
|
||||
this.backItem = new MenuItem("back", "Manage profiles", "", "/admin", false, [], null, {}, {name: 'west'});
|
||||
this.loading = false;
|
||||
}));
|
||||
|
|
|
@ -27,6 +27,16 @@ import {LogoUrlPipeModule} from "../openaireLibrary/utils/pipes/logoUrlPipe.modu
|
|||
data: {hasInternalSidebar: true, showLogo: true},
|
||||
pathMatch: 'full'
|
||||
},
|
||||
{
|
||||
path: 'users',
|
||||
redirectTo: 'users/manager',
|
||||
pathMatch: 'full'
|
||||
},
|
||||
{
|
||||
path: 'users/manager',
|
||||
loadChildren: () => import('./users/users.module').then(m => m.UsersModule),
|
||||
pathMatch: 'full'
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<div *ngIf="loading" page-content>
|
||||
<div inner>
|
||||
<loading></loading>
|
||||
</div>
|
||||
</div>
|
||||
<role-users *ngIf="!loading && stakeholder" [id]="stakeholder.alias" [type]="stakeholder.type" [name]="stakeholder.name" [link]="link" [role]="tab" [message]="messages.get(tab)"
|
||||
[emailComposer]="emailComposer">
|
||||
</role-users>
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
import {Component} from "@angular/core";
|
||||
import {StakeholderBaseComponent} from "../../openaireLibrary/monitor-admin/utils/stakeholder-base.component";
|
||||
import {Stakeholder} from "../../openaireLibrary/monitor/entities/stakeholder";
|
||||
import {User} from "../../openaireLibrary/login/utils/helper.class";
|
||||
import {Email} from "../../openaireLibrary/utils/email/email";
|
||||
import {Composer} from "../../openaireLibrary/utils/email/composer";
|
||||
import {StakeholderService} from "../../openaireLibrary/monitor/services/stakeholder.service";
|
||||
import {UserManagementService} from "../../openaireLibrary/services/user-management.service";
|
||||
import {ActivatedRoute} from "@angular/router";
|
||||
import {Title} from "@angular/platform-browser";
|
||||
import {StringUtils} from "../../openaireLibrary/utils/string-utils.class";
|
||||
|
||||
type Tab = 'member' | 'manager';
|
||||
|
||||
@Component({
|
||||
selector: 'users',
|
||||
templateUrl: 'users.component.html'
|
||||
})
|
||||
export class UsersComponent extends StakeholderBaseComponent {
|
||||
public stakeholder: Stakeholder;
|
||||
public link: string;
|
||||
public loading: boolean;
|
||||
public messages: Map<Tab, string> = new Map<Tab, string>();
|
||||
public tab: Tab = 'manager';
|
||||
public user: User;
|
||||
public emailComposer: Function = (name, recipient, role): Email => {
|
||||
return Composer.composeEmailForMonitorDashboard(name, recipient, role);
|
||||
}
|
||||
|
||||
constructor(private stakeholderService: StakeholderService,
|
||||
private userManagementService: UserManagementService,
|
||||
protected _route: ActivatedRoute,
|
||||
protected _title: Title) {
|
||||
super();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.loading = true;
|
||||
this.subscriptions.push(this._route.params.subscribe(params => {
|
||||
if (this.isTab(params['user_type'])) {
|
||||
this.tab = params['user_type'];
|
||||
} else {
|
||||
this.tab = 'manager';
|
||||
}
|
||||
if(this.stakeholder) {
|
||||
this.title = this.stakeholder.name + " | " + this.users;
|
||||
this.setMetadata();
|
||||
}
|
||||
}));
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||
if (stakeholder) {
|
||||
this.stakeholder = stakeholder;
|
||||
this.title = this.stakeholder.name + " | " + this.users;
|
||||
this.setMetadata();
|
||||
this.link = this.getURL(this.stakeholder.alias);
|
||||
this.messages.set("member", 'A member has the right to view the <b>restricted access</b> areas of this indicator\'s profile. ' +
|
||||
'A member has <b>no access</b> to the administration part of the profile.');
|
||||
this.messages.set("manager", 'A manager has the right to access the administration part of this indicator\'s profile, ' +
|
||||
'where he is able to invite other users as members and access the sandbox.');
|
||||
this.loading = false;
|
||||
}
|
||||
}));
|
||||
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
||||
this.user = user;
|
||||
}));
|
||||
}
|
||||
|
||||
get users(): string {
|
||||
return StringUtils.capitalize(this.tab) + 's';
|
||||
}
|
||||
|
||||
private isTab(tab: Tab): boolean {
|
||||
switch (tab) {
|
||||
case "manager":
|
||||
return true;
|
||||
case "member":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private getURL(id: string): string {
|
||||
let url = this.properties.domain + this.properties.baseLink;
|
||||
if(this.stakeholder.type === 'funder') {
|
||||
url = url + '/rfo/' + id;
|
||||
} else if(this.stakeholder.type === 'organization') {
|
||||
url = url + '/rpo/' + id;
|
||||
} else if(this.stakeholder.type === 'datasource') {
|
||||
url = url + '/repository/' + id;
|
||||
}
|
||||
return url + "?verify=";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
import {NgModule} from "@angular/core";
|
||||
import {UsersComponent} from "./users.component";
|
||||
import {CommonModule} from "@angular/common";
|
||||
import {RouterModule} from "@angular/router";
|
||||
import {PreviousRouteRecorder} from "../../openaireLibrary/utils/piwik/previousRouteRecorder.guard";
|
||||
import {LoadingModule} from "../../openaireLibrary/utils/loading/loading.module";
|
||||
import {PageContentModule} from "../../openaireLibrary/dashboard/sharedComponents/page-content/page-content.module";
|
||||
import {RoleUsersModule} from "../../openaireLibrary/dashboard/users/role-users/role-users.module";
|
||||
import {LogoUrlPipeModule} from "../../openaireLibrary/utils/pipes/logoUrlPipe.module";
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, LoadingModule, PageContentModule, RoleUsersModule, RouterModule, LogoUrlPipeModule, RouterModule.forChild([
|
||||
{
|
||||
path: '',
|
||||
component: UsersComponent,
|
||||
canDeactivate: [PreviousRouteRecorder]
|
||||
}
|
||||
])],
|
||||
declarations: [UsersComponent],
|
||||
exports: [UsersComponent]
|
||||
})
|
||||
export class UsersModule {
|
||||
}
|
|
@ -44,6 +44,7 @@ import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sideb
|
|||
No {{entities.country}} {{entities.stakeholder}} yet.
|
||||
</h3>
|
||||
</div>
|
||||
<role-verification *ngIf="stakeholder" [id]="stakeholder.alias" [name]="stakeholder.name" [type]="stakeholder.type"></role-verification>
|
||||
`
|
||||
})
|
||||
export class NationalComponent extends StakeholderBaseComponent implements OnInit {
|
||||
|
|
|
@ -3,6 +3,7 @@ import {CommonModule} from "@angular/common";
|
|||
import {Route, RouterModule} from "@angular/router";
|
||||
import {NationalComponent} from "./national.component";
|
||||
import {LoadingModule} from "../openaireLibrary/utils/loading/loading.module";
|
||||
import {RoleVerificationModule} from "../openaireLibrary/role-verification/role-verification.module";
|
||||
const routes: Route[] = [
|
||||
{
|
||||
path: '', component: NationalComponent, children: [
|
||||
|
@ -13,7 +14,7 @@ const routes: Route[] = [
|
|||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, RouterModule.forChild(routes), LoadingModule],
|
||||
imports: [CommonModule, RouterModule.forChild(routes), LoadingModule, RoleVerificationModule],
|
||||
declarations: [NationalComponent],
|
||||
exports: [NationalComponent],
|
||||
})
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit f853d96ed499e917e4e726bf5a82f26e29dbb326
|
||||
Subproject commit 65f8676a0800997f7e8a5c24f96a050bdb65504e
|
|
@ -1,6 +1,7 @@
|
|||
import {Portal} from "../openaireLibrary/utils/entities/adminTool/portal";
|
||||
import {StakeholderConfiguration} from "../openaireLibrary/monitor-admin/utils/indicator-utils";
|
||||
import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service";
|
||||
import {Role} from "../openaireLibrary/login/utils/helper.class";
|
||||
|
||||
export class Irish {
|
||||
public static METADATA_PREFIX = 'NOAMI | ';
|
||||
|
@ -37,6 +38,8 @@ export class Irish {
|
|||
StakeholderConfiguration.CACHE_INDICATORS = false;
|
||||
|
||||
LayoutService.HEADER_HEIGHT = '60px';
|
||||
|
||||
Role.GROUP = 'irish.';
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ let props: EnvProperties = {
|
|||
piwikBaseUrl: 'https://beta.analytics.openaire.eu/piwik.php?idsite=',
|
||||
adminToolsPortalType: 'irish',
|
||||
adminToolsCommunity: 'irish',
|
||||
baseLink: "/",
|
||||
domain: "https://beta.oamonitor.ireland.openaire.eu",
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import {EnvProperties} from "../app/openaireLibrary/utils/properties/env-properties";
|
||||
import {common, commonProd} from "../app/openaireLibrary/utils/properties/environments/environment";
|
||||
|
||||
let props: EnvProperties = {
|
||||
}
|
||||
let props: EnvProperties = {}
|
||||
|
||||
|
||||
export let properties: EnvProperties = {
|
||||
...common, ...commonProd, ...props
|
||||
}
|
||||
|
|
|
@ -17,8 +17,7 @@ let props: EnvProperties = {
|
|||
disableFrameLoad: true,
|
||||
adminToolsPortalType: 'irish',
|
||||
adminToolsCommunity: 'irish',
|
||||
baseLink: "/",
|
||||
domain: "http://mpagasas.di.uoa.gr:4600",
|
||||
domain: "http://mpagasas.di.uoa.gr:5500",
|
||||
}
|
||||
|
||||
export let properties: EnvProperties = {
|
||||
|
|
Loading…
Reference in New Issue