[Library | Trunk]: Merge members managers. Add create group for portal admins
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@59757 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
57e7c0fa85
commit
889bd1db17
|
@ -1,16 +1,9 @@
|
||||||
<ng-template #tabs>
|
<ng-template #tabs>
|
||||||
<ul class="uk-tab customTabs admin uk-flex uk-flex-center uk-flex-left@m" uk-tab>
|
<ul class="uk-tab customTabs admin uk-flex uk-flex-center uk-flex-left@m" uk-tab>
|
||||||
<li [class.uk-active]="tab === 'managers'"><a (click)="changeTab('managers')"><span class="title">Managers</span></a></li>
|
<li [class.uk-active]="tab === 'manager'"><a (click)="changeTab('manager')"><span class="title">Managers</span></a></li>
|
||||||
<li [class.uk-active]="tab === 'members'"><a (click)="changeTab('members')"><span class="title">Members</span></a></li>
|
<li [class.uk-active]="tab === 'member'"><a (click)="changeTab('member')"><span class="title">Members</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<div *ngIf="tab === 'managers'">
|
<role-users [id]="id" [type]="type" [name]="name" [link]="link" [isPortalAdmin]="isPortalAdmin" [role]="tab">
|
||||||
<managers [id]="id" [type]="type" [name]="name" [link]="link">
|
<ng-container [ngTemplateOutlet]="tabs"></ng-container>
|
||||||
<ng-container [ngTemplateOutlet]="tabs"></ng-container>
|
</role-users>
|
||||||
</managers>
|
|
||||||
</div>
|
|
||||||
<div *ngIf="tab === 'members'">
|
|
||||||
<members [id]="id" [type]="type" [name]="name" [link]="link">
|
|
||||||
<ng-container [ngTemplateOutlet]="tabs"></ng-container>
|
|
||||||
</members>
|
|
||||||
</div>
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import {Component, Input, OnInit} from "@angular/core";
|
import {Component, Input, OnInit} from "@angular/core";
|
||||||
|
import {UserManagementService} from "../../services/user-management.service";
|
||||||
|
import {Session, User} from "../../login/utils/helper.class";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'dashboard-users',
|
selector: 'dashboard-users',
|
||||||
|
@ -14,15 +16,23 @@ export class DashboardUsersComponent implements OnInit{
|
||||||
public name: string;
|
public name: string;
|
||||||
@Input()
|
@Input()
|
||||||
public link: string;
|
public link: string;
|
||||||
public tab: "managers" | "members" = 'managers';
|
public user: User;
|
||||||
|
public tab: "manager" | "member" = 'manager';
|
||||||
|
|
||||||
constructor() {
|
constructor(private userManagementService: UserManagementService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.userManagementService.getUserInfo().subscribe(user => {
|
||||||
|
this.user = user;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
changeTab(tab: "managers" | "members") {
|
changeTab(tab: "manager" | "member") {
|
||||||
this.tab = tab;
|
this.tab = tab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get isPortalAdmin() {
|
||||||
|
return Session.isPortalAdministrator(this.user);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
import {NgModule} from "@angular/core";
|
import {NgModule} from "@angular/core";
|
||||||
import {DashboardUsersComponent} from "./dashboard-users.component";
|
import {DashboardUsersComponent} from "./dashboard-users.component";
|
||||||
import {CommonModule} from "@angular/common";
|
import {CommonModule} from "@angular/common";
|
||||||
import {ManagersModule} from "./managers/managers.module";
|
import {RoleUsersModule} from "./role-users/role-users.module";
|
||||||
import {MembersModule} from "./members/members.module";
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [CommonModule, ManagersModule, MembersModule],
|
imports: [CommonModule, RoleUsersModule],
|
||||||
declarations: [DashboardUsersComponent],
|
declarations: [DashboardUsersComponent],
|
||||||
exports: [DashboardUsersComponent]
|
exports: [DashboardUsersComponent]
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,81 +0,0 @@
|
||||||
<div page-content>
|
|
||||||
<div header>
|
|
||||||
<div *ngIf="error" class="uk-alert uk-alert-danger uk-flex uk-flex-top">
|
|
||||||
<span class="uk-margin-small-right uk-icon" uk-icon="warning"></span>
|
|
||||||
<div>
|
|
||||||
{{error}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<ng-content></ng-content>
|
|
||||||
<div class="uk-grid uk-flex uk-flex-middle" uk-grid>
|
|
||||||
<div class="uk-width-expand uk-flex uk-flex-left@m uk-flex-center">
|
|
||||||
<ul class="uk-subnav uk-subnav-pill">
|
|
||||||
<li [class.uk-active]="showManagers" (click)="showManagers = true">
|
|
||||||
<a>Managers</a>
|
|
||||||
</li>
|
|
||||||
<li [class.uk-active]="!showManagers" (click)="showManagers = false">
|
|
||||||
<a>Pending Managers</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="uk-width-1-5@l uk-width-1-3@m uk-width-1-1 uk-flex uk-flex-right@m uk-flex-center">
|
|
||||||
<a class="uk-text-uppercase uk-flex uk-flex-middle" (click)="openInviteModal()">
|
|
||||||
<button class="uk-icon-button large uk-button-secondary">
|
|
||||||
<icon name="person_add"></icon>
|
|
||||||
</button>
|
|
||||||
<button class="uk-button uk-button-link uk-margin-small-left uk-text-secondary">Invite Manager</button>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div inner>
|
|
||||||
<div *ngIf="loadManagers || loadPending" class="uk-margin-large-top">
|
|
||||||
<loading></loading>
|
|
||||||
</div>
|
|
||||||
<div *ngIf="!loadManagers && !loadPending" class="uk-margin-medium-top">
|
|
||||||
<div *ngIf="(showManagers && managers.length == 0) || (!showManagers && pending.length == 0)"
|
|
||||||
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
|
|
||||||
<div *ngIf="showManagers">No managers for {{name}}</div>
|
|
||||||
<div *ngIf="!showManagers">No pending manager invitations for {{name}}</div>
|
|
||||||
</div>
|
|
||||||
<div *ngIf="(showManagers && managers.length > 0) || (!showManagers && pending.length > 0)"
|
|
||||||
class="uk-overflow-auto uk-height-max-large">
|
|
||||||
<div class="uk-card uk-card-default uk-card-body uk-text-small uk-margin-bottom"
|
|
||||||
*ngFor="let item of (showManagers)?managers:pending">
|
|
||||||
<div class="uk-grid uk-grid-divider uk-flex uk-flex-middle" uk-grid>
|
|
||||||
<div class="uk-width-3-4@l uk-width-1-2@m">
|
|
||||||
<div class="uk-padding-small uk-padding-remove-horizontal">
|
|
||||||
<span class="uk-text-muted">Email: </span>
|
|
||||||
<span class="uk-text-bold">{{(showManagers) ? item.email : item}}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div *ngIf="properties.environment === 'development'" class="uk-width-expand">
|
|
||||||
<div class="uk-padding-small uk-padding-remove-horizontal uk-flex uk-flex-center">
|
|
||||||
<a (click)="openDeleteModal(item)" class="uk-button action uk-flex uk-flex-middle">
|
|
||||||
<icon name="remove_circle_outline" ratio="0.7" [flex]="true"></icon>
|
|
||||||
<span class="uk-margin-small-left">{{showManagers ? 'Remove manager' : 'Cancel invitation'}}</span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<modal-alert #inviteManagerModal (alertOutput)="inviteManager()" [okDisabled]="invited && invited.invalid">
|
|
||||||
<div *ngIf="invited" class="uk-padding uk-padding-remove-horizontal uk-text-center">
|
|
||||||
<div dashboard-input [formInput]="invited"
|
|
||||||
placeholder="Write an email..."></div>
|
|
||||||
</div>
|
|
||||||
</modal-alert>
|
|
||||||
<modal-alert #deleteManagerModal (alertOutput)="deleteManager()">
|
|
||||||
<div *ngIf="selectedUser" class="uk-padding-small uk-padding-remove-horizontal">
|
|
||||||
Are you sure you want to remove <span class="uk-text-bold">{{selectedUser}}</span> from managers?
|
|
||||||
</div>
|
|
||||||
</modal-alert>
|
|
||||||
<modal-alert #deletePendingModal (alertOutput)="deletePendingManager()">
|
|
||||||
<div *ngIf="selectedUser" class="uk-padding-small uk-padding-remove-horizontal">
|
|
||||||
Are you sure you want to cancel manager invitation of <span class="uk-text-bold">{{selectedUser}}</span>?
|
|
||||||
</div>
|
|
||||||
</modal-alert>
|
|
|
@ -1,129 +0,0 @@
|
||||||
import {Component, Input, OnDestroy, OnInit, ViewChild} from '@angular/core';
|
|
||||||
import {Subscription} from 'rxjs/Rx';
|
|
||||||
import {FormBuilder, FormControl, Validators} from '@angular/forms';
|
|
||||||
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";
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'managers',
|
|
||||||
templateUrl: 'managers.component.html'
|
|
||||||
})
|
|
||||||
export class ManagersComponent implements OnInit, OnDestroy {
|
|
||||||
|
|
||||||
@Input()
|
|
||||||
public id: string;
|
|
||||||
@Input()
|
|
||||||
public type: string;
|
|
||||||
@Input()
|
|
||||||
public name: string;
|
|
||||||
@Input()
|
|
||||||
public link: string;
|
|
||||||
public managers: any[];
|
|
||||||
public pending: any[];
|
|
||||||
public showManagers: boolean = true;
|
|
||||||
public subs: any[] = [];
|
|
||||||
public loadManagers: boolean = true;
|
|
||||||
public loadPending: boolean = true;
|
|
||||||
public error: string;
|
|
||||||
public selectedUser: string = null;
|
|
||||||
public invited: FormControl;
|
|
||||||
public properties: EnvProperties = properties;
|
|
||||||
@ViewChild('inviteManagerModal') inviteManagerModal: AlertModal;
|
|
||||||
@ViewChild('deleteManagerModal') deleteManagerModal: AlertModal;
|
|
||||||
@ViewChild('deletePendingModal') deletePendingModal: AlertModal;
|
|
||||||
|
|
||||||
constructor(private userRegistryService: UserRegistryService,
|
|
||||||
private fb: FormBuilder) {
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
this.subs.push(this.userRegistryService.getManagersEmail(this.type, this.id).subscribe(managers => {
|
|
||||||
this.managers = managers;
|
|
||||||
this.loadManagers = false;
|
|
||||||
}, error => {
|
|
||||||
this.managers = [];
|
|
||||||
this.error = error.error.response;
|
|
||||||
this.loadManagers = false;
|
|
||||||
}));
|
|
||||||
this.subs.push(this.userRegistryService.getPendingManagers(this.type, this.id).subscribe(pending => {
|
|
||||||
this.pending = pending;
|
|
||||||
this.loadPending = false;
|
|
||||||
}, error => {
|
|
||||||
this.managers = [];
|
|
||||||
this.error = error.error.response;
|
|
||||||
this.loadManagers = false;
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.subs.forEach(sub => {
|
|
||||||
if (sub instanceof Subscription) {
|
|
||||||
sub.unsubscribe();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
openDeleteModal(item: any) {
|
|
||||||
if (this.showManagers) {
|
|
||||||
this.selectedUser = item.email;
|
|
||||||
this.deleteManagerModal.alertTitle = 'Delete manager';
|
|
||||||
this.deleteManagerModal.open();
|
|
||||||
} else {
|
|
||||||
this.selectedUser = item;
|
|
||||||
this.deletePendingModal.alertTitle = 'Cancel invitation';
|
|
||||||
this.deletePendingModal.open();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
openInviteModal() {
|
|
||||||
this.inviteManagerModal.alertTitle = 'Invite manager';
|
|
||||||
this.inviteManagerModal.okButtonLeft = false;
|
|
||||||
this.inviteManagerModal.okButtonText = 'Send';
|
|
||||||
this.invited = this.fb.control('', [Validators.required, Validators.email]);
|
|
||||||
this.inviteManagerModal.open();
|
|
||||||
}
|
|
||||||
|
|
||||||
deleteManager() {
|
|
||||||
this.loadManagers = true;
|
|
||||||
this.userRegistryService.removeManager(this.type, this.id, this.selectedUser).subscribe(() => {
|
|
||||||
this.managers = this.managers.filter(manager => manager.email != this.selectedUser);
|
|
||||||
this.loadManagers = false;
|
|
||||||
this.error = null;
|
|
||||||
}, error => {
|
|
||||||
this.error = error.error.response;
|
|
||||||
this.loadManagers = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
deletePendingManager() {
|
|
||||||
this.loadPending = true;
|
|
||||||
this.userRegistryService.cancelManagerInvitation(this.type, this.id, this.selectedUser).subscribe(() => {
|
|
||||||
this.pending = this.pending.filter(manager => manager != this.selectedUser);
|
|
||||||
this.error = null;
|
|
||||||
this.loadPending = false;
|
|
||||||
}, error => {
|
|
||||||
this.error = error.error.response;
|
|
||||||
this.loadPending = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
inviteManager() {
|
|
||||||
this.loadManagers = true;
|
|
||||||
let details = {
|
|
||||||
name: this.name,
|
|
||||||
link: this.link
|
|
||||||
}
|
|
||||||
this.userRegistryService.inviteManager(this.type, this.id, this.invited.value, details).subscribe(() => {
|
|
||||||
this.error = null;
|
|
||||||
if (!this.pending.includes(this.invited.value)) {
|
|
||||||
this.pending.push(this.invited.value);
|
|
||||||
}
|
|
||||||
this.loadManagers = false;
|
|
||||||
}, error => {
|
|
||||||
this.error = error.error.response;
|
|
||||||
this.loadManagers = false;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
import {NgModule} from '@angular/core';
|
|
||||||
import {CommonModule} from '@angular/common';
|
|
||||||
import {ManagersComponent} from './managers.component';
|
|
||||||
import {ReactiveFormsModule} from '@angular/forms';
|
|
||||||
import {EmailService} from "../../../utils/email/email.service";
|
|
||||||
import {AlertModalModule} from "../../../utils/modal/alertModal.module";
|
|
||||||
import {LoadingModule} from "../../../utils/loading/loading.module";
|
|
||||||
import {IconsService} from "../../../utils/icons/icons.service";
|
|
||||||
import {person_add, remove_circle_outline} from "../../../utils/icons/icons";
|
|
||||||
import {IconsModule} from "../../../utils/icons/icons.module";
|
|
||||||
import {InputModule} from "../../sharedComponents/input/input.module";
|
|
||||||
import {PageContentModule} from "../../sharedComponents/page-content/page-content.module";
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [CommonModule, AlertModalModule, ReactiveFormsModule, LoadingModule, IconsModule, InputModule, PageContentModule],
|
|
||||||
declarations: [ManagersComponent],
|
|
||||||
exports: [ManagersComponent],
|
|
||||||
providers: [EmailService]
|
|
||||||
})
|
|
||||||
export class ManagersModule {
|
|
||||||
constructor(private iconsService: IconsService) {
|
|
||||||
this.iconsService.registerIcons([remove_circle_outline, person_add]);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,81 +0,0 @@
|
||||||
<div page-content>
|
|
||||||
<div header>
|
|
||||||
<div *ngIf="error" class="uk-alert uk-alert-danger uk-flex uk-flex-top">
|
|
||||||
<span class="uk-margin-small-right uk-icon" uk-icon="warning"></span>
|
|
||||||
<div>
|
|
||||||
{{error}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<ng-content></ng-content>
|
|
||||||
<div class="uk-grid uk-flex uk-flex-middle" uk-grid>
|
|
||||||
<div class="uk-width-expand uk-flex uk-flex-left@m uk-flex-center">
|
|
||||||
<ul class="uk-subnav uk-subnav-pill">
|
|
||||||
<li [class.uk-active]="showMembers" (click)="showMembers = true">
|
|
||||||
<a>Members</a>
|
|
||||||
</li>
|
|
||||||
<li [class.uk-active]="!showMembers" (click)="showMembers = false">
|
|
||||||
<a>Pending Members</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="uk-width-1-5@l uk-width-1-3@m uk-flex uk-flex-right@m uk-flex-center">
|
|
||||||
<a class="uk-text-uppercase uk-flex uk-flex-middle" (click)="openInviteModal()">
|
|
||||||
<button class="uk-icon-button large uk-button-secondary">
|
|
||||||
<icon name="person_add"></icon>
|
|
||||||
</button>
|
|
||||||
<button class="uk-button uk-button-link uk-margin-small-left uk-text-secondary">Invite Member</button>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div inner>
|
|
||||||
<div *ngIf="loadMembers || loadPending" class="uk-margin-large-top">
|
|
||||||
<loading></loading>
|
|
||||||
</div>
|
|
||||||
<div *ngIf="!loadMembers && !loadPending" class="uk-margin-medium-top">
|
|
||||||
<div *ngIf="(showMembers && members.length == 0) || (!showMembers && pending.length == 0)"
|
|
||||||
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
|
|
||||||
<div *ngIf="showMembers">No members for {{name}}</div>
|
|
||||||
<div *ngIf="!showMembers">No pending member invitations for {{name}}</div>
|
|
||||||
</div>
|
|
||||||
<div *ngIf="(showMembers && members.length > 0) || (!showMembers && pending.length > 0)"
|
|
||||||
class="uk-overflow-auto uk-height-max-large uk-padding-small">
|
|
||||||
<div class="uk-card uk-card-default uk-card-body uk-text-small uk-margin-bottom"
|
|
||||||
*ngFor="let item of (showMembers)?members:pending">
|
|
||||||
<div class="uk-grid uk-grid-divider uk-flex uk-flex-middle" uk-grid>
|
|
||||||
<div class="uk-width-3-4@l uk-width-1-2@m">
|
|
||||||
<div class="uk-padding-small uk-padding-remove-horizontal">
|
|
||||||
<span class="uk-text-muted">Email: </span>
|
|
||||||
<span class="uk-text-bold">{{(showMembers) ? item.email : item}}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div *ngIf="properties.environment === 'development'" class="uk-width-expand">
|
|
||||||
<div class="uk-padding-small uk-padding-remove-horizontal uk-flex uk-flex-center">
|
|
||||||
<a (click)="openDeleteModal(item)" class="uk-button action uk-flex uk-flex-middle">
|
|
||||||
<icon name="remove_circle_outline" ratio="0.7" [flex]="true"></icon>
|
|
||||||
<span class="uk-margin-small-left">{{showMembers ? 'Remove member' : 'Cancel invitation'}}</span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<modal-alert #inviteMemberModal (alertOutput)="inviteMember()" [okDisabled]="invited && invited.invalid">
|
|
||||||
<div *ngIf="invited" class="uk-padding-small uk-padding-remove-horizontal uk-text-center">
|
|
||||||
<div dashboard-input [formInput]="invited"
|
|
||||||
placeholder="Write an email..."></div>
|
|
||||||
</div>
|
|
||||||
</modal-alert>
|
|
||||||
<modal-alert #deleteMemberModal (alertOutput)="deleteMember()">
|
|
||||||
<div *ngIf="selectedUser" class="uk-padding-small uk-padding-remove-horizontal">
|
|
||||||
Are you sure you want to remove <span class="uk-text-bold">{{selectedUser}}</span> from members?
|
|
||||||
</div>
|
|
||||||
</modal-alert>
|
|
||||||
<modal-alert #deletePendingModal (alertOutput)="deletePendingMember()">
|
|
||||||
<div *ngIf="selectedUser" class="uk-padding-small uk-padding-remove-horizontal">
|
|
||||||
Are you sure you want to cancel member invitation of <span class="uk-text-bold">{{selectedUser}}</span>?
|
|
||||||
</div>
|
|
||||||
</modal-alert>
|
|
|
@ -1,129 +0,0 @@
|
||||||
import {Component, Input, OnDestroy, OnInit, ViewChild} from '@angular/core';
|
|
||||||
import {Subscription} from 'rxjs/Rx';
|
|
||||||
import {UserRegistryService} from "../../../services/user-registry.service";
|
|
||||||
import {EnvProperties} from "../../../utils/properties/env-properties";
|
|
||||||
import {properties} from "../../../../../environments/environment";
|
|
||||||
import {FormBuilder, FormControl, Validators} from "@angular/forms";
|
|
||||||
import {AlertModal} from "../../../utils/modal/alert";
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'members',
|
|
||||||
templateUrl: 'members.component.html'
|
|
||||||
})
|
|
||||||
export class MembersComponent implements OnInit, OnDestroy {
|
|
||||||
|
|
||||||
@Input()
|
|
||||||
public id: string;
|
|
||||||
@Input()
|
|
||||||
public type: string;
|
|
||||||
@Input()
|
|
||||||
public name: string;
|
|
||||||
@Input()
|
|
||||||
public link: string;
|
|
||||||
public members: any[];
|
|
||||||
public pending: any[];
|
|
||||||
public showMembers: boolean = true;
|
|
||||||
public subs: any[] = [];
|
|
||||||
public loadMembers: boolean = true;
|
|
||||||
public loadPending: boolean = true;
|
|
||||||
public error: string;
|
|
||||||
public selectedUser: string = null;
|
|
||||||
public invited: FormControl;
|
|
||||||
public properties: EnvProperties = properties;
|
|
||||||
@ViewChild('inviteMemberModal') inviteMemberModal: AlertModal;
|
|
||||||
@ViewChild('deleteMemberModal') deleteMemberModal: AlertModal;
|
|
||||||
@ViewChild('deletePendingModal') deletePendingModal: AlertModal;
|
|
||||||
|
|
||||||
constructor(private userRegistryService: UserRegistryService,
|
|
||||||
private fb: FormBuilder) {
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
this.subs.push(this.userRegistryService.getMembersEmail(this.type, this.id).subscribe(members => {
|
|
||||||
this.members = members;
|
|
||||||
this.loadMembers = false;
|
|
||||||
}, error => {
|
|
||||||
this.members = [];
|
|
||||||
this.error = error.error.response;
|
|
||||||
this.loadMembers = false;
|
|
||||||
}));
|
|
||||||
this.subs.push(this.userRegistryService.getPendingMembers(this.type, this.id).subscribe(pending => {
|
|
||||||
this.pending = pending;
|
|
||||||
this.loadPending = false;
|
|
||||||
}, error => {
|
|
||||||
this.members = [];
|
|
||||||
this.error = error.error.response;
|
|
||||||
this.loadMembers = false;
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnDestroy() {
|
|
||||||
this.subs.forEach(sub => {
|
|
||||||
if (sub instanceof Subscription) {
|
|
||||||
sub.unsubscribe();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
openDeleteModal(item: any) {
|
|
||||||
if (this.showMembers) {
|
|
||||||
this.selectedUser = item.email;
|
|
||||||
this.deleteMemberModal.alertTitle = 'Delete member';
|
|
||||||
this.deleteMemberModal.open();
|
|
||||||
} else {
|
|
||||||
this.selectedUser = item;
|
|
||||||
this.deletePendingModal.alertTitle = 'Cancel invitation';
|
|
||||||
this.deletePendingModal.open();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
openInviteModal() {
|
|
||||||
this.inviteMemberModal.alertTitle = 'Invite member';
|
|
||||||
this.inviteMemberModal.okButtonText = 'Send';
|
|
||||||
this.inviteMemberModal.okButtonLeft = false;
|
|
||||||
this.invited = this.fb.control('', [Validators.required, Validators.email]);
|
|
||||||
this.inviteMemberModal.open();
|
|
||||||
}
|
|
||||||
|
|
||||||
deleteMember() {
|
|
||||||
this.loadMembers = true;
|
|
||||||
this.userRegistryService.removeMember(this.type, this.id, this.selectedUser).subscribe(() => {
|
|
||||||
this.members = this.members.filter(manager => manager.email != this.selectedUser);
|
|
||||||
this.loadMembers = false;
|
|
||||||
this.error = null;
|
|
||||||
}, error => {
|
|
||||||
this.error = error.error.response;
|
|
||||||
this.loadMembers = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
deletePendingMember() {
|
|
||||||
this.loadPending = true;
|
|
||||||
this.userRegistryService.cancelMemberInvitation(this.type, this.id, this.selectedUser).subscribe(() => {
|
|
||||||
this.pending = this.pending.filter(manager => manager != this.selectedUser);
|
|
||||||
this.error = null;
|
|
||||||
this.loadPending = false;
|
|
||||||
}, error => {
|
|
||||||
this.error = error.error.response;
|
|
||||||
this.loadPending = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
inviteMember() {
|
|
||||||
this.loadMembers = true;
|
|
||||||
let details = {
|
|
||||||
name: this.name,
|
|
||||||
link: this.link
|
|
||||||
}
|
|
||||||
this.userRegistryService.inviteMember(this.type, this.id, this.invited.value, details).subscribe(() => {
|
|
||||||
this.error = null;
|
|
||||||
if (!this.pending.includes(this.invited.value)) {
|
|
||||||
this.pending.push(this.invited.value);
|
|
||||||
}
|
|
||||||
this.loadMembers = false;
|
|
||||||
}, error => {
|
|
||||||
this.error = error.error.response;
|
|
||||||
this.loadMembers = false;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,100 @@
|
||||||
|
<div page-content>
|
||||||
|
<div header>
|
||||||
|
<div *ngIf="error" class="uk-alert uk-alert-danger uk-flex uk-flex-top">
|
||||||
|
<span class="uk-margin-small-right uk-icon" uk-icon="warning"></span>
|
||||||
|
<div>
|
||||||
|
{{error}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<ng-content></ng-content>
|
||||||
|
<div class="uk-grid uk-flex uk-flex-middle" uk-grid>
|
||||||
|
<div class="uk-width-expand uk-flex uk-flex-left@m uk-flex-center">
|
||||||
|
<ul class="uk-subnav uk-subnav-pill">
|
||||||
|
<li [class.uk-active]="showActive" (click)="showActive = true">
|
||||||
|
<a>{{role}}s</a>
|
||||||
|
</li>
|
||||||
|
<li [class.uk-active]="!showActive" (click)="showActive = false">
|
||||||
|
<a>Pending {{role}}s</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div [class.uk-invisible]="loadActive || loadPending" class="uk-width-1-5@l uk-width-1-3@m uk-width-1-1 uk-flex uk-flex-right@m uk-flex-center">
|
||||||
|
<a *ngIf="exists" class="uk-text-uppercase uk-flex uk-flex-middle" (click)="openInviteModal()">
|
||||||
|
<button class="uk-icon-button large uk-button-secondary">
|
||||||
|
<icon name="person_add"></icon>
|
||||||
|
</button>
|
||||||
|
<button class="uk-button uk-button-link uk-margin-small-left uk-text-secondary">Invite {{role}}</button>
|
||||||
|
</a>
|
||||||
|
<a *ngIf="!exists && isPortalAdmin" class="uk-text-uppercase uk-flex uk-flex-middle" (click)="openCreateRoleModal()">
|
||||||
|
<button class="uk-icon-button large uk-button-secondary">
|
||||||
|
<icon name="person_add"></icon>
|
||||||
|
</button>
|
||||||
|
<button class="uk-button uk-button-link uk-margin-small-left uk-text-secondary">Create Group</button>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div inner>
|
||||||
|
<div *ngIf="loadActive || loadPending" class="uk-margin-large-top">
|
||||||
|
<loading></loading>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="!loadActive && !loadPending" class="uk-margin-medium-top">
|
||||||
|
<div *ngIf="(showActive && active.length == 0) || (!showActive && pending.length == 0)"
|
||||||
|
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
|
||||||
|
<div *ngIf="showActive">No {{role}}s for {{name}}</div>
|
||||||
|
<div *ngIf="!showActive">No pending {{role}} invitations for {{name}}</div>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="(showActive && active.length > 0) || (!showActive && pending.length > 0)"
|
||||||
|
class="uk-overflow-auto uk-height-max-large">
|
||||||
|
<div class="uk-card uk-card-default uk-card-body uk-text-small uk-margin-bottom"
|
||||||
|
*ngFor="let item of (showActive)?active:pending">
|
||||||
|
<div class="uk-grid uk-grid-divider uk-flex uk-flex-middle" uk-grid>
|
||||||
|
<div class="uk-width-3-4@l uk-width-1-2@m">
|
||||||
|
<div class="uk-padding-small uk-padding-remove-horizontal">
|
||||||
|
<span class="uk-text-muted">Email: </span>
|
||||||
|
<span class="uk-text-bold">{{(showActive) ? item.email : item}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="properties.environment === 'development'" class="uk-width-expand">
|
||||||
|
<div class="uk-padding-small uk-padding-remove-horizontal uk-flex uk-flex-center">
|
||||||
|
<a (click)="openDeleteModal(item)" class="uk-button action uk-flex uk-flex-middle">
|
||||||
|
<icon name="remove_circle_outline" ratio="0.7" [flex]="true"></icon>
|
||||||
|
<span class="uk-margin-small-left">{{showActive ? ('Remove ' + role) : 'Cancel invitation'}}</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<modal-alert #inviteModal (alertOutput)="invite()" [okDisabled]="invited && invited.invalid">
|
||||||
|
<div *ngIf="invited" class="uk-padding uk-padding-remove-horizontal uk-text-center">
|
||||||
|
<div dashboard-input [formInput]="invited"
|
||||||
|
placeholder="Write an email..."></div>
|
||||||
|
</div>
|
||||||
|
</modal-alert>
|
||||||
|
<modal-alert #deleteModal (alertOutput)="deleteActive()">
|
||||||
|
<div *ngIf="selectedUser" class="uk-padding-small uk-padding-remove-horizontal">
|
||||||
|
Are you sure you want to remove <span class="uk-text-bold">{{selectedUser}}</span> from {{role}}s?
|
||||||
|
</div>
|
||||||
|
</modal-alert>
|
||||||
|
<modal-alert #deletePendingModal (alertOutput)="deletePending()">
|
||||||
|
<div *ngIf="selectedUser" class="uk-padding-small uk-padding-remove-horizontal">
|
||||||
|
Are you sure you want to cancel {{role}} invitation of <span class="uk-text-bold">{{selectedUser}}</span>?
|
||||||
|
</div>
|
||||||
|
</modal-alert>
|
||||||
|
<modal-alert #createRoleModal (alertOutput)="createGroup()" [okDisabled]="roleFb && roleFb.invalid">
|
||||||
|
<div *ngIf="roleFb" class="uk-padding uk-padding-remove-horizontal">
|
||||||
|
<div class="uk-grid" uk-grid [formGroup]="roleFb">
|
||||||
|
<div dashboard-input [formInput]="roleFb.get('name')"
|
||||||
|
label="Name"
|
||||||
|
placeholder="Write a name..." class="uk-width-1-1"></div>
|
||||||
|
<div dashboard-input [formInput]="roleFb.get('description')"
|
||||||
|
label="Description"
|
||||||
|
type="textarea"
|
||||||
|
placeholder="Write a description..." class="uk-width-1-1"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</modal-alert>
|
|
@ -0,0 +1,191 @@
|
||||||
|
import {Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges, ViewChild} from '@angular/core';
|
||||||
|
import {Subscription} from 'rxjs/Rx';
|
||||||
|
import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';
|
||||||
|
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";
|
||||||
|
|
||||||
|
declare var UIkit;
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'role-users',
|
||||||
|
templateUrl: 'role-users.component.html'
|
||||||
|
})
|
||||||
|
export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
public id: string;
|
||||||
|
@Input()
|
||||||
|
public type: string;
|
||||||
|
@Input()
|
||||||
|
public name: string;
|
||||||
|
@Input()
|
||||||
|
public link: string;
|
||||||
|
@Input()
|
||||||
|
public isPortalAdmin: boolean = false;
|
||||||
|
@Input() role: "member" | "manager" = "manager";
|
||||||
|
public active: any[];
|
||||||
|
public pending: any[];
|
||||||
|
public showActive: boolean = true;
|
||||||
|
public subs: any[] = [];
|
||||||
|
public loadActive: boolean = true;
|
||||||
|
public loadPending: boolean = true;
|
||||||
|
public error: string;
|
||||||
|
public selectedUser: string = null;
|
||||||
|
public invited: FormControl;
|
||||||
|
public properties: EnvProperties = properties;
|
||||||
|
public exists: boolean = true;
|
||||||
|
public roleFb: FormGroup;
|
||||||
|
@ViewChild('inviteModal') inviteModal: AlertModal;
|
||||||
|
@ViewChild('deleteModal') deleteModal: AlertModal;
|
||||||
|
@ViewChild('deletePendingModal') deletePendingModal: AlertModal;
|
||||||
|
@ViewChild('createRoleModal') createRoleModal: AlertModal;
|
||||||
|
|
||||||
|
constructor(private userRegistryService: UserRegistryService,
|
||||||
|
private fb: FormBuilder) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.updateLists();
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
|
if(changes.role) {
|
||||||
|
this.updateLists();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
this.subs.forEach(sub => {
|
||||||
|
if (sub instanceof Subscription) {
|
||||||
|
sub.unsubscribe();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
updateLists() {
|
||||||
|
this.loadActive = true;
|
||||||
|
this.loadPending = true;
|
||||||
|
this.subs.push(this.userRegistryService.getActiveEmail(this.type, this.id, this.role).subscribe(users => {
|
||||||
|
this.active = users;
|
||||||
|
this.loadActive = false;
|
||||||
|
this.exists = true;
|
||||||
|
}, error => {
|
||||||
|
this.active = [];
|
||||||
|
if(error.status === 404) {
|
||||||
|
this.exists = false;
|
||||||
|
} else {
|
||||||
|
this.error = error.error.response;
|
||||||
|
}
|
||||||
|
this.loadActive = false;
|
||||||
|
}));
|
||||||
|
this.subs.push(this.userRegistryService.getPending(this.type, this.id, this.role).subscribe(users => {
|
||||||
|
this.pending = users;
|
||||||
|
this.loadPending = false;
|
||||||
|
}, error => {
|
||||||
|
this.active = [];
|
||||||
|
this.error = error.error.response;
|
||||||
|
this.loadActive = false;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
openDeleteModal(item: any) {
|
||||||
|
if (this.showActive) {
|
||||||
|
this.selectedUser = item.email;
|
||||||
|
this.deleteModal.alertTitle = 'Delete ' + this.role;
|
||||||
|
this.deleteModal.open();
|
||||||
|
} else {
|
||||||
|
this.selectedUser = item;
|
||||||
|
this.deletePendingModal.alertTitle = 'Cancel invitation';
|
||||||
|
this.deletePendingModal.open();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
openInviteModal() {
|
||||||
|
this.inviteModal.alertTitle = 'Invite ' + this.role;
|
||||||
|
this.inviteModal.okButtonLeft = false;
|
||||||
|
this.inviteModal.okButtonText = 'Send';
|
||||||
|
this.invited = this.fb.control('', [Validators.required, Validators.email]);
|
||||||
|
this.inviteModal.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
openCreateRoleModal() {
|
||||||
|
this.createRoleModal.alertTitle = 'Create group';
|
||||||
|
this.createRoleModal.okButtonLeft = false;
|
||||||
|
this.createRoleModal.okButtonText = 'create';
|
||||||
|
this.roleFb = this.fb.group({
|
||||||
|
name: this.fb.control(Session.mapType(this.type) + '.' + this.id, Validators.required),
|
||||||
|
description: this.fb.control('', Validators.required)
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
this.roleFb.get('name').disable();
|
||||||
|
}, 0);
|
||||||
|
this.createRoleModal.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteActive() {
|
||||||
|
this.loadActive = true;
|
||||||
|
this.userRegistryService.remove(this.type, this.id, this.selectedUser, this.role).subscribe(() => {
|
||||||
|
this.active = this.active.filter(user => user.email != this.selectedUser);
|
||||||
|
this.loadActive = false;
|
||||||
|
this.error = null;
|
||||||
|
}, error => {
|
||||||
|
this.error = error.error.response;
|
||||||
|
this.loadActive = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
deletePending() {
|
||||||
|
this.loadPending = true;
|
||||||
|
this.userRegistryService.cancelInvitation(this.type, this.id, this.selectedUser, this.role).subscribe(() => {
|
||||||
|
this.pending = this.pending.filter(user => user != this.selectedUser);
|
||||||
|
this.error = null;
|
||||||
|
this.loadPending = false;
|
||||||
|
}, error => {
|
||||||
|
this.error = error.error.response;
|
||||||
|
this.loadPending = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
invite() {
|
||||||
|
this.loadActive = true;
|
||||||
|
let details = {
|
||||||
|
name: this.name,
|
||||||
|
link: this.link
|
||||||
|
}
|
||||||
|
this.userRegistryService.invite(this.type, this.id, this.invited.value, details, this.role).subscribe(() => {
|
||||||
|
this.error = null;
|
||||||
|
if (!this.pending.includes(this.invited.value)) {
|
||||||
|
this.pending.push(this.invited.value);
|
||||||
|
}
|
||||||
|
this.loadActive = false;
|
||||||
|
}, error => {
|
||||||
|
this.error = error.error.response;
|
||||||
|
this.loadActive = false;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
createGroup() {
|
||||||
|
this.loadActive = true;
|
||||||
|
this.loadPending = true;
|
||||||
|
this.roleFb.get('name').enable();
|
||||||
|
this.userRegistryService.createRole(this.type, this.id, this.roleFb.value).subscribe(() => {
|
||||||
|
UIkit.notification('Group has been created', {
|
||||||
|
status: 'success',
|
||||||
|
timeout: 3000,
|
||||||
|
pos: 'top-left'
|
||||||
|
});
|
||||||
|
this.updateLists();
|
||||||
|
}, error => {
|
||||||
|
UIkit.notification('An error has occurred. Please try again later', {
|
||||||
|
status: 'danger',
|
||||||
|
timeout: 3000,
|
||||||
|
pos: 'top-left'
|
||||||
|
});
|
||||||
|
this.loadActive = false;
|
||||||
|
this.loadPending = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,23 +1,23 @@
|
||||||
import {NgModule} from '@angular/core';
|
import {NgModule} from '@angular/core';
|
||||||
import {CommonModule} from '@angular/common';
|
import {CommonModule} from '@angular/common';
|
||||||
import {MembersComponent} from './members.component';
|
import {RoleUsersComponent} from './role-users.component';
|
||||||
import {ReactiveFormsModule} from '@angular/forms';
|
import {ReactiveFormsModule} from '@angular/forms';
|
||||||
import {EmailService} from "../../../utils/email/email.service";
|
import {EmailService} from "../../../utils/email/email.service";
|
||||||
import {AlertModalModule} from "../../../utils/modal/alertModal.module";
|
import {AlertModalModule} from "../../../utils/modal/alertModal.module";
|
||||||
import {LoadingModule} from "../../../utils/loading/loading.module";
|
import {LoadingModule} from "../../../utils/loading/loading.module";
|
||||||
import {IconsModule} from "../../../utils/icons/icons.module";
|
|
||||||
import {IconsService} from "../../../utils/icons/icons.service";
|
import {IconsService} from "../../../utils/icons/icons.service";
|
||||||
import {person_add, remove_circle_outline} from "../../../utils/icons/icons";
|
import {person_add, remove_circle_outline} from "../../../utils/icons/icons";
|
||||||
|
import {IconsModule} from "../../../utils/icons/icons.module";
|
||||||
import {InputModule} from "../../sharedComponents/input/input.module";
|
import {InputModule} from "../../sharedComponents/input/input.module";
|
||||||
import {PageContentModule} from "../../sharedComponents/page-content/page-content.module";
|
import {PageContentModule} from "../../sharedComponents/page-content/page-content.module";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [CommonModule, AlertModalModule, ReactiveFormsModule, LoadingModule, IconsModule, InputModule, PageContentModule],
|
imports: [CommonModule, AlertModalModule, ReactiveFormsModule, LoadingModule, IconsModule, InputModule, PageContentModule],
|
||||||
declarations: [MembersComponent],
|
declarations: [RoleUsersComponent],
|
||||||
exports: [MembersComponent],
|
exports: [RoleUsersComponent],
|
||||||
providers: [EmailService]
|
providers: [EmailService]
|
||||||
})
|
})
|
||||||
export class MembersModule {
|
export class RoleUsersModule {
|
||||||
constructor(private iconsService: IconsService) {
|
constructor(private iconsService: IconsService) {
|
||||||
this.iconsService.registerIcons([remove_circle_outline, person_add]);
|
this.iconsService.registerIcons([remove_circle_outline, person_add]);
|
||||||
}
|
}
|
|
@ -1,18 +1,18 @@
|
||||||
import {StringUtils} from "../../utils/string-utils.class";
|
import {StringUtils} from "../../utils/string-utils.class";
|
||||||
|
|
||||||
export class User {
|
export class User {
|
||||||
email:string;
|
email: string;
|
||||||
firstname: string;
|
firstname: string;
|
||||||
lastname: string;
|
lastname: string;
|
||||||
id: string;
|
id: string;
|
||||||
fullname: string;
|
fullname: string;
|
||||||
expirationDate: number;
|
expirationDate: number;
|
||||||
role:string[];
|
role: string[];
|
||||||
jwt:string;
|
jwt: string;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Session{
|
export class Session {
|
||||||
public static removeUser() {
|
public static removeUser() {
|
||||||
COOKIE.deleteCookie(COOKIE.cookieName_id);
|
COOKIE.deleteCookie(COOKIE.cookieName_id);
|
||||||
//COOKIE.deleteCookie("openAIRESession");
|
//COOKIE.deleteCookie("openAIRESession");
|
||||||
|
@ -20,32 +20,34 @@ export class Session{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static isLoggedIn(): boolean {
|
public static isLoggedIn(): boolean {
|
||||||
var cookie= COOKIE.getCookie(COOKIE.cookieName_id);
|
var cookie = COOKIE.getCookie(COOKIE.cookieName_id);
|
||||||
return (cookie != null && cookie != "");
|
return (cookie != null && cookie != "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static setReloadUrl(host:string,path:string, params:string) {
|
public static setReloadUrl(host: string, path: string, params: string) {
|
||||||
var URL = {};
|
var URL = {};
|
||||||
URL["host"]=host;
|
URL["host"] = host;
|
||||||
URL["path"]=path;
|
URL["path"] = path;
|
||||||
URL["params"]=params;
|
URL["params"] = params;
|
||||||
COOKIE.setCookie("reloadURL", JSON.stringify(URL), -1);
|
COOKIE.setCookie("reloadURL", JSON.stringify(URL), -1);
|
||||||
}
|
}
|
||||||
public static getReloadUrl(plainText:boolean =false) {
|
|
||||||
|
public static getReloadUrl(plainText: boolean = false) {
|
||||||
var URL = COOKIE.getCookie("reloadURL");
|
var URL = COOKIE.getCookie("reloadURL");
|
||||||
URL = JSON.parse(URL);
|
URL = JSON.parse(URL);
|
||||||
return URL;
|
return URL;
|
||||||
|
|
||||||
}
|
}
|
||||||
public static getParamsObj(params:string) {
|
|
||||||
var object = null;
|
public static getParamsObj(params: string) {
|
||||||
if(params.split("&").length > 0){
|
var object = null;
|
||||||
object = {};
|
if (params.split("&").length > 0) {
|
||||||
}
|
object = {};
|
||||||
params =(params && params.split("?").length > 1 )?params.split("?")[1]:params;
|
}
|
||||||
for(var i=0; i<params.split("&").length; i++){
|
params = (params && params.split("?").length > 1) ? params.split("?")[1] : params;
|
||||||
object[(params.split("&")[i]).split("=")[0]] = (params.split("&")[i]).split("=")[1];
|
for (var i = 0; i < params.split("&").length; i++) {
|
||||||
}
|
object[(params.split("&")[i]).split("=")[0]] = (params.split("&")[i]).split("=")[1];
|
||||||
|
}
|
||||||
|
|
||||||
return object;
|
return object;
|
||||||
|
|
||||||
|
@ -55,36 +57,43 @@ export class Session{
|
||||||
public static isClaimsCurator(user: User): boolean {
|
public static isClaimsCurator(user: User): boolean {
|
||||||
return user &&
|
return user &&
|
||||||
(user.role.indexOf('urn:geant:openaire.eu:group:Curator+-+Claim#aai.openaire.eu') !== -1 ||
|
(user.role.indexOf('urn:geant:openaire.eu:group:Curator+-+Claim#aai.openaire.eu') !== -1 ||
|
||||||
user.role.indexOf('CURATOR_CLAIM') !== -1);
|
user.role.indexOf('CURATOR_CLAIM') !== -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static isMonitorCurator(user: User): boolean {
|
public static isMonitorCurator(user: User): boolean {
|
||||||
return this.isCommunityCurator(user) || this.isProjectCurator(user) ||this.isFunderCurator(user) || this.isOrganizationCurator(user);
|
return this.isCommunityCurator(user) || this.isProjectCurator(user) || this.isFunderCurator(user) || this.isOrganizationCurator(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static isCommunityCurator(user: User): boolean {
|
public static isCommunityCurator(user: User): boolean {
|
||||||
return this.isTypeCurator("Community", user);
|
return this.isTypeCurator("Community", user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static isFunderCurator(user: User): boolean {
|
public static isFunderCurator(user: User): boolean {
|
||||||
return this.isTypeCurator("Funder", user);
|
return this.isTypeCurator("Funder", user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static isProjectCurator(user: User): boolean {
|
public static isProjectCurator(user: User): boolean {
|
||||||
return this.isTypeCurator("Project", user);
|
return this.isTypeCurator("Project", user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static isOrganizationCurator(user: User): boolean {
|
public static isOrganizationCurator(user: User): boolean {
|
||||||
return this.isTypeCurator("Institution", user);
|
return this.isTypeCurator("Institution", user);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static isTypeCurator(type: string, user: User): boolean {
|
private static isTypeCurator(type: string, user: User): boolean {
|
||||||
return user &&
|
return user &&
|
||||||
( user.role.indexOf('CURATOR_'+type.toUpperCase()) !== -1 ||
|
(user.role.indexOf('CURATOR_' + type.toUpperCase()) !== -1 ||
|
||||||
user.role.indexOf('urn:geant:openaire.eu:group:Curator+-+' + type + '#aai.openaire.eu') !== -1);
|
user.role.indexOf('urn:geant:openaire.eu:group:Curator+-+' + type + '#aai.openaire.eu') !== -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static isCurator(type: string, user: User): boolean {
|
public static isCurator(type: string, user: User): boolean {
|
||||||
if(type == 'funder'){
|
if (type == 'funder') {
|
||||||
return user && this.isFunderCurator( user);
|
return user && this.isFunderCurator(user);
|
||||||
}else if(type == 'ri' || type == 'community'){
|
} else if (type == 'ri' || type == 'community') {
|
||||||
return user && this.isCommunityCurator(user);
|
return user && this.isCommunityCurator(user);
|
||||||
}else if(type == 'organization' || type == 'institution'){
|
} else if (type == 'organization' || type == 'institution') {
|
||||||
return user && this.isOrganizationCurator(user);
|
return user && this.isOrganizationCurator(user);
|
||||||
}else if(type == 'project'){
|
} else if (type == 'project') {
|
||||||
return user && this.isProjectCurator(user);
|
return user && this.isProjectCurator(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,83 +101,93 @@ export class Session{
|
||||||
public static isPortalAdministrator(user: User): boolean {
|
public static isPortalAdministrator(user: User): boolean {
|
||||||
return user &&
|
return user &&
|
||||||
(user.role.indexOf('urn:geant:openaire.eu:group:Portal+Administrator#aai.openaire.eu') !== -1 ||
|
(user.role.indexOf('urn:geant:openaire.eu:group:Portal+Administrator#aai.openaire.eu') !== -1 ||
|
||||||
user.role.indexOf('PORTAL_ADMINISTRATOR') !== -1);
|
user.role.indexOf('PORTAL_ADMINISTRATOR') !== -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static isUserManager(user: User): boolean {
|
public static isUserManager(user: User): boolean {
|
||||||
return user &&
|
return user &&
|
||||||
(user.role.indexOf('urn:geant:openaire.eu:group:User+Manager#aai.openaire.eu') !== -1 ||
|
(user.role.indexOf('urn:geant:openaire.eu:group:User+Manager#aai.openaire.eu') !== -1 ||
|
||||||
user.role.indexOf('USER_MANAGER') !== -1);
|
user.role.indexOf('USER_MANAGER') !== -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static isSubscribedTo(type: string, id: string, user: User): boolean {
|
public static isSubscribedTo(type: string, id: string, user: User): boolean {
|
||||||
return user && user.role.indexOf(type.toUpperCase() + '_' + id.toUpperCase()) !== -1;
|
return user && user.role.indexOf(this.mapType(type).toUpperCase() + '_' + id.toUpperCase()) !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static isMember(type: string, id: string, user: User): boolean {
|
||||||
|
return user && user.role.indexOf(this.mapType(type).toUpperCase() + '_' + id.toUpperCase()) !== -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static isManager(type: string, id: string, user: User): boolean {
|
public static isManager(type: string, id: string, user: User): boolean {
|
||||||
if(type == "ri"){
|
return user && user.role.indexOf(this.mapType(type).toUpperCase() + '_' + id.toUpperCase() + '_MANAGER') !== -1
|
||||||
type = "community";
|
|
||||||
}else if (type == "organization"){
|
|
||||||
type = "institution";
|
|
||||||
}
|
|
||||||
return user && user.role.indexOf(type.toUpperCase() + '_' + id.toUpperCase() + '_MANAGER') !== -1
|
|
||||||
}
|
}
|
||||||
public static isKindOfMonitorManager(user: User): boolean {
|
|
||||||
if(user){
|
public static isKindOfMonitorManager(user: User): boolean {
|
||||||
for(let role of user.role ){
|
if (user) {
|
||||||
if(role.indexOf('_MANAGER') !== -1){
|
for (let role of user.role) {
|
||||||
return true;
|
if (role.indexOf('_MANAGER') !== -1) {
|
||||||
}
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static isRegisteredUser(user: User): boolean {
|
public static isRegisteredUser(user: User): boolean {
|
||||||
return user &&
|
return user &&
|
||||||
(user.role.indexOf('urn:geant:openaire.eu:group:Registered+User#aai.openaire.eu') !== -1 ||
|
(user.role.indexOf('urn:geant:openaire.eu:group:Registered+User#aai.openaire.eu') !== -1 ||
|
||||||
user.role.indexOf('REGISTERED_USER') !== -1);
|
user.role.indexOf('REGISTERED_USER') !== -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static mapType(type: string): string {
|
||||||
|
if (type == "ri") {
|
||||||
|
type = "community";
|
||||||
|
} else if (type == "organization") {
|
||||||
|
type = "institution";
|
||||||
|
}
|
||||||
|
return type;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
export class COOKIE{
|
|
||||||
public static cookieName_id:string="AccessToken";
|
|
||||||
|
|
||||||
public static getCookie(name: string) : string {
|
export class COOKIE {
|
||||||
if(typeof document == 'undefined'){
|
public static cookieName_id: string = "AccessToken";
|
||||||
return null;
|
|
||||||
}
|
|
||||||
let ca: Array<string> = document.cookie.split(';');
|
|
||||||
let caLen: number = ca.length;
|
|
||||||
let cookieName = `${name}=`;
|
|
||||||
let c: string;
|
|
||||||
|
|
||||||
for (let i: number = 0; i < caLen; i += 1) {
|
public static getCookie(name: string): string {
|
||||||
c = ca[i].replace(/^\s+/g, '');
|
if (typeof document == 'undefined') {
|
||||||
if (c.indexOf(cookieName) == 0) {
|
|
||||||
return c.substring(cookieName.length, c.length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
let ca: Array<string> = document.cookie.split(';');
|
||||||
|
let caLen: number = ca.length;
|
||||||
|
let cookieName = `${name}=`;
|
||||||
|
let c: string;
|
||||||
|
|
||||||
|
for (let i: number = 0; i < caLen; i += 1) {
|
||||||
|
c = ca[i].replace(/^\s+/g, '');
|
||||||
|
if (c.indexOf(cookieName) == 0) {
|
||||||
|
return c.substring(cookieName.length, c.length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static deleteCookie(name) {
|
public static deleteCookie(name) {
|
||||||
this.setCookie(name, '', -1);
|
this.setCookie(name, '', -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static setCookie(name: string, value: string, expireDays: number, path: string = '/') {
|
public static setCookie(name: string, value: string, expireDays: number, path: string = '/') {
|
||||||
//TODO fix domain?
|
//TODO fix domain?
|
||||||
let d:Date = new Date();
|
let d: Date = new Date();
|
||||||
d.setTime(d.getTime() + expireDays * 24 * 60 * 60 * 1000);
|
d.setTime(d.getTime() + expireDays * 24 * 60 * 60 * 1000);
|
||||||
let expires:string = `expires=${d.toUTCString()}`;
|
let expires: string = `expires=${d.toUTCString()}`;
|
||||||
// let cpath:string = path ? `; path=${path}` : '';
|
// let cpath:string = path ? `; path=${path}` : '';
|
||||||
let domain = "";
|
let domain = "";
|
||||||
if(typeof document !== 'undefined'){
|
if (typeof document !== 'undefined') {
|
||||||
if(document.domain.indexOf(".di.uoa.gr")!= -1){ // for development
|
if (document.domain.indexOf(".di.uoa.gr") != -1) { // for development
|
||||||
domain = ".di.uoa.gr";
|
domain = ".di.uoa.gr";
|
||||||
}else if(document.domain.indexOf(".openaire.eu") != -1){
|
} else if (document.domain.indexOf(".openaire.eu") != -1) {
|
||||||
domain = ".openaire.eu";
|
domain = ".openaire.eu";
|
||||||
}
|
|
||||||
document.cookie = name+'='+value+'; path='+path+'; domain='+domain+';SameSite=Lax;';
|
|
||||||
}
|
}
|
||||||
|
document.cookie = name + '=' + value + '; path=' + path + '; domain=' + domain + ';SameSite=Lax;';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ export class StakeholderService {
|
||||||
getStakeholder(alias:string): Observable<Stakeholder> {
|
getStakeholder(alias:string): Observable<Stakeholder> {
|
||||||
if(!this.stakeholderSubject.value || this.stakeholderSubject.value.alias !== alias) {
|
if(!this.stakeholderSubject.value || this.stakeholderSubject.value.alias !== alias) {
|
||||||
this.promise = new Promise<any>((resolve, reject) => {
|
this.promise = new Promise<any>((resolve, reject) => {
|
||||||
this.http.get<Stakeholder>(properties.monitorServiceAPIURL + '/stakeholder/' + encodeURIComponent(alias)).pipe(map(stakeholder => {
|
this.http.get<Stakeholder>(properties.monitorServiceAPIURL + '/stakeholder/' + encodeURIComponent(alias), CustomOptions.registryOptions()).pipe(map(stakeholder => {
|
||||||
return this.formalize(stakeholder);
|
return this.formalize(stakeholder);
|
||||||
})).subscribe(stakeholder => {
|
})).subscribe(stakeholder => {
|
||||||
this.stakeholderSubject.next(stakeholder);
|
this.stakeholderSubject.next(stakeholder);
|
||||||
|
|
|
@ -172,7 +172,7 @@ export class RoleVerificationComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
public verifyManager() {
|
public verifyManager() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.userRegistryService.verifyManager(this.verification.id, this.code.value).subscribe(() => {
|
this.userRegistryService.verify(this.verification.id, this.code.value).subscribe(() => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.managerModal.cancel();
|
this.managerModal.cancel();
|
||||||
this.error = null;
|
this.error = null;
|
||||||
|
|
|
@ -13,6 +13,11 @@ export class UserRegistryService {
|
||||||
constructor(private http: HttpClient) {
|
constructor(private http: HttpClient) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public createRole(type: string, id: string, role): Observable<any[]> {
|
||||||
|
return this.http.post<any>(properties.registryUrl + 'createRole', role,
|
||||||
|
CustomOptions.registryOptions()).pipe(map((response: any) => response.response));
|
||||||
|
}
|
||||||
|
|
||||||
public getSubscribersCount(type: string, id: string): Observable<any> {
|
public getSubscribersCount(type: string, id: string): Observable<any> {
|
||||||
return this.http.get(properties.registryUrl + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/subscribers/count');
|
return this.http.get(properties.registryUrl + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/subscribers/count');
|
||||||
}
|
}
|
||||||
|
@ -27,62 +32,19 @@ export class UserRegistryService {
|
||||||
null, CustomOptions.registryOptions());
|
null, CustomOptions.registryOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
public removeManager(type: string, id: string, email: string): Observable<any> {
|
public remove(type: string, id: string, email: string, role: "member" | "manager" = "manager"): Observable<any> {
|
||||||
return this.http.delete<any>(properties.registryUrl +
|
return this.http.delete<any>(properties.registryUrl +
|
||||||
encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/manager/' + encodeURIComponent(email), CustomOptions.registryOptions());
|
encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + role + '/' + encodeURIComponent(email), CustomOptions.registryOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
public removeMember(type: string, id: string, email: string): Observable<any> {
|
public invite(type: string, id: string, email: string, details: any, role: "member" | "manager" = "manager"): Observable<any[]> {
|
||||||
return this.http.delete<any>(properties.registryUrl +
|
|
||||||
encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/member/' + encodeURIComponent(email), CustomOptions.registryOptions());
|
|
||||||
}
|
|
||||||
|
|
||||||
public inviteManager(type: string, id: string, email: string, details: any): Observable<any[]> {
|
|
||||||
return this.http.post<any>(properties.registryUrl + 'invite/' +
|
return this.http.post<any>(properties.registryUrl + 'invite/' +
|
||||||
encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/manager/' + encodeURIComponent(email), details,
|
encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + role + '/' + encodeURIComponent(email), details,
|
||||||
CustomOptions.registryOptions()).pipe(map((response: any) => response.response));
|
CustomOptions.registryOptions()).pipe(map((response: any) => response.response));
|
||||||
}
|
}
|
||||||
|
|
||||||
public inviteMember(type: string, id: string, email: string, details: any): Observable<any[]> {
|
public verify(id: string, code: string, role: "member" | "manager" = "manager"): Observable<any> {
|
||||||
return this.http.post<any>(properties.registryUrl + 'invite/' +
|
return this.http.post<any>(properties.registryUrl + 'verification/' + role + '/' + encodeURIComponent(id), code, CustomOptions.registryOptions());
|
||||||
encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/member/' + encodeURIComponent(email), details,
|
|
||||||
CustomOptions.registryOptions()).pipe(map((response: any) => response.response));
|
|
||||||
}
|
|
||||||
|
|
||||||
public cancelManagerInvitation(type: string, id: string, email: string): Observable<any> {
|
|
||||||
return this.http.delete<any>(properties.registryUrl + 'invite/' +
|
|
||||||
encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/manager/' + encodeURIComponent(email),
|
|
||||||
CustomOptions.registryOptions());
|
|
||||||
}
|
|
||||||
|
|
||||||
public cancelMemberInvitation(type: string, id: string, email: string): Observable<any> {
|
|
||||||
return this.http.delete<any>(properties.registryUrl + 'invite/' +
|
|
||||||
encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/member/' + encodeURIComponent(email),
|
|
||||||
CustomOptions.registryOptions());
|
|
||||||
}
|
|
||||||
|
|
||||||
public getPendingManagers(type: string, id: string): Observable<any[]> {
|
|
||||||
return this.http.get<any>(properties.registryUrl + 'invite/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/managers/',
|
|
||||||
CustomOptions.registryOptions()).pipe(map((response: any) => response.response));
|
|
||||||
}
|
|
||||||
|
|
||||||
public getPendingMembers(type: string, id: string): Observable<any[]> {
|
|
||||||
return this.http.get<any>(properties.registryUrl + 'invite/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/members/',
|
|
||||||
CustomOptions.registryOptions()).pipe(map((response: any) => response.response));
|
|
||||||
}
|
|
||||||
|
|
||||||
public getMembers(type: string, id: string): Observable<any[]> {
|
|
||||||
return this.http.get<any>(properties.registryUrl + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/members/',
|
|
||||||
CustomOptions.registryOptions()).pipe(map((response:any) => response.response));
|
|
||||||
}
|
|
||||||
|
|
||||||
public getManagers(type: string, id: string): Observable<any[]> {
|
|
||||||
return this.http.get<any>(properties.registryUrl + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/managers/').pipe(map(response => response.response));
|
|
||||||
}
|
|
||||||
|
|
||||||
public getMembersEmail(type: string, id: string): Observable<any[]> {
|
|
||||||
return this.http.get<any>(properties.registryUrl + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/members/email',
|
|
||||||
CustomOptions.registryOptions()).pipe(map((response:any) => response.response));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public getInvitation(id: string): Observable<any> {
|
public getInvitation(id: string): Observable<any> {
|
||||||
|
@ -90,19 +52,28 @@ export class UserRegistryService {
|
||||||
.pipe(map((response: any) => response.response));
|
.pipe(map((response: any) => response.response));
|
||||||
}
|
}
|
||||||
|
|
||||||
public verifyManager(id: string, code: string): Observable<any> {
|
|
||||||
return this.http.post<any>(properties.registryUrl + 'verification/manager/' + encodeURIComponent(id), code, CustomOptions.registryOptions());
|
|
||||||
}
|
|
||||||
|
|
||||||
public verifyMember(id: string, code: string): Observable<any> {
|
|
||||||
return this.http.post<any>(properties.registryUrl + 'verification/member/' + encodeURIComponent(id), code, CustomOptions.registryOptions());
|
|
||||||
}
|
|
||||||
|
|
||||||
public deleteVerification(id: string): Observable<any> {
|
public deleteVerification(id: string): Observable<any> {
|
||||||
return this.http.delete<any>(properties.registryUrl + 'verification/' + encodeURIComponent(id), CustomOptions.registryOptions());
|
return this.http.delete<any>(properties.registryUrl + 'verification/' + encodeURIComponent(id), CustomOptions.registryOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
public getManagersEmail(type: string, id: string): Observable<any[]> {
|
public getActiveEmail(type: string, id: string, role: "member" | "manager" = "manager"): Observable<any[]> {
|
||||||
return this.http.get<any>(properties.registryUrl + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/managers/email').pipe(map(response => response.response));
|
return this.http.get<any>(properties.registryUrl + encodeURIComponent(type) + '/' + encodeURIComponent(id) + "/" + role + 's/email',
|
||||||
|
CustomOptions.registryOptions()).pipe(map((response:any) => response.response));
|
||||||
|
}
|
||||||
|
|
||||||
|
public getActiveNames(type: string, id: string, role: "member" | "manager" = "manager"): Observable<any[]> {
|
||||||
|
return this.http.get<any>(properties.registryUrl + encodeURIComponent(type) + '/' + encodeURIComponent(id) + "/" + role + 's/',
|
||||||
|
CustomOptions.registryOptions()).pipe(map((response:any) => response.response));
|
||||||
|
}
|
||||||
|
|
||||||
|
public getPending(type: string, id: string, role: "member" | "manager" = "manager"): Observable<any[]> {
|
||||||
|
return this.http.get<any>(properties.registryUrl + 'invite/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + "/" + role + 's/',
|
||||||
|
CustomOptions.registryOptions()).pipe(map((response: any) => response.response));
|
||||||
|
}
|
||||||
|
|
||||||
|
public cancelInvitation(type: string, id: string, email: string, role: "member" | "manager" = "manager"): Observable<any> {
|
||||||
|
return this.http.delete<any>(properties.registryUrl + 'invite/' +
|
||||||
|
encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + role + '/' + encodeURIComponent(email),
|
||||||
|
CustomOptions.registryOptions());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ export class VerificationComponent implements OnInit {
|
||||||
|
|
||||||
verify() {
|
verify() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.userRegistryService.verifyManager(this.invitation.id, this.code.value).subscribe(() => {
|
this.userRegistryService.verify(this.invitation.id, this.code.value).subscribe(() => {
|
||||||
this.state = 'verified';
|
this.state = 'verified';
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue