[develop]: Fix role users, role-verification type mapping.

This commit is contained in:
Konstantinos Triantafyllou 2024-04-25 15:11:04 +03:00
parent 68125b3577
commit 9b79d0c1e0
2 changed files with 15 additions and 12 deletions

View File

@ -44,7 +44,9 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
@Input()
public id: string;
@Input()
public type: string;
set type(type: string) {
this._type = Role.mapType(type);
}
@Input()
public name: string;
@Input()
@ -90,6 +92,7 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
@ViewChild('deletePendingModal') deletePendingModal: AlertModal;
@ViewChild('createRoleModal') createRoleModal: AlertModal;
public stakeholderUtils: StakeholderUtils = new StakeholderUtils();
private _type: string;
constructor(private userRegistryService: UserRegistryService,
private userManagementService: UserManagementService,
@ -143,7 +146,7 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
updateLists() {
this.loadActive = true;
this.loadPending = true;
this.subs.push(this.userRegistryService.getActive(this.type, this.id, this.role, true).subscribe(users => {
this.subs.push(this.userRegistryService.getActive(this._type, this.id, this.role, true).subscribe(users => {
this.active = users;
this.filterActiveBySearch(this.filterForm.value.active);
this.loadActive = false;
@ -156,7 +159,7 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
}
this.loadActive = false;
}));
this.subs.push(this.userRegistryService.getPending(this.type, this.id, this.role, true).subscribe(users => {
this.subs.push(this.userRegistryService.getPending(this._type, this.id, this.role, true).subscribe(users => {
this.pending = users;
this.filterPendingBySearch(this.filterForm.value.pending);
this.loadPending = false;
@ -208,8 +211,8 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
this.createRoleModal.okButtonLeft = false;
this.createRoleModal.okButtonText = 'Create';
this.roleFb = this.fb.group({
name: this.fb.control(Role.roleName(this.type, this.id), Validators.required),
description: this.fb.control(Role.roleName(this.type, this.id), Validators.required)
name: this.fb.control(Role.roleName(this._type, this.id), Validators.required),
description: this.fb.control(Role.roleName(this._type, this.id), Validators.required)
});
setTimeout(() => {
this.roleFb.get('name').disable();
@ -220,7 +223,7 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
deleteActive() {
this.loadActive = true;
this.subs.push(this.userRegistryService.remove(this.type, this.id, this.selectedUser, this.role).subscribe(() => {
this.subs.push(this.userRegistryService.remove(this._type, this.id, this.selectedUser, this.role).subscribe(() => {
this.active = this.active.filter(user => user.email != this.selectedUser);
if (this.currentActivePage.length === 0) {
this.activePage = 1;
@ -238,7 +241,7 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
deletePending() {
this.loadPending = true;
this.subs.push(this.userRegistryService.cancelInvitation(this.type, this.id, this.selectedUser, this.role).subscribe(() => {
this.subs.push(this.userRegistryService.cancelInvitation(this._type, this.id, this.selectedUser, this.role).subscribe(() => {
this.pending = this.pending.filter(user => user != this.selectedUser);
this.filterPendingBySearch(this.filterForm.value.pending);
if (this.currentPendingPage.length === 0) {
@ -265,7 +268,7 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
let current = null;
let invitations = (<Array<any>>this.emailsForm.value).map(email => {
current = email;
return this.userRegistryService.invite(this.type, this.id, {
return this.userRegistryService.invite(this._type, this.id, {
link: this.link,
email: this.emailComposer(this.name, email, this.role)
}, this.role).pipe(catchError(error => {
@ -308,7 +311,7 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
createGroup() {
this.loadActive = true;
this.loadPending = true;
this.userRegistryService.createRole(this.type, this.id).subscribe(() => {
this.userRegistryService.createRole(this._type, this.id).subscribe(() => {
NotificationHandler.rise('Group has been <b> successfully created</b>');
this.updateLists();
}, error => {
@ -336,11 +339,11 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
}
public get isManager(): boolean {
return this.isCurator || !!Session.isManager(this.type, this.id, this.user);
return this.isCurator || !!Session.isManager(this._type, this.id, this.user);
}
public get isCurator(): boolean {
return this.isPortalAdmin || !!Session.isCurator(this.type, this.user);
return this.isPortalAdmin || !!Session.isCurator(this._type, this.user);
}
public get isPortalAdmin(): boolean {

View File

@ -73,7 +73,7 @@ export class RoleVerificationComponent extends BaseComponent implements OnInit,
public id: string;
@Input()
set type(type: string) {
this._type = Role.GROUP + type;
this._type = Role.GROUP + Role.mapType(type);
}
@Input()
public name: string;