From 2a152c3d7a9f504178be6b912e2141b5bf0aee10 Mon Sep 17 00:00:00 2001 From: Simon Leipold <s.leipold@adito.de> Date: Wed, 4 Mar 2020 11:21:08 +0100 Subject: [PATCH] [Projekt: Entwicklung - Neon][TicketNr.: 1053501][Berechtigungshierarchie - Anzeige von parent role] --- .../RoleChildren_entity.aod | 2 +- .../RoleParent_entity/RoleParent_entity.aod | 64 +++++++++++++++++++ .../recordcontainers/jdito/contentProcess.js | 31 +++++++++ entity/Role_entity/Role_entity.aod | 20 ++++++ .../children/roleid_param/valueProcess.js | 4 ++ neonContext/RoleParent/RoleParent.aod | 12 ++++ .../RoleParentList_view.aod | 25 ++++++++ .../RolePreview_view/RolePreview_view.aod | 5 ++ 8 files changed, 162 insertions(+), 1 deletion(-) create mode 100644 entity/RoleParent_entity/RoleParent_entity.aod create mode 100644 entity/RoleParent_entity/recordcontainers/jdito/contentProcess.js create mode 100644 entity/Role_entity/entityfields/roleparents/children/roleid_param/valueProcess.js create mode 100644 neonContext/RoleParent/RoleParent.aod create mode 100644 neonView/RoleParentList_view/RoleParentList_view.aod diff --git a/entity/RoleChildren_entity/RoleChildren_entity.aod b/entity/RoleChildren_entity/RoleChildren_entity.aod index e550842296e..78d1c42ce37 100644 --- a/entity/RoleChildren_entity/RoleChildren_entity.aod +++ b/entity/RoleChildren_entity/RoleChildren_entity.aod @@ -2,7 +2,7 @@ <entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.13" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.13"> <name>RoleChildren_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> - <title>Child</title> + <title>Child Role</title> <titlePlural>Child Roles</titlePlural> <recordContainer>jDito</recordContainer> <entityFields> diff --git a/entity/RoleParent_entity/RoleParent_entity.aod b/entity/RoleParent_entity/RoleParent_entity.aod new file mode 100644 index 00000000000..6bc86d355c0 --- /dev/null +++ b/entity/RoleParent_entity/RoleParent_entity.aod @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8"?> +<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.13" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.13"> + <name>RoleParent_entity</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <title>Parent Role</title> + <titlePlural>Parent Roles</titlePlural> + <recordContainer>jDito</recordContainer> + <entityFields> + <entityProvider> + <name>#PROVIDER</name> + </entityProvider> + <entityField> + <name>UID</name> + </entityField> + <entityField> + <name>CHILD_ROLE</name> + </entityField> + <entityField> + <name>PARENT_ROLE</name> + </entityField> + <entityConsumer> + <name>Roles</name> + <dependency> + <name>dependency</name> + <entityName>Role_entity</entityName> + <fieldName>Roles</fieldName> + </dependency> + </entityConsumer> + <entityProvider> + <name>RoleParents</name> + <recordContainer>jDito</recordContainer> + <dependencies> + <entityDependency> + <name>6aa59dd4-1193-47be-8b69-58c82a0d9daa</name> + <entityName>Role_entity</entityName> + <fieldName>RoleParents</fieldName> + <isConsumer v="false" /> + </entityDependency> + </dependencies> + </entityProvider> + <entityParameter> + <name>RoleId_param</name> + <expose v="true" /> + </entityParameter> + </entityFields> + <recordContainers> + <jDitoRecordContainer> + <name>jDito</name> + <jDitoRecordAlias>_____SYSTEMALIAS</jDitoRecordAlias> + <contentProcess>%aditoprj%/entity/RoleParent_entity/recordcontainers/jdito/contentProcess.js</contentProcess> + <recordFieldMappings> + <jDitoRecordFieldMapping> + <name>UID.value</name> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>CHILD_ROLE.value</name> + </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>PARENT_ROLE.value</name> + </jDitoRecordFieldMapping> + </recordFieldMappings> + </jDitoRecordContainer> + </recordContainers> +</entity> diff --git a/entity/RoleParent_entity/recordcontainers/jdito/contentProcess.js b/entity/RoleParent_entity/recordcontainers/jdito/contentProcess.js new file mode 100644 index 00000000000..69fc6b4cdf5 --- /dev/null +++ b/entity/RoleParent_entity/recordcontainers/jdito/contentProcess.js @@ -0,0 +1,31 @@ +import("Sql_lib"); +import("system.db"); +import("system.vars"); +import("system.result"); +import("system.util"); + +var alias = SqlUtils.getSystemAlias(); +var selectedRoleName = vars.exists("$param.RoleId_param") && vars.get("$param.RoleId_param"); +var parents = []; + +var parentRoles = newSelect("ID, PARENT_ROLE", alias) +.from("ASYS_ROLES_CHILDREN") +.where("ASYS_ROLES_CHILDREN.CHILD_ROLE", selectedRoleName) +.table(); + +for each (let parentRole in parentRoles) { + parents.push([parentRole[0], selectedRoleName, parentRole[1]]); +} + +var ids = vars.get("$local.idvalues"); +if (ids != null) { + parents = parents.filter(function(child) { + for (let i = 0; i < ids.length; i++) { + if (child[0] == ids[i]) + return true; + } + return false; + }); +} + +result.object(parents); \ No newline at end of file diff --git a/entity/Role_entity/Role_entity.aod b/entity/Role_entity/Role_entity.aod index 7011adb0597..023fd014ccb 100644 --- a/entity/Role_entity/Role_entity.aod +++ b/entity/Role_entity/Role_entity.aod @@ -83,6 +83,12 @@ <fieldName>Roles</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>23ceb9b3-429c-4381-9ae2-bd23d9d08d42</name> + <entityName>RoleParent_entity</entityName> + <fieldName>Roles</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> <children> <entityParameter> @@ -145,6 +151,20 @@ <onActionProcess>%aditoprj%/entity/Role_entity/entityfields/deleteeverythinglinkedtorole/onActionProcess.js</onActionProcess> <iconId>VAADIN:CLOSE</iconId> </entityActionField> + <entityConsumer> + <name>RoleParents</name> + <dependency> + <name>dependency</name> + <entityName>RoleParent_entity</entityName> + <fieldName>RoleParents</fieldName> + </dependency> + <children> + <entityParameter> + <name>RoleId_param</name> + <valueProcess>%aditoprj%/entity/Role_entity/entityfields/roleparents/children/roleid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> </entityFields> <recordContainers> <jDitoRecordContainer> diff --git a/entity/Role_entity/entityfields/roleparents/children/roleid_param/valueProcess.js b/entity/Role_entity/entityfields/roleparents/children/roleid_param/valueProcess.js new file mode 100644 index 00000000000..f1e485c836f --- /dev/null +++ b/entity/Role_entity/entityfields/roleparents/children/roleid_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.result"); +import("system.vars"); + +result.string(vars.get("$field.ROLENAME")); \ No newline at end of file diff --git a/neonContext/RoleParent/RoleParent.aod b/neonContext/RoleParent/RoleParent.aod new file mode 100644 index 00000000000..3745dca840e --- /dev/null +++ b/neonContext/RoleParent/RoleParent.aod @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.1"> + <name>RoleParent</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <entity>RoleParent_entity</entity> + <references> + <neonViewReference> + <name>41ee2c63-4408-4aba-bc22-75465fc94c47</name> + <view>RoleParentList_view</view> + </neonViewReference> + </references> +</neonContext> diff --git a/neonView/RoleParentList_view/RoleParentList_view.aod b/neonView/RoleParentList_view/RoleParentList_view.aod new file mode 100644 index 00000000000..c7aba2fb60e --- /dev/null +++ b/neonView/RoleParentList_view/RoleParentList_view.aod @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.4" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.4"> + <name>RoleParentList_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <titledListViewTemplate> + <name>TitledList</name> + <entityField>#ENTITY</entityField> + <isDeletable v="false" /> + <isEditable v="false" /> + <isCreatable v="false" /> + <columns> + <neonTitledListTableColumn> + <name>cdc83256-2ea4-4a97-a323-b400a4037915</name> + <entityField>PARENT_ROLE</entityField> + </neonTitledListTableColumn> + </columns> + </titledListViewTemplate> + </children> +</neonView> diff --git a/neonView/RolePreview_view/RolePreview_view.aod b/neonView/RolePreview_view/RolePreview_view.aod index b8c3a44f1fc..20d727f478e 100644 --- a/neonView/RolePreview_view/RolePreview_view.aod +++ b/neonView/RolePreview_view/RolePreview_view.aod @@ -32,5 +32,10 @@ <entityField>RoleChildrens</entityField> <view>RoleChildrenList_view</view> </neonViewReference> + <neonViewReference> + <name>c13ad88f-679d-4cd5-a7ce-747d43ff7629</name> + <entityField>RoleParents</entityField> + <view>RoleParentList_view</view> + </neonViewReference> </children> </neonView> -- GitLab