[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:
parent
d804da4dd8
commit
3c7b330167
|
@ -206,8 +206,8 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
this.createRoleModal.okButtonLeft = false;
|
this.createRoleModal.okButtonLeft = false;
|
||||||
this.createRoleModal.okButtonText = 'Create';
|
this.createRoleModal.okButtonText = 'Create';
|
||||||
this.roleFb = this.fb.group({
|
this.roleFb = this.fb.group({
|
||||||
name: 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.mapType(this.type) + ' ' + this.id, Validators.required)
|
description: this.fb.control(Role.roleName(this.type, this.id), Validators.required)
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.roleFb.get('name').disable();
|
this.roleFb.get('name').disable();
|
||||||
|
|
|
@ -217,15 +217,18 @@ export class Role {
|
||||||
public static ANONYMOUS_USER = 'ROLE_ANONYMOUS';
|
public static ANONYMOUS_USER = 'ROLE_ANONYMOUS';
|
||||||
public static USER_MANAGER = 'USER_MANAGER';
|
public static USER_MANAGER = 'USER_MANAGER';
|
||||||
public static CURATOR_CLAIM = 'CURATOR_CLAIM';
|
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 {
|
public static mapType(type: string, communityMap: boolean = true): string {
|
||||||
if (type == "ri" && communityMap) {
|
if (type == "ri" && communityMap) {
|
||||||
type = "community";
|
type = "community";
|
||||||
} else if (type == "organization") {
|
} else if (type == "organization") {
|
||||||
type = "institution";
|
type = "institution";
|
||||||
}
|
}
|
||||||
return Role.GROUP + type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue