[angular-16-irish-monitor | CHANGED | DONE]: Remove role prefix from role name functions and added only in creation of a role.

This commit is contained in:
Konstantinos Triantafyllou 2023-12-15 16:59:38 +02:00
parent d804da4dd8
commit 3c7b330167
2 changed files with 8 additions and 5 deletions

View File

@ -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();

View File

@ -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;
}
/**