[Library | Trunk]: 1. Role users disable remove button for members when a user is a manager. 2. Change email message for community managers invitation

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60545 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2021-03-02 10:08:19 +00:00
parent 03780a4112
commit 8acc64fc10
4 changed files with 28 additions and 15 deletions

View File

@ -53,10 +53,11 @@
<div *ngIf="isCurator || !showActive" class="uk-width-auto@m uk-width-1-1">
<div class="uk-width-1-1 uk-flex uk-flex-center">
<div class="uk-padding-small uk-padding-remove-horizontal">
<a (click)="openDeleteModal(item)" class="uk-button action uk-flex uk-flex-middle">
<button (click)="openDeleteModal(item)" class="uk-button action uk-flex uk-flex-middle" [disabled]="role === 'member' && item.isManager"
[attr.uk-tooltip]="(role === 'member' && item.isManager)?'This user is a manager and cannot be removed.':null">
<icon name="remove_circle_outline" ratio="0.7" [flex]="true"></icon>
<span class="uk-margin-small-left">{{showActive ? ('Remove ' + role) : 'Cancel invitation'}}</span>
</a>
</button>
</div>
</div>
</div>

View File

@ -36,6 +36,7 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
public notificationFn: Function;
public user: User = null;
public active: any[];
public managers: any[];
public pending: any[];
public showActive: boolean = true;
public subs: any[] = [];
@ -88,9 +89,21 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
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;
if(this.role === 'member') {
this.subs.push(this.userRegistryService.getActiveEmail(this.type, this.id, 'manager').subscribe(managers => {
this.managers = managers;
this.active = users;
this.active.forEach(user => {
user['isManager'] = this.managers.find(manager => manager.email === user.email);
});
this.loadActive = false;
this.exists = true;
}))
} else {
this.active = users;
this.loadActive = false;
this.exists = true;
}
}, error => {
this.active = [];
if(error.status === 404) {

View File

@ -51,10 +51,11 @@
<div class="uk-width-auto@m uk-width-1-1">
<div class="uk-width-1-1 uk-flex uk-flex-center">
<div class="uk-padding-small uk-padding-remove-horizontal">
<a (click)="openDeleteModal(item)" class="uk-button action uk-flex uk-flex-middle" [class.uk-disabled]="!!item.isManager">
<button (click)="openDeleteModal(item)" class="uk-button action uk-flex uk-flex-middle" [disabled]="item.isManager"
[attr.uk-tooltip]="item.isManager?'This user is a manager and cannot be removed.':null">
<icon name="remove_circle_outline" ratio="0.7" [flex]="true"></icon>
<span class="uk-margin-small-left">Remove subscriber</span>
</a>
</button>
</div>
</div>
</div>

View File

@ -248,23 +248,21 @@ export class Composer {
return message;
}
public static composeEmailForCommunityDashboard(name: string, recipient: string, role: "manager" | "member") {
public static composeEmailForCommunityDashboard(name: string, recipient: string) {
let email: Email = new Email();
email.subject = 'OpenAIRE Monitor Dashboard | ' + name;
email.body = this.composeMessageForCommunityDashboard(name, role);
email.body = this.composeMessageForCommunityDashboard(name);
email.recipient = recipient;
return email;
}
public static composeMessageForCommunityDashboard(name: string, role: "manager" | "member", user: string = null, invitation: any = null) {
public static composeMessageForCommunityDashboard(name: string, user: string = null, invitation: any = null) {
let message = '<p>Dear ((__user__)),</p>' +
'<p>You have been invited to be a ' + role +' of the OpenAIRE Monitor Dashboard for the ' + name + '.</p>' +
'<p>You have been invited to be a manager of the OpenAIRE Research Community Dashboard for the ' + name + '.</p>' +
'<p>Click <a href="((__link__))" target="_blank">this URL</a> and use the verification code below to accept the invitation.</p>' +
'<p>The verification code is <b>((__code__))</b>.</p>' +
(role === "manager"?
'<p>As a manager of the OpenAIRE Monitor Dashboard, you will have access to the administration part of the dashboard, ' +
'where you will be able to customize and manage the profile of the ' + name + '.</p>':
'<p>As a member of the OpenAIRE Monitor Dashboard, you will have access to the restricted access areas of the profile for the ' + name + '.') +
'<p>As a manager of the OpenAIRE Research Community Dashboard, you will have access to the administration part of the dashboard, ' +
'where you will be able to customize and manage the content of the ' + name + '.</p>' +
'<p>Please contact us at <a href="mailto:' + properties.helpdeskEmail+'">' + properties.helpdeskEmail +
'</a> if you have any questions or concerns.</p>' +
'<p>Kind Regards<br>The OpenAIRE Team</p>' +