From 8a965cda999ee7bec285a22da86adb8f4477bc9a Mon Sep 17 00:00:00 2001
From: Simon Leipold <s.leipold@adito.de>
Date: Mon, 12 Aug 2019 15:38:24 +0200
Subject: [PATCH] Permissions - refactoring permission_lib + bugfix fields in
 overview

---
 .../permissiondetails/onValidation.js         |   6 +-
 .../recordcontainers/jdito/contentProcess.js  |   6 +-
 .../recordcontainers/jdito/onDelete.js        |   2 +-
 .../recordcontainers/jdito/onInsert.js        |   2 +-
 .../recordcontainers/jdito/onUpdate.js        |   2 +-
 .../accesstype/displayValueProcess.js         |   2 +-
 .../entityfields/accesstype/valueProcess.js   |   4 +-
 .../entityfields/field/stateProcess.js        |   2 +-
 .../permissionid_param/valueProcess.js        |   4 +-
 .../permissionactions/onValidation.js         |   4 +-
 .../recordcontainers/jdito/contentProcess.js  |  12 +-
 .../recordcontainers/jdito/onDelete.js        |  12 +-
 .../recordcontainers/jdito/onInsert.js        |   8 +-
 .../recordcontainers/jdito/onUpdate.js        |   4 +-
 .../recordcontainers/jdito/contentProcess.js  |  29 +-
 process/Permission_lib/process.js             | 301 +++++++-----------
 process/autostartNeon/process.js              |   4 +-
 17 files changed, 173 insertions(+), 231 deletions(-)

