diff --git a/dashboard/users/role-users/role-users.component.ts b/dashboard/users/role-users/role-users.component.ts index ac0961a9..19cbe6c2 100644 --- a/dashboard/users/role-users/role-users.component.ts +++ b/dashboard/users/role-users/role-users.component.ts @@ -206,8 +206,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.mapType(this.type) + '.' + this.id, Validators.required), - description: this.fb.control(Role.mapType(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(); diff --git a/login/utils/helper.class.ts b/login/utils/helper.class.ts index ea0a83d5..d07abdb6 100644 --- a/login/utils/helper.class.ts +++ b/login/utils/helper.class.ts @@ -217,15 +217,18 @@ export class Role { public static ANONYMOUS_USER = 'ROLE_ANONYMOUS'; public static USER_MANAGER = 'USER_MANAGER'; public static CURATOR_CLAIM = 'CURATOR_CLAIM'; - - + + public static roleName(type: string, id: string) { + return this.GROUP + this.mapType(type) + '.' + id; + } + public static mapType(type: string, communityMap: boolean = true): string { if (type == "ri" && communityMap) { type = "community"; } else if (type == "organization") { type = "institution"; } - return Role.GROUP + type; + return type; } /**