diff --git a/entity/EmployeeRole_entity/entityfields/roles/children/excluderoles_param/valueProcess.js b/entity/EmployeeRole_entity/entityfields/roles/children/excluderoles_param/valueProcess.js index 4300750f1e372af70f68435c0b2a264176b3bc49..ffeae6d72f87ac8d2fb73b4773ed7e51842faee1 100644 --- a/entity/EmployeeRole_entity/entityfields/roles/children/excluderoles_param/valueProcess.js +++ b/entity/EmployeeRole_entity/entityfields/roles/children/excluderoles_param/valueProcess.js @@ -1,3 +1,13 @@ +import("system.tools"); +import("system.vars"); import("system.result"); -result.string(JSON.stringify(["INTERNAL_EVERYONE", "INTERNAL_GROUPWARE", "INTERNAL_SNMP", "INTERNAL_DESIGNER", "INTERNAL_TECHNICAL"])); \ No newline at end of file +var userTitle = vars.exists("$param.UserTitle_param") && vars.get("$param.UserTitle_param"); +var excludeRolesArray = ["INTERNAL_EVERYONE", "INTERNAL_GROUPWARE", "INTERNAL_SNMP", "INTERNAL_DESIGNER", "INTERNAL_TECHNICAL"]; + +var userRoles = tools.getRoles(userTitle); +for (i = 0; i < userRoles.length; i++) { + excludeRolesArray.push(userRoles[i]); +} + +result.string(JSON.stringify(excludeRolesArray)); \ No newline at end of file