diff --git a/entity/PermissionAction_entity/entityfields/permissiondetails/onValidation.js b/entity/PermissionAction_entity/entityfields/permissiondetails/onValidation.js
index ac3912f70bf..5acbe1fae97 100644
--- a/entity/PermissionAction_entity/entityfields/permissiondetails/onValidation.js
+++ b/entity/PermissionAction_entity/entityfields/permissiondetails/onValidation.js
@@ -15,15 +15,15 @@ var deletedRows = vars.get("$field.PermissionDetails.deletedRows");
 
 if (actionTitle == "null" || actionTitle == undefined || actionTitle == null || actionTitle == "") {
     result.string(translate.text("Empty actions are not allowed!"));
-} else if (PermissionUtil.existsPermission(permissionId)) {
+} else if (PermissionUtil.permissionExists(permissionId)) {
     // existing permission
     // check if action is already in DB
-    var actionsInDb = PermissionUtil.getPermissionAction(permissionId);
+    var actionsInDb = PermissionUtil.getActions([permissionId]);
     var sqlStr = "select COND from ASYS_PERMISSION where ASYS_PERMISSIONID='" + permissionId + "'";
     var permCondDb = db.cell(sqlStr, alias);
     
     for each (var action in actionsInDb) {
-        if (PermissionUtil.resolvePermissionActionId(action) == actionTitle && permCondInput == permCondDb) {
+        if (PermissionUtil.resolveActionId(action) == actionTitle && permCondInput == permCondDb) {
             result.string(translate.text("Action '" + actionTitle + "' already linked to this permission!"));
             break;
         }
diff --git a/entity/PermissionAction_entity/recordcontainers/jdito/contentProcess.js b/entity/PermissionAction_entity/recordcontainers/jdito/contentProcess.js
index e3af7028be1..50caa264cc3 100644
--- a/entity/PermissionAction_entity/recordcontainers/jdito/contentProcess.js
+++ b/entity/PermissionAction_entity/recordcontainers/jdito/contentProcess.js
@@ -7,11 +7,11 @@ import("Permission_lib");
 var actions = [];
 var permissionId = vars.exists("$param.PermissionId_param") && vars.get("$param.PermissionId_param");
 
-if (permissionId && PermissionUtil.existsPermission(permissionId))
+if (permissionId && PermissionUtil.permissionExists(permissionId))
 {
-    var permActions = PermissionUtil.getPermissionAction(permissionId);
+    var permActions = PermissionUtil.getActions([permissionId]);
     for each (var permActionId in permActions) {
-        actions.push([permActionId[0], PermissionUtil.resolvePermissionActionId(permActionId), PermissionUtil.resolvePermissionActionId(permActionId)]);    
+        actions.push([permActionId[0], PermissionUtil.resolveActionId(permActionId), PermissionUtil.resolveActionId(permActionId)]);    
     }
 
     result.object(actions);
diff --git a/entity/PermissionAction_entity/recordcontainers/jdito/onDelete.js b/entity/PermissionAction_entity/recordcontainers/jdito/onDelete.js
index 69b743814c1..3dc7236e295 100644
--- a/entity/PermissionAction_entity/recordcontainers/jdito/onDelete.js
+++ b/entity/PermissionAction_entity/recordcontainers/jdito/onDelete.js
@@ -2,4 +2,4 @@ import("system.vars");
 import("Permission_lib");
 
 var action = vars.get("$local.uid");
-PermissionUtil.deletePermissionAction(action);
\ No newline at end of file
+PermissionUtil.deleteAction(action);
\ No newline at end of file
diff --git a/entity/PermissionAction_entity/recordcontainers/jdito/onInsert.js b/entity/PermissionAction_entity/recordcontainers/jdito/onInsert.js
index eaa90d0cb85..ba4a4478460 100644
--- a/entity/PermissionAction_entity/recordcontainers/jdito/onInsert.js
+++ b/entity/PermissionAction_entity/recordcontainers/jdito/onInsert.js
@@ -10,7 +10,7 @@ var permissionId = vars.exists("$param.PermissionId_param") && vars.get("$param.
 
 if (permissionId) {
     var newAction = vars.get("$local.rowdata")["ACTION.value"];
-    PermissionUtil.insertNewPermissionAction(permissionId, newAction, vars.get("$field.UID"));
+    PermissionUtil.insertAction(permissionId, newAction, vars.get("$field.UID"));
 }
 
 tools.clearPermissionCache();
\ No newline at end of file
diff --git a/entity/PermissionAction_entity/recordcontainers/jdito/onUpdate.js b/entity/PermissionAction_entity/recordcontainers/jdito/onUpdate.js
index 6d5e623b7c9..2ca5d894401 100644
--- a/entity/PermissionAction_entity/recordcontainers/jdito/onUpdate.js
+++ b/entity/PermissionAction_entity/recordcontainers/jdito/onUpdate.js
@@ -7,7 +7,7 @@ var col = "ACTION";
 var table = "ASYS_PERMISSIONACTION";
 var permissionId = vars.exists("$param.PermissionId_param") && vars.get("$param.PermissionId_param");
 
-if (permissionId && PermissionUtil.existsPermission(permissionId)) {
+if (permissionId && PermissionUtil.permissionExists(permissionId)) {
     var newAction = vars.get("$local.rowdata")["ACTION.value"];
     PermissionUtil.updateIfDiff(vars.get("$field.UID"), newAction, col, table);
 }
\ No newline at end of file
diff --git a/entity/PermissionDetail_entity/entityfields/accesstype/displayValueProcess.js b/entity/PermissionDetail_entity/entityfields/accesstype/displayValueProcess.js
index 834f79bd2a7..64d2e3dbafd 100644
--- a/entity/PermissionDetail_entity/entityfields/accesstype/displayValueProcess.js
+++ b/entity/PermissionDetail_entity/entityfields/accesstype/displayValueProcess.js
@@ -8,7 +8,7 @@ var field = vars.get("$field.FIELD");
 var role = vars.get("$field.ROLE");
 var entity = vars.get("$field.ENTITY");
 var accesstype = vars.get("$field.ACCESSTYPE");
-var rootPermSet = PermissionUtil.getRootPermissionSet(role, entity);
+var rootPermSet = PermissionUtil.getSetRoot(role, entity);
 
 if (operatingState == neon.OPERATINGSTATE_SEARCH || neon.OPERATINGSTATE_VIEW) {
     switch (accesstype) {
diff --git a/entity/PermissionDetail_entity/entityfields/accesstype/valueProcess.js b/entity/PermissionDetail_entity/entityfields/accesstype/valueProcess.js
index 19d56ab1772..77b31c52351 100644
--- a/entity/PermissionDetail_entity/entityfields/accesstype/valueProcess.js
+++ b/entity/PermissionDetail_entity/entityfields/accesstype/valueProcess.js
@@ -6,8 +6,8 @@ var field = vars.get("$field.FIELD");
 var role = vars.get("$field.ROLE");
 var entity = vars.get("$field.ENTITY");
 var permId = vars.get("$field.UID");
-var rootPermSet = PermissionUtil.getRootPermissionSet(role, entity);
-var rootPerm = PermissionUtil.getDefaultPermission(rootPermSet);
+var rootPermSet = PermissionUtil.getSetRoot(role, entity);
+var rootPerm = PermissionUtil.getPermissionWithoutCond(rootPermSet);
 
 if (PermissionUtil.getCondType(rootPerm) == "false") {
     // condtype="false" is used to display that this entity has the usePermissions flag set but has no permissions linked -> no access on any level
diff --git a/entity/PermissionDetail_entity/entityfields/field/stateProcess.js b/entity/PermissionDetail_entity/entityfields/field/stateProcess.js
index 2a3f639a77b..a28f5c86f9b 100644
--- a/entity/PermissionDetail_entity/entityfields/field/stateProcess.js
+++ b/entity/PermissionDetail_entity/entityfields/field/stateProcess.js
@@ -7,7 +7,7 @@ import("Permission_lib");
 var role = vars.get("$field.ROLE");
 var entity = vars.get("$field.ENTITY");
 
-rootPermSet = PermissionUtil.getRootPermissionSet(role, entity);
+rootPermSet = PermissionUtil.getSetRoot(role, entity);
 
 if (rootPermSet == "") {
     result.string(neon.COMPONENTSTATE_DISABLED);
diff --git a/entity/PermissionDetail_entity/entityfields/permissionactions/children/permissionid_param/valueProcess.js b/entity/PermissionDetail_entity/entityfields/permissionactions/children/permissionid_param/valueProcess.js
index 7f2dea6db77..8380b4e4497 100644
--- a/entity/PermissionDetail_entity/entityfields/permissionactions/children/permissionid_param/valueProcess.js
+++ b/entity/PermissionDetail_entity/entityfields/permissionactions/children/permissionid_param/valueProcess.js
@@ -5,10 +5,10 @@ import("Permission_lib");
 var entity = vars.get("$field.ENTITY");
 var cond = vars.get("$field.CONDITION");
 var noCond = "{\"entity\":\"" + entity + "\",\"filter\":{\"type\":\"group\",\"operator\":\"AND\",\"childs\":[]}}";
-var permSetId = PermissionUtil.getPermissionSet(vars.get("$field.ROLE"), vars.get("$field.ENTITY"), vars.get("$field.ACCESSTYPE"));
+var permSetId = PermissionUtil.getSet(vars.get("$field.ROLE"), vars.get("$field.ENTITY"), vars.get("$field.ACCESSTYPE"));
 
 if (permSetId != "" && (cond == "" || cond == noCond)) {
-    var rootPermId = PermissionUtil.getDefaultPermission(permSetId);
+    var rootPermId = PermissionUtil.getPermissionWithoutCond(permSetId);
     if (rootPermId != "") {
         result.string(rootPermId);
     }
diff --git a/entity/PermissionDetail_entity/entityfields/permissionactions/onValidation.js b/entity/PermissionDetail_entity/entityfields/permissionactions/onValidation.js
index 1abe9d92bfd..b726986dd84 100644
--- a/entity/PermissionDetail_entity/entityfields/permissionactions/onValidation.js
+++ b/entity/PermissionDetail_entity/entityfields/permissionactions/onValidation.js
@@ -16,7 +16,7 @@ var accesstype = vars.get("$field.ACCESSTYPE");
 var permCondInput = vars.get("$field.CONDITION");
 var permCondType = vars.get("$field.CONDTYPE");
 var permissionId = PermissionUtil.getPermission(roleTitle, entityTitle, fieldTitle, accesstype, permCondInput, permCondType);
-var actionsInDb = PermissionUtil.getPermissionAction(permissionId);
+var actionsInDb = PermissionUtil.getActions([permissionId]);
 
 var actionsAsStringArray = vars.get("$field.ACTION").split(","); // only useful while working with already existing permissions
 
@@ -24,7 +24,7 @@ var deletedRows = vars.get("$field.PermissionActions.deletedRows");
 var changedRows = vars.get("$field.PermissionActions.changedRows");
 var insertedRows = vars.get("$field.PermissionActions.insertedRows");
 
-if (PermissionUtil.existsPermission(permissionId)) {
+if (PermissionUtil.permissionExists(permissionId)) {
     // old permission
     // insert nur möglich, wenn gleiche action auch gelöscht wurde, oder zuvor nicht da war
     for each (let row in insertedRows) {
diff --git a/entity/PermissionDetail_entity/recordcontainers/jdito/contentProcess.js b/entity/PermissionDetail_entity/recordcontainers/jdito/contentProcess.js
index 894bb06e116..7caa94138a3 100644
--- a/entity/PermissionDetail_entity/recordcontainers/jdito/contentProcess.js
+++ b/entity/PermissionDetail_entity/recordcontainers/jdito/contentProcess.js
@@ -14,6 +14,7 @@ var entitiesMetaData = project.getDataModels(project.DATAMODEL_KIND_ENTITY);
 var entityStructure;
 var entitiesUsePermFlagSet = [];
 var fieldsUsePermFlagSet = [];
+var noCond = "{\"entity\":\"" + vars.get("$field.ENTITY") + "\",\"filter\":{\"type\":\"group\",\"operator\":\"AND\",\"childs\":[]}}";
 
 // gets all names of the entites which have the 'usePermission'-flag set (positive list)
 // gets all names of the fields which have the 'usePermission'-flag set (positive list)
@@ -110,15 +111,16 @@ result.object(res.sort(sortResultsAfterAccessTypes));
 function prepareResultArray(pEntry, pRes) {
     var rootPermission = "";
     if (pEntry.accesstype != "E") {
-        if (pEntry.accesstype == "F" && pEntry.cond != "") {
-            rootPermission = PermissionUtil.getRootFieldPermission(pEntry.permissionid);
+        if (pEntry.accesstype == "F" && pEntry.cond != "" && pEntry.cond != noCond) {
+            rootPermission = PermissionUtil.getPermissionWithoutCond(PermissionUtil.getParentSet(pEntry.permissionid));
             if (rootPermission == "") {
-                rootPermission = PermissionUtil.getRootPermission(pEntry.permissionid);
+                rootPermission = PermissionUtil.getPermissionRoot(pEntry.permissionid);
             }
         } else 
-            rootPermission = PermissionUtil.getRootPermission(pEntry.permissionid);        
+            rootPermission = PermissionUtil.getPermissionRoot(pEntry.permissionid);        
     }
-    pRes.push([pEntry.permissionid, pEntry.entity, pEntry.role, pEntry.field, pEntry.cond, sortActions(pEntry.action.split(","), pEntry.accesstype).join(","), pEntry.accesstype, pEntry.condtype, rootPermission]);
+    pRes.push([pEntry.permissionid, pEntry.entity, pEntry.role, pEntry.field, pEntry.cond, 
+        sortActions(pEntry.action.split(","), pEntry.accesstype).join(","), pEntry.accesstype, pEntry.condtype, rootPermission]);
     return pRes;
 }
 
diff --git a/entity/PermissionDetail_entity/recordcontainers/jdito/onDelete.js b/entity/PermissionDetail_entity/recordcontainers/jdito/onDelete.js
index 03032f4d74e..9e14cbbfbfc 100644
--- a/entity/PermissionDetail_entity/recordcontainers/jdito/onDelete.js
+++ b/entity/PermissionDetail_entity/recordcontainers/jdito/onDelete.js
@@ -7,8 +7,8 @@ import("Permission_lib");
 
 var permId = vars.get("$field.UID");
 var accessType = vars.get("$field.ACCESSTYPE");
-var parentPermSetId = PermissionUtil.getParentPermissionSet(permId);
-var linkedActions = PermissionUtil.getAllChildPermissionActions(permId);
+var parentPermSetId = PermissionUtil.getParentSet(permId);
+var linkedActions = PermissionUtil.getActionsOfSet(permId);
 var alias = SqlUtils.getSystemAlias();
 
 var sqlCondDelAction = SqlCondition.begin()
@@ -23,10 +23,10 @@ var sqlCondDelPermSet = SqlCondition.begin()
 
 switch (accessType) {
     case "E":
-        var allPermSets = PermissionUtil.getAllChildPermissionSets(parentPermSetId);
+        var allPermSets = PermissionUtil.getChildSetsOfSet(parentPermSetId);
         allPermSets.push(parentPermSetId);
-        var allPerms = PermissionUtil.getAllPermissions(allPermSets);
-        var allPermActions = PermissionUtil.getAllPermissionActions(allPerms);
+        var allPerms = PermissionUtil.getPermissions(allPermSets);
+        var allPermActions = PermissionUtil.getActions(allPerms);
         
         sqlCondDelAction = SqlCondition.begin()
         .and("ASYS_PERMISSIONACTION.ASYS_PERMISSIONACTIONID in ('" + allPermActions.join("','") + "')")
@@ -48,7 +48,7 @@ switch (accessType) {
         break;
 }
 
-if (PermissionUtil.permSetIsEmpty(parentPermSetId)) {
+if (PermissionUtil.setIsEmpty(parentPermSetId)) {
     db.deleteData("ASYS_PERMISSIONSET", sqlCondDelPermSet, alias); // delete empty permissionset
 }
 
diff --git a/entity/PermissionDetail_entity/recordcontainers/jdito/onInsert.js b/entity/PermissionDetail_entity/recordcontainers/jdito/onInsert.js
index d74cc3ec7c6..25b19a3327d 100644
--- a/entity/PermissionDetail_entity/recordcontainers/jdito/onInsert.js
+++ b/entity/PermissionDetail_entity/recordcontainers/jdito/onInsert.js
@@ -22,7 +22,7 @@ var condition = vars.get("$field.CONDITION");
 if (checkInput([role, entity, accesstype, condtype])) {
     
     // permission set
-    var permissionsetid = PermissionUtil.getPermissionSet(role, entity, accesstype, field);
+    var permissionsetid = PermissionUtil.getSet(role, entity, accesstype, field);
     
     if (permissionsetid == "") {
         // no fitting permissionset found - insert new permissionset
@@ -30,16 +30,16 @@ if (checkInput([role, entity, accesstype, condtype])) {
         if (accesstype == "E") {
             rootpermissionset = "";
         } else {
-            rootpermissionset = PermissionUtil.getRootPermissionSet(role, entity);
+            rootpermissionset = PermissionUtil.getSetRoot(role, entity);
         }
-        permissionsetid = PermissionUtil.insertNewPermissionSet(rootpermissionset, entity, role, field, accesstype);
+        permissionsetid = PermissionUtil.insertSet(rootpermissionset, entity, role, field, accesstype);
     }
     
     // permission
     var existingPerm = PermissionUtil.getPermission(role, entity, field, accesstype, condition);
     if (existingPerm == "") {
         // no existing perm found -> insert
-        PermissionUtil.insertNewPermission(permissionsetid, condition, condtype, permissionid);
+        PermissionUtil.insertPermission(permissionsetid, condition, condtype, permissionid);
     } else {
         // existing perm found -> update
         PermissionUtil.updateIfDiff(existingPerm, permissionsetid, "ASYS_PERMISSIONSET_ID", tablename);
diff --git a/entity/PermissionDetail_entity/recordcontainers/jdito/onUpdate.js b/entity/PermissionDetail_entity/recordcontainers/jdito/onUpdate.js
index d45ba525a2c..cacdde1e352 100644
--- a/entity/PermissionDetail_entity/recordcontainers/jdito/onUpdate.js
+++ b/entity/PermissionDetail_entity/recordcontainers/jdito/onUpdate.js
@@ -25,14 +25,12 @@ if (diff.length > 0) {
     // insert the different actions
     cols = db.getColumns(table, alias);
     for each (var action in actionNew) {
-        PermissionUtil.insertNewPermissionAction(permissionid, action);
+        PermissionUtil.insertAction(permissionid, action);
     }
 }
 
 PermissionUtil.updateIfDiff(permissionid, permCond, "COND", "ASYS_PERMISSION"); // updates COND if the new cond is different to COND in DB
 PermissionUtil.updateIfDiff(permissionid, permCondType, "CONDTYPE", "ASYS_PERMISSION"); // updates CONDTYPE if the new condtype is different to CONDTYPE in DB
-// entity of children has to be changed/deleted/ignored?
-// PermissionUtil.updateIfDiff(PermissionUtil.getParentPermissionSet(permissionid), entityNew, "ENTITY_ID", "ASYS_PERMISSIONSET");
 
 neon.refreshAll(); 
 tools.clearPermissionCache();
\ No newline at end of file
diff --git a/entity/PermissionOverview_entity/recordcontainers/jdito/contentProcess.js b/entity/PermissionOverview_entity/recordcontainers/jdito/contentProcess.js
index 2c418c0fb63..3e15f2cfb64 100644
--- a/entity/PermissionOverview_entity/recordcontainers/jdito/contentProcess.js
+++ b/entity/PermissionOverview_entity/recordcontainers/jdito/contentProcess.js
@@ -1,3 +1,4 @@
+import("Sql_lib");
 import("system.project");
 import("system.vars");
 import("system.result");
@@ -9,6 +10,7 @@ var roleTitle = "";
 var entityTitle = "";
 var sqlCond = "";
 var sqlStr = "";
+let alias = SqlUtils.getSystemAlias();
 var roleInternalEveryone = "INTERNAL_EVERYONE";
 
 var entitiesMetaData = project.getDataModels(project.DATAMODEL_KIND_ENTITY);
@@ -20,8 +22,8 @@ for each (let entityMetaData in entitiesMetaData) {
         entitiesUsePermFlagSet.push(entityMetaData[0])
         if (PermissionUtil.getNumberOfPermissions(entityMetaData[0]) == 0) {
             // no permissions found for the given entity -> create permissionset for role INTERNAL_EVERYONE with five X's for view, create, read, edit, delete         
-            var noAccessPermissionSetIdEntity = PermissionUtil.insertNewPermissionSet("", entityMetaData[0], roleInternalEveryone, "", "E");
-            PermissionUtil.insertNewPermission(noAccessPermissionSetIdEntity, "", "false"); // false is an indicator for PermissionDetails so the user can create a new PermissionSet on access level "E"
+            var noAccessPermissionSetIdEntity = PermissionUtil.insertSet("", entityMetaData[0], roleInternalEveryone, "", "E");
+            PermissionUtil.insertPermission(noAccessPermissionSetIdEntity, "", "false"); // false is an indicator for PermissionDetails so the user can create a new PermissionSet on access level "E"
         }
     }
 }
@@ -42,11 +44,12 @@ var rolesOrEntities = db.array(db.COLUMN, sqlStr);
 var entityPermSetId = "";
 for each (var entry in rolesOrEntities) { // entry contains either a role or an entity, depending on which param exists
     if (vars.exists("$param.RoleTitle_param") && vars.get("$param.RoleTitle_param")) {
-        entityPermSetId = PermissionUtil.getRootPermissionSet(roleTitle, entry);
+        entityPermSetId = PermissionUtil.getSetRoot(roleTitle, entry);
     } else if (vars.exists("$param.EntityTitle_param") && vars.get("$param.EntityTitle_param")) {
-        entityPermSetId = PermissionUtil.getRootPermissionSet(entry, entityTitle);
+        entityPermSetId = PermissionUtil.getSetRoot(entry, entityTitle);
     }
-    var recordPermSetId = PermissionUtil.getChildRecordPermissionSet(entityPermSetId);
+    var recordPermSetId = db.array(db.COLUMN, SqlCondition.begin().and("ASYS_PERMISSIONSET_ID = '" + entityPermSetId + "'").and("ACCESSTYPE = 'R'")
+        .buildSql("select ASYS_PERMISSIONSETID from ASYS_PERMISSIONSET"), alias);
     var currOverview = [entityPermSetId, entry, "VAADIN:CLOSE", "VAADIN:CLOSE", "VAADIN:CLOSE", "VAADIN:CLOSE", "VAADIN:CLOSE"];
 
     // default entity permissions
@@ -63,16 +66,16 @@ for each (var entry in rolesOrEntities) { // entry contains either a role or an
 result.object(res);
 
 function prepareOverview(pPermSetId, pCurrOverview, pMode) {
-    var permId, defaultPermActionId, conditionalPermActionId = [], currOverview;
+    var conditionalPermActionId = [], currOverview;
     switch (pMode) {
         case "default":
-            permId = PermissionUtil.getDefaultPermission(pPermSetId);
-            defaultPermActionId = PermissionUtil.getPermissionAction(permId);
+            var permId = PermissionUtil.getPermissionWithoutCond(pPermSetId);
+            var defaultPermActionId = PermissionUtil.getActions([permId]);
             currOverview = pCurrOverview;
     
             if (PermissionUtil.getPermissionCondType(permId) == "true") {
                 for each (let actionSets in defaultPermActionId) {
-                    switch (PermissionUtil.resolvePermissionActionId(actionSets)) {
+                    switch (PermissionUtil.resolveActionId(actionSets)) {
                         case "view":
                             currOverview[2] = "VAADIN:CIRCLE";
                             break;
@@ -93,15 +96,15 @@ function prepareOverview(pPermSetId, pCurrOverview, pMode) {
             }
             break;
         case "conditional":
-            permId = PermissionUtil.getConditionalPermission(pPermSetId);
-            for each (let perm in permId) {
-                conditionalPermActionId.push(PermissionUtil.getPermissionAction(perm));
+            var permIds = PermissionUtil.getPermissionWithCond(pPermSetId);
+            for each (let permId in permIds) {
+                conditionalPermActionId.push(PermissionUtil.getActions([permId]));
             }
             currOverview = pCurrOverview;
             
             for each (let actionSets in conditionalPermActionId) {
                 for each (let action in actionSets) {
-                    switch (PermissionUtil.resolvePermissionActionId(action)) {
+                    switch (PermissionUtil.resolveActionId(action)) {
                         case "view":
                             currOverview[2] = "VAADIN:CIRCLE_THIN";
                             break;
diff --git a/process/Permission_lib/process.js b/process/Permission_lib/process.js
index 1d8f9942319..d06b7295339 100644
--- a/process/Permission_lib/process.js
+++ b/process/Permission_lib/process.js
@@ -17,92 +17,56 @@ function PermissionUtil () {}
     /**
  * Returns the ids of all subordinated permission sets of a given parent permission set.
  * 
- * @param {String} pPermissionSetId the id of the parent permission set
+ * @param {String} pSetId id of the parent permission set
  * 
  * @result {String[]} array with the ids of every subordinated permission set. The result can never be null.
  */
-    PermissionUtil.getAllChildPermissionSets = function (pPermissionSetId) 
+    PermissionUtil.getChildSetsOfSet = function (pSetId) 
     {   
         return db.array(db.COLUMN, SqlCondition.begin()
-            .and("ASYS_PERMISSIONSET_ID = '" + pPermissionSetId + "'")
+            .and("ASYS_PERMISSIONSET_ID = '" + pSetId + "'")
             .buildSql("select ASYS_PERMISSIONSETID from ASYS_PERMISSIONSET")
             , alias);
     }
 
-    /**
- * Returns the id of the subordinated permission set with accesstype 'record' of a given permission set.
- * 
- * @param {String} pPermissionSetId the id of the parent permission set
- * 
- * @result {String} id of subordinated permission set. The result can never be null.
- */
-    PermissionUtil.getChildRecordPermissionSet = function (pPermissionSetId) 
-    {   
-        return db.array(db.COLUMN, SqlCondition.begin()
-            .and("ASYS_PERMISSIONSET_ID = '" + pPermissionSetId + "'")
-            .and("ACCESSTYPE = 'R'")
-            .buildSql("select ASYS_PERMISSIONSETID from ASYS_PERMISSIONSET")
-            , alias);
-    }
-
-    /**
- * Returns all subordinated permissions of a given permission set.
- * 
- * @param {String} pPermissionSetId the id of the parent permission set
- * 
- * @result {String[]} array with the ids of every subordinated permission. The result can never be null.
- */
-    PermissionUtil.getAllChildPermissions = function (pPermissionSetId)
-    {
-        return db.array(db.COLUMN, SqlCondition.begin()
-            .and("ASYS_PERMISSIONSET.ASYS_PERMISSIONSETID = '" + pPermissionSetId + "'")
-            .buildSql("select ASYS_PERMISSION.ASYS_PERMISSIONID from ASYS_PERMISSION"
-                + " join ASYS_PERMISSIONSET on ASYS_PERMISSIONSET.ASYS_PERMISSIONSETID = ASYS_PERMISSION.ASYS_PERMISSIONSET_ID")
-            , alias);
-    }
-
     /**
  * Returns all subordinated permission actions of a given permission set.
  * 
- * @param {String} pPermissionSetId the id of the parent permission set
+ * @param {String} pSetId id of the parent permission set
  * 
  * @result {String[]} array with the ids of every subordinated permission action. The result can never be null.
  */
-    PermissionUtil.getAllChildPermissionActions = function (pPermissionSetId)
+    PermissionUtil.getActionsOfSet = function (pSetId)
     {
         return db.array(db.COLUMN, SqlCondition.begin()
-            .and("ASYS_PERMISSION.ASYS_PERMISSIONSET_ID = '" + pPermissionSetId + "'")
+            .and("ASYS_PERMISSION.ASYS_PERMISSIONSET_ID = '" + pSetId + "'")
             .buildSql("select ASYS_PERMISSIONACTION.ASYS_PERMISSIONACTIONID from ASYS_PERMISSIONACTION"
                 + " join ASYS_PERMISSION on ASYS_PERMISSION.ASYS_PERMISSIONID = ASYS_PERMISSIONACTION.ASYS_PERMISSION_ID")
             , alias);
     }
-
+    
     /**
- * Returns all subordinated permission actions of a given permission.
+ * Returns all permission actions of the given permissions.
  * 
- * @param {String} pPermissionId the id of the parent permission
+ * @param {String[]} pPermIds the ids of the permissions
  * 
- * @result {String[]} array with the ids of every subordinated permission action. The result can never be null.
+ * @result {String[]} returns ids of all permission actions. The result can never be null.
  */
-    PermissionUtil.getAllChildPermissionActions = function (pPermissionId)
-    {
-        return db.array(db.COLUMN, SqlCondition.begin()
-            .and("ASYS_PERMISSION_ID = '" + pPermissionId + "'")
-            .buildSql("select ASYS_PERMISSIONACTIONID from ASYS_PERMISSIONACTION")
-            , alias);
+    PermissionUtil.getActions = function(pPermIds) {
+        return db.table("select ASYS_PERMISSIONACTIONID from ASYS_PERMISSIONACTION where ASYS_PERMISSIONACTION.ASYS_PERMISSION_ID in ('" + pPermIds.join("','") + "')", alias);
     }
 
     /**
  * Returns the action a given permission action id.
  * 
- * @param {String} pPermissionActionId the id of the action
+ * @param {String} pActionId id of the action
  * 
- * @result {String} action name as readable string of the given permission action id. Never 'null', empty string if there is no result.
+ * @result {String} title of action as readable string of the given action id. Never 'null', empty string if there is no result.
  */
-    PermissionUtil.resolvePermissionActionId = function (pPermissionActionId)
+    PermissionUtil.resolveActionId = function (pActionId)
     {
         return db.cell(SqlCondition.begin()
-            .and("ASYS_PERMISSIONACTIONID = '" + pPermissionActionId + "'")
+            .and("ASYS_PERMISSIONACTIONID = '" + pActionId + "'")
             .buildSql("select ASYS_PERMISSIONACTION.ACTION from ASYS_PERMISSIONACTION")
             , alias);
     }
@@ -131,13 +95,13 @@ function PermissionUtil () {}
     }
 
     /**
- * Returns the first index at which a given permissionid can be found in the array, or -1 if it is not present.
- * 
- * @param {String} pPermId the id of the permission
+ * Returns the first index at which a given permissionid can be found in an array, or -1 if it is not present.
  * 
  * @param {String[]} pPermTable permission table
- * 
- * @result {int} returns the position (index) of the searched permission in the table, otherwise returns -1 if not found
+ *  
+ * @param {String} pPermId id of the permission
+ *
+ * @result {int} returns position (index) of the searched permission in the table, otherwise returns -1 if not found
  */
     PermissionUtil.indexOfPermId = function(pPermTable, pPermId) {
         var notFound = -1;
@@ -167,7 +131,7 @@ function PermissionUtil () {}
     /**
  * Checks if the given string is different to the string of a column in the given database table.
  * 
- * @param {String} pId the id
+ * @param {String} pId id of DB entry
  * 
  * @param {String} pString string which has to be checked if different
  * 
@@ -186,7 +150,7 @@ function PermissionUtil () {}
     /**
  * Updates the value of the column in table if the values are different.
  * 
- * @param {String} pId the id
+ * @param {String} pId id of DB entry
  * 
  * @param {String} pValue string which gets checked if different
  * 
@@ -209,9 +173,9 @@ function PermissionUtil () {}
     /**
  * Gets the number of permissions which are linked to the given entity.
  * 
- * @param {String} pEntityName The name of the entity
+ * @param {String} pEntityName name of the entity
  * 
- * @result {Integer} returns the number of permissions linked to the entity.
+ * @result {Integer} returns number of permissions linked to the entity.
  */
     PermissionUtil.getNumberOfPermissions = function(pEntityName) {
         var table = "ASYS_PERMISSIONSET";
@@ -222,101 +186,71 @@ function PermissionUtil () {}
     /**
  * Gets the default permission of the root permission set.
  * 
- * @param {String} pPermId the id of the permission
+ * @param {String} pPermId id of the permission
  * 
- * @result {String} returns the id of the default permission of the root permission set. Never 'null', empty string if there is no result.
+ * @result {String} returns id of the default permission of the root permission set. Never 'null', empty string if there is no result.
  */
-    PermissionUtil.getRootPermission = function(pPermId) {
-        var sqlStr = "select ASYS_PERMISSIONSET_ID from ASYS_PERMISSION where ASYS_PERMISSIONID = '" + pPermId + "'";
-        var parentPermSet = db.array(db.ROW, sqlStr, alias);
+    PermissionUtil.getPermissionRoot = function(pPermId) {
+        var parentSet = [PermissionUtil.getParentSet(pPermId)];
 
-        while (parentPermSet[0] != "") {
-            sqlStr = "select ASYS_PERMISSIONSET_ID, ASYS_PERMISSIONSETID from ASYS_PERMISSIONSET where ASYS_PERMISSIONSETID = '" + parentPermSet[0] + "'";
-            parentPermSet = db.array(db.ROW, sqlStr, alias);
+        while (parentSet[0] != "") {
+            let sqlStr = "select ASYS_PERMISSIONSET_ID, ASYS_PERMISSIONSETID from ASYS_PERMISSIONSET where ASYS_PERMISSIONSETID = '" + parentSet[0] + "'";
+            parentSet = db.array(db.ROW, sqlStr, alias);
         }
     
-        sqlStr = "select ASYS_PERMISSIONID from ASYS_PERMISSION where ASYS_PERMISSIONSET_ID = '" + parentPermSet[1] + "'";
-        return db.cell(sqlStr, alias);
-    }
-
-    /**
- * Gets the default field permission of the root field permission set.
- * 
- * @param {String} pPermId the id of the field permission
- * 
- * @result {String} returns the id of the default field permission of the root field permission set. Never 'null', empty string if there is no result.
- */
-    PermissionUtil.getRootFieldPermission = function(pPermId) {
-        var sqlStr = "select ASYS_PERMISSIONSET_ID from ASYS_PERMISSION where ASYS_PERMISSIONID = '" + pPermId + "'";
-        var parentFieldPermSet = db.array(db.ROW, sqlStr, alias);
-    
-        sqlStr = "select ASYS_PERMISSIONID from ASYS_PERMISSION where ASYS_PERMISSIONSET_ID = '" + parentFieldPermSet + "' and cond is null";
-        return db.cell(sqlStr, alias);
+        return PermissionUtil.getPermissionWithoutCond(parentSet[1]);
     }
 
     /**
  * Gets the default permission of a given permission set.
  * 
- * @param {String} pPermSetId the id of the permission set
+ * @param {String} pSetId id of the permission set
  * 
- * @result {String} returns the id of the default permission of a given permission set. Never 'null', empty string if there is no result.
+ * @result {String} returns id of default permission of given set. Never 'null', empty string if there is no result.
  */
-    PermissionUtil.getDefaultPermission = function(pPermSetId) {
-        var sqlStr = "select ENTITY_ID from ASYS_PERMISSIONSET where ASYS_PERMISSIONSETID = '" + pPermSetId + "'";
+    PermissionUtil.getPermissionWithoutCond = function(pSetId) {
+        var sqlStr = "select ENTITY_ID from ASYS_PERMISSIONSET where ASYS_PERMISSIONSETID = '" + pSetId + "'";
         var entityName = db.cell(sqlStr, alias);
         var noCond = "{\"entity\":\"" + entityName + "\",\"filter\":{\"type\":\"group\",\"operator\":\"AND\",\"childs\":[]}}";
     
         sqlStr = "select ASYS_PERMISSIONID from ASYS_PERMISSION"
-        + " where ASYS_PERMISSIONSET_ID = '" + pPermSetId + "'"
+        + " where ASYS_PERMISSIONSET_ID = '" + pSetId + "'"
         + " and (COND is null or COND like '%" + noCond + "%')";
         return db.cell(sqlStr, alias);
     }
 
     /**
- * Gets the conditional permissions of a given permission set.
+ * Gets the permissions with conditions of a given permission set.
  * 
- * @param {String} pPermSetId the id of the permission set
+ * @param {String} pSetId the id of the permission set
  * 
- * @result {String[]} returns the ids of the conditional permissions of a given permission set. The result can never be null.
+ * @result {String[]} returns the ids of permissions with conditions of a given permission set. The result can never be null.
  */
-    PermissionUtil.getConditionalPermission = function(pPermSetId) {
-        var sqlStr = "select ENTITY_ID from ASYS_PERMISSIONSET where ASYS_PERMISSIONSETID = '" + pPermSetId + "'";
+    PermissionUtil.getPermissionWithCond = function(pSetId) {
+        var sqlStr = "select ENTITY_ID from ASYS_PERMISSIONSET where ASYS_PERMISSIONSETID = '" + pSetId + "'";
         var entityName = db.cell(sqlStr, alias);
         var noCond = "{\"entity\":\"" + entityName + "\",\"filter\":{\"type\":\"group\",\"operator\":\"AND\",\"childs\":[]}}";
     
         sqlStr = "select ASYS_PERMISSIONID from ASYS_PERMISSION"
-        + " where ASYS_PERMISSIONSET_ID = '" + pPermSetId + "'"
+        + " where ASYS_PERMISSIONSET_ID = '" + pSetId + "'"
         + " and COND is not null and COND not like '" + noCond + "'";
         return db.table(sqlStr, alias);
     }
 
-    /**
- * Gets the permission actions of a given permission.
- * 
- * @param {String} pPermId the id of the permission
- * 
- * @result {String[]} returns the ids of linked actions of a given permission. The result can never be null.
- */
-    PermissionUtil.getPermissionAction = function(pPermId) {
-        var sqlStr = "select ASYS_PERMISSIONACTIONID from ASYS_PERMISSIONACTION"
-        + " where ASYS_PERMISSION_ID = '" + pPermId + "'"
-        return db.table(sqlStr, alias);
-    }
-
     /**
  * Gets the permission set id of a given role-entity-accesstype-combination.
  * 
- * @param {String} pRole the name of the role
+ * @param {String} pRole name of the role
  * 
- * @param {String} pEntity the name of the entity
+ * @param {String} pEntity name of the entity
  * 
- * @param {String} pAccessType the name of the access type (E,R,F)
+ * @param {String} pAccessType name of the access type (E,R,F)
  * 
- * @param {String} pField the name of the field
+ * @param {String} pField name of the field
  * 
- * @result {String} returns the id of the matching permission set. The result can never be null.
+ * @result {String} returns id of the matching permission set. The result can never be null.
  */
-    PermissionUtil.getPermissionSet = function(pRole, pEntity, pAccessType, pField) {
+    PermissionUtil.getSet = function(pRole, pEntity, pAccessType, pField) {
         var sqlStr = "select ASYS_PERMISSIONSETID from ASYS_PERMISSIONSET"
         + " where ROLE_ID = '" + pRole + "' and ENTITY_ID = '" + pEntity + "' and ACCESSTYPE = '" + pAccessType + "'";
         if (pField != null && pField != "" && pField != undefined) {
@@ -328,13 +262,13 @@ function PermissionUtil () {}
     /**
  * Gets the root permission set of a entity-role-combination.
  * 
- * @param {String} pRole the id of a role
+ * @param {String} pRole id of a role
  * 
- * @param {String} pEntity the id of an entity
+ * @param {String} pEntity id of an entity
  * 
- * @result {String} returns the id of the root permission set of the given entity-role-combination. Never 'null', empty string if there is no result.
+ * @result {String} returns id of the root permission set of the given entity-role-combination. Never 'null', empty string if there is no result.
  */
-    PermissionUtil.getRootPermissionSet = function(pRole, pEntity) {
+    PermissionUtil.getSetRoot = function(pRole, pEntity) {
         var sqlStr = "select ASYS_PERMISSIONSETID from ASYS_PERMISSIONSET"
         + " where ROLE_ID = '" + pRole + "' and ENTITY_ID = '" + pEntity +"' and ACCESSTYPE = 'E'";
         return db.cell(sqlStr, alias);
@@ -343,27 +277,27 @@ function PermissionUtil () {}
     /**
  * Gets the parent permission set of a permission.
  * 
- * @param {String} pPermId the id of the permission
+ * @param {String} pPermId id of the permission
  * 
- * @result {String} returns the id of the parent permission set of the given permission. Never 'null', empty string if there is no result.
+ * @result {String} returns id of the parent set of the given permission. Never 'null', empty string if there is no result.
  */
-    PermissionUtil.getParentPermissionSet = function(pPermId) {
+    PermissionUtil.getParentSet = function(pPermId) {
         var sqlStr = "select ASYS_PERMISSIONSET_ID from ASYS_PERMISSION"
         + " where ASYS_PERMISSIONID = '" + pPermId + "'";
         return db.cell(sqlStr, alias);
     }
 
     /**
- * Checks if the given permission has any children left.
+ * Checks if the given permission set has any children left.
  * 
- * @param {String} pPermSetId the id of the permission set
+ * @param {String} pSetId id of the permission set
  * 
  * @result {Boolean} returns true if permission set has no children, otherwise false
  */
-    PermissionUtil.permSetIsEmpty = function(pPermSetId) {
-        var subSets = PermissionUtil.getAllChildPermissionSets(pPermSetId);
-        var subPerms = PermissionUtil.getAllChildPermissions(pPermSetId);
-        var subActions = PermissionUtil.getAllChildPermissionActions(pPermSetId);
+    PermissionUtil.setIsEmpty = function(pSetId) {
+        var subSets = PermissionUtil.getChildSetsOfSet(pSetId);
+        var subPerms = PermissionUtil.getPermissions(pSetId);
+        var subActions = PermissionUtil.getActionsOfSet(pSetId);
     
         if (subActions.length == 0 && subPerms == 0 && subSets == 0) 
             return true;
@@ -373,23 +307,28 @@ function PermissionUtil () {}
     /**
  * Returns all permissions of the given permission sets.
  * 
- * @param {String[]} pPermSetIds the ids of the permission sets
+ * @param {String[]} pSetIds the ids of the permission sets
  * 
- * @result {String[]} returns ids of all permissions. The result can never be null.
+ * @result {String[]} array with ids of all subordinated permissions. The result can never be null.
  */
-    PermissionUtil.getAllPermissions = function(pPermSetIds) {
-        return db.table("select ASYS_PERMISSIONID from ASYS_PERMISSION where ASYS_PERMISSION.ASYS_PERMISSIONSET_ID in ('" + pPermSetIds.join("','") + "')", alias);
+    PermissionUtil.getPermissions = function(pSetIds) {
+        return db.table("select ASYS_PERMISSIONID from ASYS_PERMISSION where ASYS_PERMISSION.ASYS_PERMISSIONSET_ID in ('" + pSetIds.join("','") + "')", alias);
     }
-
+    
     /**
- * Returns all permission actions of the given permissions.
+ * Returns all subordinated permissions of a given permission set.
  * 
- * @param {String[]} pPermIds the ids of the permissions
+ * @param {String} pSetId the id of the parent permission set
  * 
- * @result {String[]} returns ids of all permission actions. The result can never be null.
+ * @result {String[]} array with ids of all subordinated permission. The result can never be null.
  */
-    PermissionUtil.getAllPermissionActions = function(pPermIds) {
-        return db.table("select ASYS_PERMISSIONACTIONID from ASYS_PERMISSIONACTION where ASYS_PERMISSIONACTION.ASYS_PERMISSION_ID in ('" + pPermIds.join("','") + "')", alias);
+    PermissionUtil.getPermissions = function (pSetId)
+    {
+        return db.array(db.COLUMN, SqlCondition.begin()
+            .and("ASYS_PERMISSIONSET.ASYS_PERMISSIONSETID = '" + pSetId + "'")
+            .buildSql("select ASYS_PERMISSION.ASYS_PERMISSIONID from ASYS_PERMISSION"
+                + " join ASYS_PERMISSIONSET on ASYS_PERMISSIONSET.ASYS_PERMISSIONSETID = ASYS_PERMISSION.ASYS_PERMISSIONSET_ID")
+            , alias);
     }
 
     /**
@@ -402,45 +341,45 @@ function PermissionUtil () {}
     PermissionUtil.getPermissionCondType = function(pPermId) {
         return db.cell("select CONDTYPE from ASYS_PERMISSION where ASYS_PERMISSION.ASYS_PERMISSIONID = '" + pPermId + "'", alias);
     }
-
+    
     /**
  * Inserts a new instance of a permission set into ASYS_PERMISSIONSET.
  * 
- * @param {String} pParentPermSet The parent permission set, empty if root node
+ * @param {String} pParentPermSetId parent permission set, empty if root node
  * 
- * @param {String} pEntity The entity to which the PermissionSet is linked, mandatory
+ * @param {String} pEntity entity to which the PermissionSet is linked, mandatory
  * 
- * @param {String} pRole The Role to which the PermissionSet is linked, mandatory
+ * @param {String} pRole Role to which the PermissionSet is linked, mandatory
  * 
- * @param {String} pField The Field to which the PermissionSet is linked, empty if no field permission
+ * @param {String} pField Field to which the PermissionSet is linked, empty if no field permission
  * 
  * @param {String} pAccessType Entity, Record or Field (E, R, F), mandatory
  * 
- * @result {Integer} returns the id of the inserted permission set
+ * @result {Integer} returns id of the inserted permission set
  */
-    PermissionUtil.insertNewPermissionSet = function(pParentPermSet, pEntity, pRole, pField, pAccessType) {
+    PermissionUtil.insertSet = function(pParentPermSetId, pEntity, pRole, pField, pAccessType) {
         var table = "ASYS_PERMISSIONSET";
         var cols = db.getColumns(table, alias);
-        var permsetid = util.getNewUUID();
-        var vals = [pAccessType, permsetid, pParentPermSet, pEntity, pField, pRole];
+        var setId = util.getNewUUID();
+        var vals = [pAccessType, setId, pParentPermSetId, pEntity, pField, pRole];
         db.insertData(table, cols, null, vals, alias);
-        return permsetid;
+        return setId;
     }
 
     /**
  * Inserts a new instance of a permission into ASYS_PERMISSION.
  * 
- * @param {String} pParentPermSet The parent permission set, mandatory
+ * @param {String} pParentSetId parent permission set, mandatory
  * 
- * @param {String} pCond The condition of the permission, empty if no condition
+ * @param {String} pCond condition of the permission, empty if no condition
  * 
- * @param {String} pCondType The Condition Type of the permission, should nearly always be "true"
+ * @param {String} pCondType condition Type of the permission, should nearly always be "true"
  * 
- * @param {String} pPermId The id of the new permission (can be empty/null)
+ * @param {String} pPermId id of the new permission (can be empty/null)
  * 
- * @result {Integer} returns the id of the inserted permission
+ * @result {Integer} returns id of the inserted permission
  */
-    PermissionUtil.insertNewPermission = function(pParentPermSet, pCond, pCondType, pPermId) {
+    PermissionUtil.insertPermission = function(pParentSetId, pCond, pCondType, pPermId) {
         var table = "ASYS_PERMISSION";
         var cols = db.getColumns(table, alias);
         var permId;
@@ -449,7 +388,7 @@ function PermissionUtil () {}
         } else {
             permId = util.getNewUUID(); 
         }
-        var vals = [permId, pParentPermSet, pCond, pCondType];
+        var vals = [permId, pParentSetId, pCond, pCondType];
         db.insertData(table, cols, null, vals, alias);  
         return permId;
     }
@@ -457,42 +396,42 @@ function PermissionUtil () {}
     /**
  * Inserts a new instance of a permission action into ASYS_PERMISSIONACTION.
  * 
- * @param {String} pParentPerm The parent permission, mandatory
+ * @param {String} pParentPermId parent permission, mandatory
  * 
- * @param {String} pAction Action (view, create,...), mandatory
+ * @param {String} pAction title of action (view, create,...), mandatory
  * 
- * @param {String} pActionId The id of the new permission action
+ * @param {String} pActionId id of the new permission action
  * 
- * @result {Integer} returns the id of the inserted permission action, returns null if insert was not possible
+ * @result {Integer} returns id of the inserted permission action, returns null if insert was not possible
  */
-    PermissionUtil.insertNewPermissionAction = function(pParentPerm, pAction, pActionId) {
+    PermissionUtil.insertAction = function(pParentPermId, pAction, pActionId) {
         var table = "ASYS_PERMISSIONACTION";
         var cols = db.getColumns(table, alias);
-        var permactionid;
-        var sqlStr = "select ASYS_PERMISSIONACTIONID from ASYS_PERMISSIONACTION where ASYS_PERMISSIONACTIONID = '" + pActionId + "'"; // if same id is already in db -> create new UID
+        var actionId;
+        var sqlStr = "select ASYS_PERMISSIONACTIONID from ASYS_PERMISSIONACTION where ASYS_PERMISSIONACTIONID = '" + pActionId + "'";
 
         if (pActionId != null & pActionId != "" && pActionId != undefined && db.cell(sqlStr, alias) == "") {
-            permactionid = pActionId;
+            actionId = pActionId;
         } else {
-            permactionid = util.getNewUUID();
+            actionId = util.getNewUUID(); // if same id is already in db -> create new UID
         }
-        var vals = [pAction, permactionid, pParentPerm];
+        var vals = [pAction, actionId, pParentPermId];
         if (db.insertData(table, cols, null, vals, alias) == 0) {
             return null;
         }
-        return permactionid;
+        return actionId;
     }
 
     /**
      * Returns the cond type of a permission.
      * 
-     * @param {String} pPerm The permission, mandatory
+     * @param {String} pPermId id of the permission which condition type should be returned, mandatory
      * 
      * @result {Integer} returns the cond type of a permission
      */
-    PermissionUtil.getCondType = function(pPerm) {
+    PermissionUtil.getCondType = function(pPermId) {
         var table = "ASYS_PERMISSION";
-        var sqlStr = "select CONDTYPE from " + table + " where ASYS_PERMISSIONID = '" + pPerm + "'";
+        var sqlStr = "select CONDTYPE from " + table + " where ASYS_PERMISSIONID = '" + pPermId + "'";
         return db.cell(sqlStr, alias);
     }
 
@@ -503,7 +442,7 @@ function PermissionUtil () {}
      * 
      * @result {Boolean} true if permission exists, otherwise false
      */
-    PermissionUtil.existsPermission = function(pPermId) {
+    PermissionUtil.permissionExists = function(pPermId) {
         var table = "ASYS_PERMISSION";
         var sqlStr = "select COUNT(*) from " + table + " where ASYS_PERMISSIONID = '" + pPermId + "'";
         if (db.cell(sqlStr, alias) != "0") {
@@ -549,17 +488,17 @@ function PermissionUtil () {}
     /**
      * Returns permissionid of the permission with fitting parameters, otherwise returns empty string
      * 
-     * @param {String} pRole Name of the role
+     * @param {String} pRole name of the role
      * 
-     * @param {String} pEntity Name of the entity
+     * @param {String} pEntity name of the entity
      * 
-     * @param {String} pField Name of the field
+     * @param {String} pField name of the field
      * 
-     * @param {String} pAccesstype Accesstype (E,F,R)
+     * @param {String} pAccesstype accesstype (E,F,R)
      * 
-     * @param {String} pCondition The condition (Filter in JSON-format)
+     * @param {String} pCondition condition (Filter in JSON-format)
      * 
-     * @param {String} pCondtype Type of the condition (true/false)
+     * @param {String} pCondtype type of the condition (true/false)
      * 
      * @result {String} Returns the id of the permission with fitting parameters, otherwise returns empty string, can never be null
      *
@@ -596,13 +535,13 @@ function PermissionUtil () {}
     /**
      * Deletes a permission action from ASYS_PERMISSIONACTION.
      * 
-     * @param {String} pPermActionId The permission action id which should be deleted, mandatory
+     * @param {String} pActionId permission action id which should be deleted, mandatory
      * 
-     * @result {Integer} returns the number of deleted records
+     * @result {Integer} returns number of deleted records
      */
-    PermissionUtil.deletePermissionAction = function(pPermActionId) {
+    PermissionUtil.deleteAction = function(pActionId) {
         var table = "ASYS_PERMISSIONACTION";
-        var cond = " ASYS_PERMISSIONACTIONID = '" + pPermActionId + "'";
+        var cond = " ASYS_PERMISSIONACTIONID = '" + pActionId + "'";
         return db.deleteData(table, cond, alias);
     }
 
diff --git a/process/autostartNeon/process.js b/process/autostartNeon/process.js
index ff0ca7831fc..91769577801 100644
--- a/process/autostartNeon/process.js
+++ b/process/autostartNeon/process.js
@@ -29,8 +29,8 @@ for each (let entityMetaData in entitiesMetaData) {
         entitiesUsePermFlagSet.push(entityMetaData[0])
         if (PermissionUtil.getNumberOfPermissions(entityMetaData[0]) == 0) {
             // no permissions found for the given entity -> create permissionset for role INTERNAL_EVERYONE with five X's for view, create, read, update, delete         
-            var noAccessPermissionSetIdEntity = PermissionUtil.insertNewPermissionSet("", entityMetaData[0], roleInternalEveryone, "", "E");
-            PermissionUtil.insertNewPermission(noAccessPermissionSetIdEntity, "", "false"); // false is an indicator for PermissionDetails so the user can create a new PermissionSet on access level "E"
+            var noAccessPermissionSetIdEntity = PermissionUtil.insertSet("", entityMetaData[0], roleInternalEveryone, "", "E");
+            PermissionUtil.insertPermission(noAccessPermissionSetIdEntity, "", "false"); // false is an indicator for PermissionDetails so the user can create a new PermissionSet on access level "E"
         }
     }
 }
-- 
GitLab