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

Permissions - bug fix: it is now possible to create permissions on roles and entities

parent ae8434a0
No related branches found
No related tags found
No related merge requests found
......@@ -48,6 +48,7 @@
<stateProcess>%aditoprj%/entity/PermissionDetail_entity/entityfields/entity/stateProcess.js</stateProcess>
<valueProcess>%aditoprj%/entity/PermissionDetail_entity/entityfields/entity/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/PermissionDetail_entity/entityfields/entity/displayValueProcess.js</displayValueProcess>
<onValueChange>%aditoprj%/entity/PermissionDetail_entity/entityfields/entity/onValueChange.js</onValueChange>
</entityField>
<entityField>
<name>FIELD</name>
......
import("system.logging");
import("system.neon");
import("system.vars");
import("system.result");
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.getString("$this.value") == null) {
var thisValueNotValid = "{\"entity\":\"\",\"filter\":{\"type\":\"group\",\"operator\":\"AND\",\"childs\":[]}}";
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && (vars.get("$this.value") == null || vars.get("$this.value") == thisValueNotValid)) {
var entity = vars.get("$field.ENTITY");
result.string(JSON.stringify({entity: "" + entity + "", filter: {type: "group", operator: "AND", childs: []}}));
var condJson = JSON.stringify({entity: "" + entity + "", filter: {type: "group", operator: "AND", childs: []}});
result.string(condJson);
}
\ No newline at end of file
import("system.neon");
neon.refresh();
\ No newline at end of file
......@@ -58,53 +58,4 @@ function checkInput(pInputArr) {
return false;
}
return true;
}
//
// // deletes permissions with CONDTYPE = 'false' - condtype=false if a permission is used to display that a entity has no permissions
// var childPermissions = PermissionUtil.getAllChildPermissions(permissionsetid);
// for each (var permid in childPermissions) {
// if (PermissionUtil.getCondType(permid) == "false") {
// PermissionUtil.deletePermission(permid);
// }
// }
//
// // check if a new permissions is needed or an existing one can be used
// var existingPermId = permExists(role, entity, field, accesstype, condtype, condition);
// if (existingPermId != "") {
// // update
// permissionid = existingPermId;
// } else {
// // permission doesnt exist -> insert new permission
// // new permissionid is needed to link actions to the permission in the next step
// logging.log("onInsert cond: " + condition);
// permissionid = PermissionUtil.insertNewPermission(permissionsetid, condition, condtype)
// }
//
// // insert new permissionaction
// var actionNew = action.split(",");
// for each (let permaction in actionNew) {
// PermissionUtil.insertNewPermissionAction(permissionid, permaction);
// }
//
//
//// returns permissionid of the permission with fitting parameters, otherwise returns empty string
//function permExists(pRole, pEntity, pField, pAccesstype, pCondtype, pCondition) {
// var sqlStr = "";
// var sqlExt = "";
//
// if (checkInput([pCondition])) {
// sqlExt += " and cast(COND as varchar(999) = '" + pCondition + "'";
// }
//
// if (checkInput([pField])) {
// sqlExt += " and FIELD_ID = '" + pField + "'";
// }
//
// sqlStr = "select ASYS_PERMISSION.ASYS_PERMISSIONID from ASYS_PERMISSIONSET"
// + " join ASYS_PERMISSION on ASYS_PERMISSION.ASYS_PERMISSIONSET_ID = ASYS_PERMISSIONSET.ASYS_PERMISSIONSETID"
// + " where ENTITY_ID = '" + pEntity + "' and ROLE_ID = '" + pRole + "'"
// + " and ACCESSTYPE = '" + pAccesstype + "' and CONDTYPE = '" + pCondtype + "'" + sqlExt;
// var permId = db.cell(sqlStr, alias);
// return permId;
//}
\ No newline at end of file
}
\ No newline at end of file
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