[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>
|
||||
<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 === 'members'"><a (click)="changeTab('members')"><span class="title">Members</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 === 'member'"><a (click)="changeTab('member')"><span class="title">Members</span></a></li>
|
||||
</ul>
|
||||
</ng-template>
|
||||
<div *ngIf="tab === 'managers'">
|
||||
<managers [id]="id" [type]="type" [name]="name" [link]="link">
|
||||
<role-users [id]="id" [type]="type" [name]="name" [link]="link" [isPortalAdmin]="isPortalAdmin" [role]="tab">
|
||||
<ng-container [ngTemplateOutlet]="tabs"></ng-container>
|
||||
</managers>
|
||||
</div>
|
||||
<div *ngIf="tab === 'members'">
|
||||
<members [id]="id" [type]="type" [name]="name" [link]="link">
|
||||
<ng-container [ngTemplateOutlet]="tabs"></ng-container>
|
||||
</members>
|
||||
</div>
|
||||
</role-users>
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
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',
|
||||
|
@ -14,15 +16,23 @@ export class DashboardUsersComponent implements OnInit{
|
|||
public name: string;
|
||||
@Input()
|
||||
public link: string;
|
||||
public tab: "managers" | "members" = 'managers';
|
||||
public user: User;
|
||||
public tab: "manager" | "member" = 'manager';
|
||||
|
||||
constructor() {
|
||||
constructor(private userManagementService: UserManagementService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.userManagementService.getUserInfo().subscribe(user => {
|
||||
this.user = user;
|
||||
});
|
||||
}
|
||||
|
||||
changeTab(tab: "managers" | "members") {
|
||||
changeTab(tab: "manager" | "member") {
|
||||
this.tab = tab;
|
||||
}
|
||||
|
||||
public get isPortalAdmin() {
|
||||
return Session.isPortalAdministrator(this.user);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import {NgModule} from "@angular/core";
|
||||
import {DashboardUsersComponent} from "./dashboard-users.component";
|
||||
import {CommonModule} from "@angular/common";
|
||||
import {ManagersModule} from "./managers/managers.module";
|
||||
import {MembersModule} from "./members/members.module";
|
||||
import {RoleUsersModule} from "./role-users/role-users.module";
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, ManagersModule, MembersModule],
|
||||
imports: [CommonModule, RoleUsersModule],
|
||||
declarations: [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 {CommonModule} from '@angular/common';
|
||||
import {MembersComponent} from './members.component';
|
||||
import {RoleUsersComponent} from './role-users.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 {IconsModule} from "../../../utils/icons/icons.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: [MembersComponent],
|
||||
exports: [MembersComponent],
|
||||
declarations: [RoleUsersComponent],
|
||||
exports: [RoleUsersComponent],
|
||||
providers: [EmailService]
|
||||
})
|
||||
export class MembersModule {
|
||||
export class RoleUsersModule {
|
||||
constructor(private iconsService: IconsService) {
|
||||
this.iconsService.registerIcons([remove_circle_outline, person_add]);
|
||||
}
|
|
@ -31,12 +31,14 @@ export class Session{
|
|||
URL["params"] = params;
|
||||
COOKIE.setCookie("reloadURL", JSON.stringify(URL), -1);
|
||||
}
|
||||
|
||||
public static getReloadUrl(plainText: boolean = false) {
|
||||
var URL = COOKIE.getCookie("reloadURL");
|
||||
URL = JSON.parse(URL);
|
||||
return URL;
|
||||
|
||||
}
|
||||
|
||||
public static getParamsObj(params: string) {
|
||||
var object = null;
|
||||
if (params.split("&").length > 0) {
|
||||
|
@ -57,26 +59,33 @@ export class Session{
|
|||
(user.role.indexOf('urn:geant:openaire.eu:group:Curator+-+Claim#aai.openaire.eu') !== -1 ||
|
||||
user.role.indexOf('CURATOR_CLAIM') !== -1);
|
||||
}
|
||||
|
||||
public static isMonitorCurator(user: User): boolean {
|
||||
return this.isCommunityCurator(user) || this.isProjectCurator(user) || this.isFunderCurator(user) || this.isOrganizationCurator(user);
|
||||
}
|
||||
|
||||
public static isCommunityCurator(user: User): boolean {
|
||||
return this.isTypeCurator("Community", user);
|
||||
}
|
||||
|
||||
public static isFunderCurator(user: User): boolean {
|
||||
return this.isTypeCurator("Funder", user);
|
||||
}
|
||||
|
||||
public static isProjectCurator(user: User): boolean {
|
||||
return this.isTypeCurator("Project", user);
|
||||
}
|
||||
|
||||
public static isOrganizationCurator(user: User): boolean {
|
||||
return this.isTypeCurator("Institution", user);
|
||||
}
|
||||
|
||||
private static isTypeCurator(type: string, user: User): boolean {
|
||||
return user &&
|
||||
(user.role.indexOf('CURATOR_' + type.toUpperCase()) !== -1 ||
|
||||
user.role.indexOf('urn:geant:openaire.eu:group:Curator+-+' + type + '#aai.openaire.eu') !== -1);
|
||||
}
|
||||
|
||||
public static isCurator(type: string, user: User): boolean {
|
||||
if (type == 'funder') {
|
||||
return user && this.isFunderCurator(user);
|
||||
|
@ -102,17 +111,17 @@ export class Session{
|
|||
}
|
||||
|
||||
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 {
|
||||
if(type == "ri"){
|
||||
type = "community";
|
||||
}else if (type == "organization"){
|
||||
type = "institution";
|
||||
}
|
||||
return user && user.role.indexOf(type.toUpperCase() + '_' + id.toUpperCase() + '_MANAGER') !== -1
|
||||
return user && user.role.indexOf(this.mapType(type).toUpperCase() + '_' + id.toUpperCase() + '_MANAGER') !== -1
|
||||
}
|
||||
|
||||
public static isKindOfMonitorManager(user: User): boolean {
|
||||
if (user) {
|
||||
for (let role of user.role) {
|
||||
|
@ -130,8 +139,16 @@ export class Session{
|
|||
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";
|
||||
|
||||
|
@ -152,9 +169,11 @@ export class COOKIE{
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static deleteCookie(name) {
|
||||
this.setCookie(name, '', -1);
|
||||
}
|
||||
|
||||
public static setCookie(name: string, value: string, expireDays: number, path: string = '/') {
|
||||
//TODO fix domain?
|
||||
let d: Date = new Date();
|
||||
|
|
|
@ -25,7 +25,7 @@ export class StakeholderService {
|
|||
getStakeholder(alias:string): Observable<Stakeholder> {
|
||||
if(!this.stakeholderSubject.value || this.stakeholderSubject.value.alias !== alias) {
|
||||
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);
|
||||
})).subscribe(stakeholder => {
|
||||
this.stakeholderSubject.next(stakeholder);
|
||||
|
|
|
@ -172,7 +172,7 @@ export class RoleVerificationComponent implements OnInit, OnDestroy {
|
|||
|
||||
public verifyManager() {
|
||||
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.managerModal.cancel();
|
||||
this.error = null;
|
||||
|
|
|
@ -13,6 +13,11 @@ export class UserRegistryService {
|
|||
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> {
|
||||
return this.http.get(properties.registryUrl + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/subscribers/count');
|
||||
}
|
||||
|
@ -27,62 +32,19 @@ export class UserRegistryService {
|
|||
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 +
|
||||
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> {
|
||||
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[]> {
|
||||
public invite(type: string, id: string, email: string, details: any, role: "member" | "manager" = "manager"): Observable<any[]> {
|
||||
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));
|
||||
}
|
||||
|
||||
public inviteMember(type: string, id: string, email: string, details: any): Observable<any[]> {
|
||||
return this.http.post<any>(properties.registryUrl + 'invite/' +
|
||||
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 verify(id: string, code: string, role: "member" | "manager" = "manager"): Observable<any> {
|
||||
return this.http.post<any>(properties.registryUrl + 'verification/' + role + '/' + encodeURIComponent(id), code, CustomOptions.registryOptions());
|
||||
}
|
||||
|
||||
public getInvitation(id: string): Observable<any> {
|
||||
|
@ -90,19 +52,28 @@ export class UserRegistryService {
|
|||
.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> {
|
||||
return this.http.delete<any>(properties.registryUrl + 'verification/' + encodeURIComponent(id), CustomOptions.registryOptions());
|
||||
}
|
||||
|
||||
public getManagersEmail(type: string, id: string): Observable<any[]> {
|
||||
return this.http.get<any>(properties.registryUrl + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/managers/email').pipe(map(response => response.response));
|
||||
public getActiveEmail(type: string, id: string, role: "member" | "manager" = "manager"): Observable<any[]> {
|
||||
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() {
|
||||
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.loading = false;
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue