Skip to content
Snippets Groups Projects
Commit 898d7393 authored by Simon Leipold's avatar Simon Leipold
Browse files

[Projekt: Entwicklung - Neon][TicketNr.: 1053501][Berechtigungshierarchie -...

[Projekt: Entwicklung - Neon][TicketNr.: 1053501][Berechtigungshierarchie - Anzeige von parent role]
parent f7706048
No related branches found
No related tags found
No related merge requests found
......@@ -5,18 +5,18 @@ import("system.result");
import("system.util");
var alias = SqlUtils.getSystemAlias();
var parentRoleName = vars.exists("$param.RoleId_param") && vars.get("$param.RoleId_param");
var selectedRoleName = vars.exists("$param.RoleId_param") && vars.get("$param.RoleId_param");
var children = [];
if (parentRoleName && parentRoleName.indexOf("CUSTOM_") != -1) {
// roles can only be assigned to CUSTOM roles -> parent role has to be a viable CUSTOM role
childRoles = newSelect("ID, CHILD_ROLE", alias)
.from("ASYS_ROLES_CHILDREN")
.where("ASYS_ROLES_CHILDREN.PARENT_ROLE", parentRoleName)
.table();
// roles can only be assigned to CUSTOM roles -> selected role has to be a viable CUSTOM role
if (selectedRoleName && selectedRoleName.indexOf("CUSTOM_") != -1) {
var childRoles = newSelect("ID, CHILD_ROLE", alias)
.from("ASYS_ROLES_CHILDREN")
.where("ASYS_ROLES_CHILDREN.PARENT_ROLE", selectedRoleName)
.table();
for each (let childRole in childRoles) {
children.push([childRole[0], childRole[1], parentRoleName]);
children.push([childRole[0], childRole[1], selectedRoleName]);
}
var ids = vars.get("$local.idvalues");
......
......@@ -836,6 +836,20 @@ function PermissionUtil () {}
return true;
}
/**
* Gets all parent roles of the given role.
*
* @param {String} pRoleName name of the role, mandatory
*
* @result {String[]} returns role names of the parent roles, if there are none then returns empty array
*/
PermissionUtil.getHierarchyParents = function(pRoleName) {
return newSelect("PARENT_ROLE", alias)
.from("ASYS_ROLES_CHILDREN")
.where("ASYS_ROLES_CHILDREN.CHILD_ROLE", pRoleName)
.arrayColumn(true);
}
} //end of block
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment