diff --git a/.liquibase/Data_alias/basic/2020.1.0/PermissionCalendar/changelog.xml b/.liquibase/Data_alias/basic/2020.1.0/PermissionCalendar/changelog.xml new file mode 100644 index 0000000000000000000000000000000000000000..a540df4133f075253af4f320df41731fd201be46 --- /dev/null +++ b/.liquibase/Data_alias/basic/2020.1.0/PermissionCalendar/changelog.xml @@ -0,0 +1,7 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> +<include file="create_ab_permissioncalendar.xml" relativeToChangelogFile="true"/> +<include file="init_PermissionCalendarCategory.xml" relativeToChangelogFile="true"/> +<include file="init_PermissionCalendarType.xml" relativeToChangelogFile="true"/> +</databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/2020.1.0/PermissionCalendar/create_ab_permissioncalendar.xml b/.liquibase/Data_alias/basic/2020.1.0/PermissionCalendar/create_ab_permissioncalendar.xml new file mode 100644 index 0000000000000000000000000000000000000000..f5377c624122404948ce962c615a2867874de56b --- /dev/null +++ b/.liquibase/Data_alias/basic/2020.1.0/PermissionCalendar/create_ab_permissioncalendar.xml @@ -0,0 +1,24 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + <changeSet author="s.pongratz" id="fbe17fba-5bf7-4203-8f6f-51723e07654c"> + <createTable tableName="AB_PERMISSIONCALENDAR"> + <column name="AB_PERMISSIONCALENDARID" type="CHAR(36)"> + <constraints primaryKey="true" primaryKeyName="PK_AB_PERMISSIONCALENDAR_ID"/> + </column> + <column name="USER_NEW" type="NVARCHAR(50)"> + <constraints nullable="false"/> + </column> + <column name="DATE_NEW" type="DATETIME"> + <constraints nullable="false"/> + </column> + <column name="USER_EDIT" type="NVARCHAR(50)" /> + <column name="DATE_EDIT" type="DATETIME"/> + + <column name="PERMISSIONDEALER_ROWID" type="CHAR(36)"/> + <column name="PERMISSIONDEALER_TYPE" type="VARCHAR(36)"/> + <column name="PERMISSIONPROCURER_ROWID" type="CHAR(36)"/> + <column name="PERMISSIONPROCURER_TYPE" type="VARCHAR(36)"/> + <column name="PERMISSION" type="VARCHAR(36)"/> + </createTable> + </changeSet> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2020.1.0/PermissionCalendar/init_PermissionCalendarCategory.xml b/.liquibase/Data_alias/basic/2020.1.0/PermissionCalendar/init_PermissionCalendarCategory.xml new file mode 100644 index 0000000000000000000000000000000000000000..dafd18910fe5c0500a2a9c843e2d834b53b85665 --- /dev/null +++ b/.liquibase/Data_alias/basic/2020.1.0/PermissionCalendar/init_PermissionCalendarCategory.xml @@ -0,0 +1,42 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + <changeSet author="s.pongratz" id="b2394de0-4a19-4fcb-9412-0a5e91bfec82"> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="c5f3cae8-06b3-4db3-8c7e-80f16e6d080e"/> + <column name="KEYID" value="NOTHING"/> + <column name="TITLE" value="NoPermissions"/> + <column name="CONTAINER" value="PermissionCalendarCategory"/> + <column name="SORTING" valueNumeric="0"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="1"/> + </insert> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="c2624c60-cb07-44f2-80b1-fbb86932df72"/> + <column name="KEYID" value="LIMITEDREAD"/> + <column name="TITLE" value="LimitedReadPermission"/> + <column name="CONTAINER" value="PermissionCalendarCategory"/> + <column name="SORTING" valueNumeric="1"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="1"/> + </insert> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="64546657-843b-4cb4-a6b8-4d34548e1c97"/> + <column name="KEYID" value="FULLREAD"/> + <column name="TITLE" value="ReadPermission"/> + <column name="CONTAINER" value="PermissionCalendarCategory"/> + <column name="SORTING" valueNumeric="2"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="1"/> + </insert> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="64546657-843b-4cb4-a6b8-4d34548e1c98"/> + <column name="KEYID" value="READWRITE"/> + <column name="TITLE" value="ReadWritePermission"/> + <column name="CONTAINER" value="PermissionCalendarCategory"/> + <column name="SORTING" valueNumeric="3"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="1"/> + </insert> + </changeSet> +</databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/2020.1.0/PermissionCalendar/init_PermissionCalendarType.xml b/.liquibase/Data_alias/basic/2020.1.0/PermissionCalendar/init_PermissionCalendarType.xml new file mode 100644 index 0000000000000000000000000000000000000000..f1f01ea6669863e4aa9f8e668e456a65aa5c5bbd --- /dev/null +++ b/.liquibase/Data_alias/basic/2020.1.0/PermissionCalendar/init_PermissionCalendarType.xml @@ -0,0 +1,24 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + <changeSet author="s.pongratz" id="b2894de0-4a19-4fcb-9412-0a5e91bfec80"> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="b6618b25-ec10-413f-9048-a5d8e792d161"/> + <column name="KEYID" value="USER"/> + <column name="TITLE" value="User"/> + <column name="CONTAINER" value="PermissionCalendarType"/> + <column name="SORTING" valueNumeric="0"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="1"/> + </insert> + <insert tableName="AB_KEYWORD_ENTRY"> + <column name="AB_KEYWORD_ENTRYID" value="45738bd4-1d7f-46b1-a863-93d183bbd238"/> + <column name="KEYID" value="DEPARTMENT"/> + <column name="TITLE" value="Deparment"/> + <column name="CONTAINER" value="PermissionCalendarType"/> + <column name="SORTING" valueNumeric="1"/> + <column name="ISACTIVE" valueNumeric="1"/> + <column name="ISESSENTIAL" valueNumeric="1"/> + </insert> + </changeSet> +</databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/2020.1.0/changelog.xml b/.liquibase/Data_alias/basic/2020.1.0/changelog.xml new file mode 100644 index 0000000000000000000000000000000000000000..6fb85b0d197b8f40128a75aca8f6df26dff2c4af --- /dev/null +++ b/.liquibase/Data_alias/basic/2020.1.0/changelog.xml @@ -0,0 +1,5 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> +<include file="PermissionCalendarCategory/changelog.xml" relativeToChangelogFile="true"/> +</databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/init/init.xml b/.liquibase/Data_alias/basic/init/init.xml index e876310e9ee3b12d48593794ad3b6a32af0856c1..63de8259d96e971965d6af18b003e8753846607c 100644 --- a/.liquibase/Data_alias/basic/init/init.xml +++ b/.liquibase/Data_alias/basic/init/init.xml @@ -9,6 +9,7 @@ <include relativeToChangelogFile="true" file="struct/AditoBasic/create_ab_keyword_attributerelation.xml"/> <include relativeToChangelogFile="true" file="struct/AditoBasic/create_ab_countryinfo.xml"/> <include relativeToChangelogFile="true" file="struct/AditoBasic/create_ab_language.xml"/> + <include relativeToChangelogFile="true" file="struct/AditoBasic/create_ab_permissioncalendar.xml"/> <include relativeToChangelogFile="true" file="struct/create_person.xml"/> <include relativeToChangelogFile="true" file="struct/create_organisation.xml"/> diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod index 174d1c8fb07cfe35c6906811afe60703d3542102..a2ce46565fd4c03e9f6cc048de6386cd35ceda00 100644 --- a/aliasDefinition/Data_alias/Data_alias.aod +++ b/aliasDefinition/Data_alias/Data_alias.aod @@ -13568,6 +13568,166 @@ </entityFieldDb> </entityFields> </entityDb> + <entityDb> + <name>AB_PERMISSIONCALENDAR</name> + <dbName></dbName> + <idColumn>AB_PERMISSIONCALENDARID</idColumn> + <idGeneratorType v="0" /> + <idGeneratorInterval v="1" /> + <documentation></documentation> + <title></title> + <description></description> + <auditSyncConfig> + <name>auditSyncConfig</name> + <auditMode v="0" /> + <syncActive v="false" /> + <syncComplete v="true" /> + <syncDirection v="1" /> + <syncIds></syncIds> + </auditSyncConfig> + <entityFields> + <entityFieldDb> + <name>PERMISSION</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="1" /> + <size v="36" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>PERMISSIONPROCURER_TYPE</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="36" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>DATE_EDIT</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="93" /> + <size v="29" /> + <scale v="9" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>AB_PERMISSIONCALENDARID</name> + <dbName></dbName> + <primaryKey v="true" /> + <columnType v="1" /> + <size v="36" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="true" /> + <index v="true" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>DATE_NEW</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="93" /> + <size v="29" /> + <scale v="9" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>USER_NEW</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="50" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>PERMISSIONPROCURER_ROWID</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="1" /> + <size v="36" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>PERMISSIONDEALER_ROWID</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="1" /> + <size v="36" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>USER_EDIT</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="50" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + <entityFieldDb> + <name>PERMISSIONDEALER_TYPE</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="36" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> + </entityFields> + </entityDb> </entities> </entityGroup> </aliasDefDb> diff --git a/application/_____SYSTEM_APPLICATION_NEON/_____SYSTEM_APPLICATION_NEON.aod b/application/_____SYSTEM_APPLICATION_NEON/_____SYSTEM_APPLICATION_NEON.aod index c3a59408200b7569d0601c10b5e353f2b457c4b9..1d89f0af72e0c2173db0bbd4112fb9ee481c7105 100644 --- a/application/_____SYSTEM_APPLICATION_NEON/_____SYSTEM_APPLICATION_NEON.aod +++ b/application/_____SYSTEM_APPLICATION_NEON/_____SYSTEM_APPLICATION_NEON.aod @@ -42,6 +42,27 @@ </entityNode> </childNodes> </entityNode> + <entityNode> + <name>Group</name> + <kind v="123" /> + <title>Permissions</title> + <childNodes> + <entityNode> + <name>Group5</name> + <kind v="123" /> + <childNodes> + <entityNode> + <name>INTERNAL_EVERYONE</name> + <kind v="159" /> + </entityNode> + <entityNode> + <name>PermissionCalendar</name> + <kind v="10077" /> + </entityNode> + </childNodes> + </entityNode> + </childNodes> + </entityNode> <entityNode> <name>Sales</name> <kind v="123" /> diff --git a/entity/Attribute_entity/Attribute_entity.aod b/entity/Attribute_entity/Attribute_entity.aod index d8ffe836b1d5fcfd228a6a3fe87fc882e64d3b46..8e78193ff5ea2723e1e42b72512e6fc7cfe3d41f 100644 --- a/entity/Attribute_entity/Attribute_entity.aod +++ b/entity/Attribute_entity/Attribute_entity.aod @@ -151,6 +151,12 @@ <fieldName>Departments</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>f31eceb3-2fcc-4298-8c5d-1076433e2c2a</name> + <entityName>PermissionCalendar_entity</entityName> + <fieldName>Departments</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> <children> <entityParameter> @@ -375,6 +381,11 @@ <expose v="true" /> <description>parent id that is used to preset the parent when the action newChildAttribute is used</description> </entityParameter> + <entityParameter> + <name>IncludeParentRecord_param</name> + <expose v="true" /> + <documentation>%aditoprj%/entity/Attribute_entity/entityfields/includeparentrecord_param/documentation.adoc</documentation> + </entityParameter> </entityFields> <recordContainers> <jDitoRecordContainer> diff --git a/entity/Attribute_entity/entityfields/includeparentrecord_param/documentation.adoc b/entity/Attribute_entity/entityfields/includeparentrecord_param/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..73ae270215270d1f0ca5a39e787ffad0f9a8140f --- /dev/null +++ b/entity/Attribute_entity/entityfields/includeparentrecord_param/documentation.adoc @@ -0,0 +1,8 @@ += Parameter IncludeParentRecord_param + +== Usage +If the record of the passed parent ID should be added, this param must be set as true. + +== Possible Values +* true +* false \ No newline at end of file diff --git a/entity/Attribute_entity/recordcontainers/jdito/contentProcess.js b/entity/Attribute_entity/recordcontainers/jdito/contentProcess.js index fc2e0041d563fcf75bc210d954e8cf4247ad731f..2db6fc3da92b0707cb73c6c480ce2aa0df02be3c 100644 --- a/entity/Attribute_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/Attribute_entity/recordcontainers/jdito/contentProcess.js @@ -21,6 +21,7 @@ var displaySimpleName = vars.get("$param.DisplaySimpleName_param"); var themeObjectRowId = vars.get("$param.ThemeObjectRowId_param"); var parentId = vars.get("$param.ParentId_param"); +var includeParentRecord = vars.get("$param.IncludeParentRecord_param"); var fetchUsages = false; var translateName = false; @@ -60,6 +61,8 @@ var emptyResult = function () { condition.and("AB_ATTRIBUTE.AB_ATTRIBUTEID", AttributeUtil.getAllChildren(parentId), SqlBuilder.IN()); translateName = true; + if(includeParentRecord == "true") + condition.or("AB_ATTRIBUTE.AB_ATTRIBUTEID", parentId); } else { diff --git a/entity/Employee_entity/Employee_entity.aod b/entity/Employee_entity/Employee_entity.aod index 02dd23fc479b26facfb2dd620d47660db1dabb5e..dd20915b9f3a31053421416f69e276e664a507e2 100644 --- a/entity/Employee_entity/Employee_entity.aod +++ b/entity/Employee_entity/Employee_entity.aod @@ -334,8 +334,29 @@ <fieldName>Employees</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>4dad4b91-52ae-4263-9587-3b45101444fd</name> + <entityName>PermissionCalendar_entity</entityName> + <fieldName>User</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> </entityProvider> + <entityConsumer> + <name>Permissions</name> + <refreshParent v="false" /> + <dependency> + <name>dependency</name> + <entityName>PermissionCalendar_entity</entityName> + <fieldName>Permissions</fieldName> + </dependency> + <children> + <entityParameter> + <name>PermissionProcurer_param</name> + <valueProcess>%aditoprj%/entity/Employee_entity/entityfields/permissions/children/permissionprocurer_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> </entityFields> <recordContainers> <jDitoRecordContainer> diff --git a/entity/Employee_entity/entityfields/permissions/children/permissionprocurer_param/valueProcess.js b/entity/Employee_entity/entityfields/permissions/children/permissionprocurer_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..c015412b90a7b36aca64f91d7a666d4becc93c7a --- /dev/null +++ b/entity/Employee_entity/entityfields/permissions/children/permissionprocurer_param/valueProcess.js @@ -0,0 +1,7 @@ +import("system.logging"); +import("system.vars"); +import("system.result"); + +let uid = vars.get("$field.UID"); +if (uid) + result.string(vars.get("$field.UID")); \ No newline at end of file diff --git a/entity/KeywordEntry_entity/KeywordEntry_entity.aod b/entity/KeywordEntry_entity/KeywordEntry_entity.aod index ac8b92004d8de9a65a8bd9af3a14d25eed1fc569..42e97867f0e1f6c792346f8e833fcda4be12c18e 100644 --- a/entity/KeywordEntry_entity/KeywordEntry_entity.aod +++ b/entity/KeywordEntry_entity/KeywordEntry_entity.aod @@ -559,6 +559,18 @@ <fieldName>TriggerKeyword</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>79bdbc02-19dc-4ecc-a91f-d657bda6f6cd</name> + <entityName>PermissionCalendar_entity</entityName> + <fieldName>KeywordPermissionCalendarCategories</fieldName> + <isConsumer v="false" /> + </entityDependency> + <entityDependency> + <name>8c5b1d49-f0b5-4a7c-9bff-02165996e11b</name> + <entityName>PermissionCalendar_entity</entityName> + <fieldName>KeywordPermissionCalendarTypes</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> <children> <entityParameter> diff --git a/entity/PermissionCalendar_entity/PermissionCalendar_entity.aod b/entity/PermissionCalendar_entity/PermissionCalendar_entity.aod new file mode 100644 index 0000000000000000000000000000000000000000..51ed71f784d5ab8c7f801ad9dd2f022732be0c9a --- /dev/null +++ b/entity/PermissionCalendar_entity/PermissionCalendar_entity.aod @@ -0,0 +1,271 @@ +<?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>PermissionCalendar_entity</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <title>Calendar Permission</title> + <grantCreate v="true" /> + <grantDelete v="true" /> + <contentTitleProcess>%aditoprj%/entity/PermissionCalendar_entity/contentTitleProcess.js</contentTitleProcess> + <onValidation>%aditoprj%/entity/PermissionCalendar_entity/onValidation.js</onValidation> + <recordContainer>permissionCalendarDb</recordContainer> + <entityFields> + <entityProvider> + <name>#PROVIDER</name> + </entityProvider> + <entityField> + <name>PERMISSION</name> + <title>permission</title> + <consumer>KeywordPermissionCalendarCategories</consumer> + <groupable v="true" /> + <mandatory v="true" /> + <displayValueProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/permission/displayValueProcess.js</displayValueProcess> + </entityField> + <entityField> + <name>AB_PERMISSIONCALENDARID</name> + <title>ID</title> + <mandatory v="false" /> + </entityField> + <entityConsumer> + <name>KeywordPermissionCalendarCategories</name> + <dependency> + <name>dependency</name> + <entityName>KeywordEntry_entity</entityName> + <fieldName>SpecificContainerKeywords</fieldName> + </dependency> + <children> + <entityParameter> + <name>ContainerName_param</name> + <valueProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/keywordpermissioncalendarcategories/children/containername_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityField> + <name>USER_NEW</name> + <mandatory v="false" /> + <valueProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/user_new/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>USER_EDIT</name> + <valueProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/user_edit/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>DATE_NEW</name> + <contentType>DATE</contentType> + <resolution>SECOND</resolution> + <mandatory v="false" /> + <valueProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/date_new/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>DATE_EDIT</name> + <contentType>DATE</contentType> + <resolution>SECOND</resolution> + <valueProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/date_edit/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>PERMISSIONDEALER_USER_ROWID</name> + <title>Permission Dealer User</title> + <consumer>User</consumer> + <mandatory v="false" /> + <mandatoryProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/permissiondealer_user_rowid/mandatoryProcess.js</mandatoryProcess> + <textInputAllowed v="false" /> + <stateProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/permissiondealer_user_rowid/stateProcess.js</stateProcess> + <displayValueProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/permissiondealer_user_rowid/displayValueProcess.js</displayValueProcess> + <onValueChange>%aditoprj%/entity/PermissionCalendar_entity/entityfields/permissiondealer_user_rowid/onValueChange.js</onValueChange> + </entityField> + <entityField> + <name>PERMISSIONDEALER_TYPE</name> + <title>permission dealer type</title> + <consumer>KeywordPermissionCalendarTypes</consumer> + <groupable v="true" /> + <mandatory v="true" /> + <valueProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/permissiondealer_type/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/permissiondealer_type/displayValueProcess.js</displayValueProcess> + </entityField> + <entityField> + <name>PERMISSIONPROCURER_ROWID</name> + <title>Permission procurer</title> + <consumer></consumer> + <mandatory v="true" /> + <state>READONLY</state> + <valueProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/permissionprocurer_rowid/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/permissionprocurer_rowid/displayValueProcess.js</displayValueProcess> + </entityField> + <entityField> + <name>PERMISSIONPROCURER_TYPE</name> + <title>permission procurer type</title> + <consumer>KeywordPermissionCalendarTypes</consumer> + <mandatory v="true" /> + <valueProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/permissionprocurer_type/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/permissionprocurer_type/displayValueProcess.js</displayValueProcess> + </entityField> + <entityActionGroup> + <name>AddActions</name> + <title>AddAction</title> + <description></description> + <children> + <entityActionField> + <name>addNewUserPermissionDealerAction</name> + <title>Add new User Permission</title> + <onActionProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/addactions/children/addnewuserpermissiondealeraction/onActionProcess.js</onActionProcess> + <isMenuAction v="true" /> + <isObjectAction v="false" /> + <isSelectionAction v="false" /> + <state>AUTO</state> + <tooltip></tooltip> + </entityActionField> + <entityActionField> + <name>addNewDepartmentPermissionDealterAction</name> + <title>Add new Department Permission</title> + <onActionProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/addactions/children/addnewdepartmentpermissiondealteraction/onActionProcess.js</onActionProcess> + <isObjectAction v="false" /> + <state>AUTO</state> + </entityActionField> + </children> + </entityActionGroup> + <entityProvider> + <name>Permissions</name> + <dependencies> + <entityDependency> + <name>5bf53339-4c8d-4285-8af2-2aead61d3e38</name> + <entityName>Employee_entity</entityName> + <fieldName>Permissions</fieldName> + <isConsumer v="false" /> + </entityDependency> + </dependencies> + </entityProvider> + <entityParameter> + <name>PermissionProcurer_param</name> + <expose v="true" /> + <mandatory v="true" /> + </entityParameter> + <entityParameter> + <name>PermissionDealerType_param</name> + <expose v="true" /> + </entityParameter> + <entityField> + <name>PERMISSIONDEALER_DEPARTMENT_ROWID</name> + <title>Permission Dealer Department</title> + <consumer>Departments</consumer> + <mandatoryProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/permissiondealer_department_rowid/mandatoryProcess.js</mandatoryProcess> + <stateProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/permissiondealer_department_rowid/stateProcess.js</stateProcess> + <displayValueProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/permissiondealer_department_rowid/displayValueProcess.js</displayValueProcess> + <onValueChange>%aditoprj%/entity/PermissionCalendar_entity/entityfields/permissiondealer_department_rowid/onValueChange.js</onValueChange> + </entityField> + <entityConsumer> + <name>Departments</name> + <dependency> + <name>dependency</name> + <entityName>Attribute_entity</entityName> + <fieldName>SpecificAttribute</fieldName> + </dependency> + <children> + <entityParameter> + <name>ParentId_param</name> + <valueProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/departments/children/parentid_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>IncludeParentRecord_param</name> + <valueProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/departments/children/includeparentrecord_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + <entityConsumer> + <name>User</name> + <dependency> + <name>dependency</name> + <entityName>Employee_entity</entityName> + <fieldName>EmployeesByUserId</fieldName> + </dependency> + </entityConsumer> + <entityField> + <name>permissionDealer_rowId</name> + <title>Permission Dealer</title> + <displayValueProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/permissiondealer_rowid/displayValueProcess.js</displayValueProcess> + </entityField> + <entityField> + <name>permissionIcon</name> + <contentType>IMAGE</contentType> + <displayValueProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/permissionicon/displayValueProcess.js</displayValueProcess> + </entityField> + <entityConsumer> + <name>KeywordPermissionCalendarTypes</name> + <dependency> + <name>dependency</name> + <entityName>KeywordEntry_entity</entityName> + <fieldName>SpecificContainerKeywords</fieldName> + </dependency> + <children> + <entityParameter> + <name>ContainerName_param</name> + <valueProcess>%aditoprj%/entity/PermissionCalendar_entity/entityfields/keywordpermissioncalendartypes/children/containername_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> + </entityFields> + <recordContainers> + <dbRecordContainer> + <name>permissionCalendarDb</name> + <alias>Data_alias</alias> + <conditionProcess>%aditoprj%/entity/PermissionCalendar_entity/recordcontainers/permissioncalendardb/conditionProcess.js</conditionProcess> + <linkInformation> + <linkInformation> + <name>6df4271e-d95f-4526-bdcc-7f127f0f1b31</name> + <tableName>AB_PERMISSIONCALENDAR</tableName> + <primaryKey>AB_PERMISSIONCALENDARID</primaryKey> + <isUIDTable v="true" /> + <readonly v="false" /> + </linkInformation> + </linkInformation> + <recordFieldMappings> + <dbRecordFieldMapping> + <name>AB_PERMISSIONCALENDARID.value</name> + <recordfield>AB_PERMISSIONCALENDAR.AB_PERMISSIONCALENDARID</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>DATE_EDIT.value</name> + <recordfield>AB_PERMISSIONCALENDAR.DATE_EDIT</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>DATE_NEW.value</name> + <recordfield>AB_PERMISSIONCALENDAR.DATE_NEW</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>PERMISSION.value</name> + <recordfield>AB_PERMISSIONCALENDAR.PERMISSION</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>PERMISSIONDEALER_TYPE.value</name> + <recordfield>AB_PERMISSIONCALENDAR.PERMISSIONDEALER_TYPE</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>PERMISSIONPROCURER_ROWID.value</name> + <recordfield>AB_PERMISSIONCALENDAR.PERMISSIONPROCURER_ROWID</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>PERMISSIONPROCURER_TYPE.value</name> + <recordfield>AB_PERMISSIONCALENDAR.PERMISSIONPROCURER_TYPE</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>USER_EDIT.value</name> + <recordfield>AB_PERMISSIONCALENDAR.USER_EDIT</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>USER_NEW.value</name> + <recordfield>AB_PERMISSIONCALENDAR.USER_NEW</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>PERMISSIONDEALER_DEPARTMENT_ROWID.value</name> + <recordfield>AB_PERMISSIONCALENDAR.PERMISSIONDEALER_ROWID</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>PERMISSIONDEALER_USER_ROWID.value</name> + <recordfield>AB_PERMISSIONCALENDAR.PERMISSIONDEALER_ROWID</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>permissionDealer_rowId.value</name> + <recordfield>AB_PERMISSIONCALENDAR.PERMISSIONDEALER_ROWID</recordfield> + </dbRecordFieldMapping> + </recordFieldMappings> + </dbRecordContainer> + </recordContainers> +</entity> diff --git a/entity/PermissionCalendar_entity/contentTitleProcess.js b/entity/PermissionCalendar_entity/contentTitleProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..61ebe9e0f86fccd8a3f8bce395660d448ce878e3 --- /dev/null +++ b/entity/PermissionCalendar_entity/contentTitleProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$field.PERMISSIONPROCURER_ROWID.displayValue")); diff --git a/entity/PermissionCalendar_entity/entityfields/addactions/children/addnewdepartmentpermissiondealteraction/onActionProcess.js b/entity/PermissionCalendar_entity/entityfields/addactions/children/addnewdepartmentpermissiondealteraction/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..b166f07e6076baf36c9054f00fe319771b7e81df --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/addactions/children/addnewdepartmentpermissiondealteraction/onActionProcess.js @@ -0,0 +1,7 @@ +import("PermissionCalendar_lib"); +import("system.vars"); +import("system.neon"); + +var params = {}; +params["PermissionDealerType_param"] = PermissionCalendar.objectTypeDepartment(); +neon.openContext("PermissionCalendar", null, null, neon.OPERATINGSTATE_NEW, params); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/addactions/children/addnewuserpermissiondealeraction/onActionProcess.js b/entity/PermissionCalendar_entity/entityfields/addactions/children/addnewuserpermissiondealeraction/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7431921761982a7df99a6fa3dc2d2028dfecdc53 --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/addactions/children/addnewuserpermissiondealeraction/onActionProcess.js @@ -0,0 +1,7 @@ +import("PermissionCalendar_lib"); +import("system.vars"); +import("system.neon"); + +var params = {}; +params["PermissionDealerType_param"] = PermissionCalendar.objectTypeUser(); +neon.openContext("PermissionCalendar", null, null, neon.OPERATINGSTATE_NEW, params); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/date_edit/valueProcess.js b/entity/PermissionCalendar_entity/entityfields/date_edit/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7f3561fdc6e871135ac930bafd4642862a5a2af0 --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/date_edit/valueProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("system.neon"); +import("system.vars"); + +if(vars.get("$this.value") == null && vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) + result.string(vars.get("$sys.date")); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/date_new/valueProcess.js b/entity/PermissionCalendar_entity/entityfields/date_new/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..d1d209015373e827dc46465fd4582d9f82b9fe1f --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/date_new/valueProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("system.neon"); +import("system.vars"); + +if(vars.get("$this.value") == null && vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) + result.string(vars.get("$sys.date")); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/departments/children/includeparentrecord_param/valueProcess.js b/entity/PermissionCalendar_entity/entityfields/departments/children/includeparentrecord_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..d3ed7d447b6582533c41340415c08d9f97fbf001 --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/departments/children/includeparentrecord_param/valueProcess.js @@ -0,0 +1,2 @@ +import("system.result"); +result.string("true"); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/departments/children/parentid_param/valueProcess.js b/entity/PermissionCalendar_entity/entityfields/departments/children/parentid_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..246beece1e0537e3649fa0eeda40218eaa852864 --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/departments/children/parentid_param/valueProcess.js @@ -0,0 +1,4 @@ +import("AttributeRegistry_basic"); +import("system.result"); + +result.string($AttributeRegistry.departments()); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/keywordpermissioncalendarcategories/children/containername_param/valueProcess.js b/entity/PermissionCalendar_entity/entityfields/keywordpermissioncalendarcategories/children/containername_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7f169e4a01eab65a7d360d37af626c98fc83a40c --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/keywordpermissioncalendarcategories/children/containername_param/valueProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); +import("PermissionCalendar_lib"); + +result.string($KeywordRegistry.permissionCalendarCategory()); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/keywordpermissioncalendartypes/children/containername_param/valueProcess.js b/entity/PermissionCalendar_entity/entityfields/keywordpermissioncalendartypes/children/containername_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7b3bbd96159aefb57a7452c06095be57c9cb97bf --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/keywordpermissioncalendartypes/children/containername_param/valueProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); +import("PermissionCalendar_lib"); + +result.string($KeywordRegistry.permissionCalendarType()); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/permission/displayValueProcess.js b/entity/PermissionCalendar_entity/entityfields/permission/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..d2506a4c85f2f3e94dd0b7cb7ef5fc8fbd7a611f --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/permission/displayValueProcess.js @@ -0,0 +1,7 @@ +import("system.translate"); +import("system.result"); +import("system.vars"); +import("PermissionCalendar_lib"); + +let permission = vars.get("$field.PERMISSION"); +result.string(translate.text(PermissionCalendar.getPermissionDisplay(permission))); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/permissiondealer_department_rowid/displayValueProcess.js b/entity/PermissionCalendar_entity/entityfields/permissiondealer_department_rowid/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..c4b4b4cab57acc8b94bfb794ded2381049d81d41 --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/permissiondealer_department_rowid/displayValueProcess.js @@ -0,0 +1,6 @@ +import("system.vars"); +import("system.result"); + +let display = vars.get("$field.permissionDealer_rowId.displayValue"); +if(display != "undefined") + result.string(vars.get("$field.permissionDealer_rowId.displayValue")); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/permissiondealer_department_rowid/mandatoryProcess.js b/entity/PermissionCalendar_entity/entityfields/permissiondealer_department_rowid/mandatoryProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..a31a0c05ccd129b0e66e4adf986c53451b53fece --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/permissiondealer_department_rowid/mandatoryProcess.js @@ -0,0 +1,8 @@ +import("system.vars"); +import("system.result"); +import("PermissionCalendar_lib"); + +if(vars.getString("$field.PERMISSIONDEALER_TYPE") == PermissionCalendar.objectTypeDepartment()) + result.string(true); +else + result.string(false); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/permissiondealer_department_rowid/onValueChange.js b/entity/PermissionCalendar_entity/entityfields/permissiondealer_department_rowid/onValueChange.js new file mode 100644 index 0000000000000000000000000000000000000000..714a30b4159e8dfcf13452e77ea8d64ee5e7435c --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/permissiondealer_department_rowid/onValueChange.js @@ -0,0 +1,13 @@ +import("system.logging"); +import("system.vars"); + +let userRowIdVal = vars.getString("$field.PERMISSIONDEALER_USER_ROWID.val"); +let departmentRowIdVal = vars.getString("$field.PERMISSIONDEALER_DEPARTMENT_ROWID.val"); + +if (userRowIdVal != departmentRowIdVal){ + vars.set("$field.PERMISSIONDEALER_USER_ROWID", departmentRowIdVal); +} + +vars.set("$field.permissionDealer_rowId", departmentRowIdVal); + + \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/permissiondealer_department_rowid/stateProcess.js b/entity/PermissionCalendar_entity/entityfields/permissiondealer_department_rowid/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..88016954f0bf6b1bab9594b350e11ddf83781502 --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/permissiondealer_department_rowid/stateProcess.js @@ -0,0 +1,12 @@ +import("system.vars"); +import("system.result"); +import("PermissionCalendar_lib"); +import("system.neon"); + +if(vars.getString("$field.PERMISSIONDEALER_TYPE") == PermissionCalendar.objectTypeDepartment()) + if(vars.getString("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) + result.string("READONLY") + else + result.string("EDITABLE"); +else + result.string("INVISIBLE"); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/permissiondealer_rowid/displayValueProcess.js b/entity/PermissionCalendar_entity/entityfields/permissiondealer_rowid/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..c330d618b5816eb224f29062216efffb987c75c9 --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/permissiondealer_rowid/displayValueProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("system.result"); +import("PermissionCalendar_lib"); + +result.string(PermissionCalendar.getNameDisplay(vars.getString("$field.permissionDealer_rowId"), vars.getString("$field.PERMISSIONDEALER_TYPE"))); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/permissiondealer_type/displayValueProcess.js b/entity/PermissionCalendar_entity/entityfields/permissiondealer_type/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..5847860747baab8df79e5aa139d02541ec8fd4ce --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/permissiondealer_type/displayValueProcess.js @@ -0,0 +1,9 @@ +import("system.vars"); +import("system.translate"); +import("system.result"); + +// First letter should be upper, the rest of the word lower case. +// So there is a better legibility +let type = vars.get("$field.PERMISSIONDEALER_TYPE").toLowerCase(); +type = type.charAt(0).toUpperCase() + type.slice(1); +result.string(translate.text(type)); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/permissiondealer_type/valueProcess.js b/entity/PermissionCalendar_entity/entityfields/permissiondealer_type/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..c02d458db6ede7ee066f364a67745996fee3166d --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/permissiondealer_type/valueProcess.js @@ -0,0 +1,8 @@ +import("system.result"); +import("system.vars"); + + +let permissionDealerType = vars.get("$param.PermissionDealerType_param"); + +if (vars.get("$this.value") == null && permissionDealerType) + result.string(permissionDealerType); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/permissiondealer_user_rowid/displayValueProcess.js b/entity/PermissionCalendar_entity/entityfields/permissiondealer_user_rowid/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..af5a34c010ce8110efc29bc9da05f719847d349a --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/permissiondealer_user_rowid/displayValueProcess.js @@ -0,0 +1,7 @@ +import("system.vars"); +import("system.result"); + +let display = vars.get("$field.permissionDealer_rowId.displayValue"); +// It can be undefined if e. g. the user couldn't be find. +if(display != "undefined") + result.string(vars.get("$field.permissionDealer_rowId.displayValue")); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/permissiondealer_user_rowid/mandatoryProcess.js b/entity/PermissionCalendar_entity/entityfields/permissiondealer_user_rowid/mandatoryProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..aedb9baf3836ed3907708055a12ee5ffab72b6b8 --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/permissiondealer_user_rowid/mandatoryProcess.js @@ -0,0 +1,8 @@ +import("system.vars"); +import("system.result"); +import("PermissionCalendar_lib"); + +if(vars.getString("$field.PERMISSIONDEALER_TYPE") == PermissionCalendar.objectTypeUser()) + result.string(true); +else + result.string(false); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/permissiondealer_user_rowid/onValueChange.js b/entity/PermissionCalendar_entity/entityfields/permissiondealer_user_rowid/onValueChange.js new file mode 100644 index 0000000000000000000000000000000000000000..e00a1752425fa7354cadf350b946b97b54921117 --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/permissiondealer_user_rowid/onValueChange.js @@ -0,0 +1,10 @@ +import("system.logging"); +import("system.vars"); + +let user_rowId_val = vars.getString("$field.PERMISSIONDEALER_USER_ROWID.val"); +let department_rowId_val = vars.getString("$field.PERMISSIONDEALER_DEPARTMENT_ROWID.val"); + +if (user_rowId_val != department_rowId_val){ + // Caution indireckt call of PERMISSIONDEALER_DEPARTMENT_ROWID.onValueChange + vars.set("$field.PERMISSIONDEALER_DEPARTMENT_ROWID", user_rowId_val); +} \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/permissiondealer_user_rowid/stateProcess.js b/entity/PermissionCalendar_entity/entityfields/permissiondealer_user_rowid/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..3b15f8f615cbd79a84cf24098d53e1dd0ccba0c6 --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/permissiondealer_user_rowid/stateProcess.js @@ -0,0 +1,12 @@ +import("system.vars"); +import("system.result"); +import("PermissionCalendar_lib"); +import("system.neon"); + +if(vars.getString("$field.PERMISSIONDEALER_TYPE") == PermissionCalendar.objectTypeUser()) + if(vars.getString("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) + result.string("READONLY") + else + result.string("EDITABLE"); +else + result.string("INVISIBLE"); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/permissionicon/displayValueProcess.js b/entity/PermissionCalendar_entity/entityfields/permissionicon/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..675b9353994096757ab0cc73c4ca393d9229d5c4 --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/permissionicon/displayValueProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string("TEXT:" + vars.getString("$field.PERMISSION.displayValue")); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/permissionprocurer_param/valueProcess.js b/entity/PermissionCalendar_entity/entityfields/permissionprocurer_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7a636b057823397d7774e71d28252c894e731d62 --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/permissionprocurer_param/valueProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("Employee_lib"); + +let currentUser = EmployeeUtils.getCurrentUserId(); + +result.string(currentUser); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/permissionprocurer_rowid/displayValueProcess.js b/entity/PermissionCalendar_entity/entityfields/permissionprocurer_rowid/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..1b9f78e3c5b921e530d54107762cb84b25a75a4e --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/permissionprocurer_rowid/displayValueProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("system.vars"); +import("PermissionCalendar_lib"); + +result.string(PermissionCalendar.getNameDisplay(vars.getString("$field.PERMISSIONPROCURER_ROWID"), vars.getString("$field.PERMISSIONPROCURER_TYPE"))); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/permissionprocurer_rowid/valueProcess.js b/entity/PermissionCalendar_entity/entityfields/permissionprocurer_rowid/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..a8593c85365db38defb230673ce11e7eebfaf361 --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/permissionprocurer_rowid/valueProcess.js @@ -0,0 +1,8 @@ +import("Employee_lib"); +import("system.result"); +import("system.neon"); +import("system.vars"); + + +if(vars.get("$this.value") == null && vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) + result.string(EmployeeUtils.sliceUserId(vars.get("$param.PermissionProcurer_param"))); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/permissionprocurer_type/displayValueProcess.js b/entity/PermissionCalendar_entity/entityfields/permissionprocurer_type/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..0b2a0f6d87675b93d9210e1237fbda46ef8c68c8 --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/permissionprocurer_type/displayValueProcess.js @@ -0,0 +1,9 @@ +import("system.vars"); +import("system.translate"); +import("system.result"); + +// First letter should be upper, the rest of the word lower case. +// So there is a better legibility +let type = vars.get("$field.PERMISSIONPROCURER_TYPE").toLowerCase(); +type = type.charAt(0).toUpperCase() + type.slice(1); +result.string(translate.text(type)); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/permissionprocurer_type/valueProcess.js b/entity/PermissionCalendar_entity/entityfields/permissionprocurer_type/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..61f70f8df4ea2d6125cf20c9c10ef2c05fe51eb5 --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/permissionprocurer_type/valueProcess.js @@ -0,0 +1,8 @@ +import("PermissionCalendar_lib"); +import("Employee_lib"); +import("system.result"); +import("system.neon"); +import("system.vars"); + +if(vars.get("$this.value") == null && vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) + result.string(PermissionCalendar.getObjectType(vars.get("$param.PermissionProcurer_param"))); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/user_edit/valueProcess.js b/entity/PermissionCalendar_entity/entityfields/user_edit/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..a47d9ac69d8f51f3f6dbc5ed475cc87cc5b7d2cf --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/user_edit/valueProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("system.neon"); +import("system.vars"); + +if(vars.get("$this.value") == null && vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) + result.string(vars.get("$sys.user")); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/entityfields/user_new/valueProcess.js b/entity/PermissionCalendar_entity/entityfields/user_new/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..b01a0968194425d0b0b40ab9404c1f22bc2c2845 --- /dev/null +++ b/entity/PermissionCalendar_entity/entityfields/user_new/valueProcess.js @@ -0,0 +1,6 @@ +import("system.result"); +import("system.neon"); +import("system.vars"); + +if(vars.get("$this.value") == null && vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) + result.string(vars.get("$sys.user")); \ No newline at end of file diff --git a/entity/PermissionCalendar_entity/onValidation.js b/entity/PermissionCalendar_entity/onValidation.js new file mode 100644 index 0000000000000000000000000000000000000000..041b6fa5c4c88dc0205315a6450361352bf7c6e8 --- /dev/null +++ b/entity/PermissionCalendar_entity/onValidation.js @@ -0,0 +1,24 @@ +import("system.neon"); +import("system.translate"); +import("system.result"); +import("system.vars"); +import("PermissionCalendar_lib"); +import("Employee_lib"); + +let dealerId; +let dealerType = vars.getString("$field.PERMISSIONDEALER_TYPE"); +if(dealerType == PermissionCalendar.objectTypeUser()) + dealerId = vars.getString("$field.PERMISSIONDEALER_USER_ROWID"); +else if (dealerType == PermissionCalendar.objectTypeDepartment()) + dealerId = vars.getString("$field.PERMISSIONDEALER_DEPARTMENT_ROWID"); +else + dealerId = ""; + +if(dealerId == EmployeeUtils.sliceUserId(EmployeeUtils.getCurrentUserId())) + result.string(translate.text("You can't set a permission to yourself!")); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +{ + if(PermissionCalendar.isPermissionExisting(dealerId, dealerType, vars.getString("$field.PERMISSIONPROCURER_ROWID"))) + result.string(translate.text("There is already a permission existing!")); +} diff --git a/entity/PermissionCalendar_entity/recordcontainers/permissioncalendardb/conditionProcess.js b/entity/PermissionCalendar_entity/recordcontainers/permissioncalendardb/conditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..6ccd25f1abc59ce03ae537326a8aa33e260d796f --- /dev/null +++ b/entity/PermissionCalendar_entity/recordcontainers/permissioncalendardb/conditionProcess.js @@ -0,0 +1,6 @@ +import("Employee_lib"); +import("system.vars"); +import("system.result"); +import("Sql_lib"); +var cond = newWhereIfSet("AB_PERMISSIONCALENDAR.PERMISSIONPROCURER_ROWID", EmployeeUtils.sliceUserId(vars.getString("$param.PermissionProcurer_param"))); +result.string(cond); \ No newline at end of file diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod index ebf1d27fa0d3618e99816708ee3e88cd9be8f100..f3ae42e247b3c52c9833dd14f26ecab723fe2c49 100644 --- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod +++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod @@ -6077,6 +6077,105 @@ <entry> <key>${CANCELLED}</key> </entry> + <entry> + <key>Permission procurer</key> + </entry> + <entry> + <key>PermissionCalendar_entity.PermissionCalendarJDito.onUpdate: AB_PERMISSIONCALENDARID or UID and OBJECT_TYPE and PERMISSIONDEALER_ID is not set.</key> + </entry> + <entry> + <key>Workflow signal</key> + </entry> + <entry> + <key>Signals</key> + </entry> + <entry> + <key>PermissionCalendar_entity.PermissionCalendarJDito.onUpdate: PERMISSION is not set.</key> + </entry> + <entry> + <key>AddAction</key> + </entry> + <entry> + <key>NoPermissions</key> + </entry> + <entry> + <key>add new Department Permission</key> + </entry> + <entry> + <key>permission</key> + </entry> + <entry> + <key>Permission Dealer Department</key> + </entry> + <entry> + <key>add new User Permission</key> + </entry> + <entry> + <key>ReadWritePermission</key> + </entry> + <entry> + <key>Context</key> + </entry> + <entry> + <key>Permission Dealer</key> + </entry> + <entry> + <key>PermissionCalendar_entity.PermissionCalendarJDito.onInsert: This operation isn't allowed.</key> + </entry> + <entry> + <key>LimitedReadPermission</key> + </entry> + <entry> + <key>Signal</key> + </entry> + <entry> + <key>Permission Dealer User</key> + </entry> + <entry> + <key>Berechtigungen</key> + </entry> + <entry> + <key>Claim task</key> + </entry> + <entry> + <key>permission dealer type</key> + </entry> + <entry> + <key>ReadPermission</key> + </entry> + <entry> + <key>Scope</key> + </entry> + <entry> + <key>permission procurer type</key> + </entry> + <entry> + <key>Calendar Permission</key> + </entry> + <entry> + <key>PermissionCalendar_entity.PermissionCalendarJDito.onDelete: This operation isn't allowed.</key> + </entry> + <entry> + <key>Claim date</key> + </entry> + <entry> + <key>Auf eigenen Benutzer kann keine Berechtigung gesetzt werden!</key> + </entry> + <entry> + <key>You can't set a permission to yourself!</key> + </entry> + <entry> + <key>There is already a permission existing!</key> + </entry> + <entry> + <key>Deparment</key> + </entry> + <entry> + <key>Add new User Permission</key> + </entry> + <entry> + <key>Add new Department Permission</key> + </entry> <entry> <key>Signals</key> </entry> diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index d4b8a5b8bd871d747f2833c088399935a882be9f..72c901a2685d456f33dbddff5a24b8fda70bb60e 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -7823,6 +7823,115 @@ Bitte Datumseingabe prüfen</value> <entry> <key>ankle of</key> </entry> + <entry> + <key>Permission procurer</key> + <value>Rechteempfänger</value> + </entry> + <entry> + <key>PermissionCalendar_entity.PermissionCalendarJDito.onUpdate: AB_PERMISSIONCALENDARID or UID and OBJECT_TYPE and PERMISSIONDEALER_ID is not set.</key> + </entry> + <entry> + <key>Workflow signal</key> + </entry> + <entry> + <key>Signals</key> + </entry> + <entry> + <key>PermissionCalendar_entity.PermissionCalendarJDito.onUpdate: PERMISSION is not set.</key> + </entry> + <entry> + <key>AddAction</key> + </entry> + <entry> + <key>NoPermissions</key> + <value>keine Lese- und Schreibberechtigung</value> + </entry> + <entry> + <key>permission</key> + <value>Berechtigung</value> + </entry> + <entry> + <key>Permission Dealer Department</key> + <value>Rechtegeber Abteilung</value> + </entry> + <entry> + <key>ReadWritePermission</key> + <value>Lese- und Schreibberechtigung</value> + </entry> + <entry> + <key>Context</key> + </entry> + <entry> + <key>Permission Dealer</key> + <value>Rechtegeber</value> + </entry> + <entry> + <key>PermissionCalendar_entity.PermissionCalendarJDito.onInsert: This operation isn't allowed.</key> + </entry> + <entry> + <key>LimitedReadPermission</key> + <value>eingeschränkte Leseberechtigung</value> + </entry> + <entry> + <key>Signal</key> + </entry> + <entry> + <key>Permission Dealer User</key> + <value>Rechtegeber Benutzer</value> + </entry> + <entry> + <key>Berechtigungen</key> + </entry> + <entry> + <key>Claim task</key> + </entry> + <entry> + <key>permission dealer type</key> + <value>Rechtegeber Typ</value> + </entry> + <entry> + <key>ReadPermission</key> + <value>volle Leseberechtigung</value> + </entry> + <entry> + <key>Scope</key> + </entry> + <entry> + <key>permission procurer type</key> + <value>Rechteempfänger Typ</value> + </entry> + <entry> + <key>Calendar Permission</key> + <value>Kalender-Berechtigungen</value> + </entry> + <entry> + <key>PermissionCalendar_entity.PermissionCalendarJDito.onDelete: This operation isn't allowed.</key> + </entry> + <entry> + <key>Claim date</key> + </entry> + <entry> + <key>Auf eigenen Benutzer kann keine Berechtigung gesetzt werden!</key> + </entry> + <entry> + <key>You can't set a permission to yourself!</key> + <value>Sie können keine Berechtigungen für sich selbst setzen.</value> + </entry> + <entry> + <key>There is already a permission existing!</key> + <value>Es existiert bereits eine Berechtigung!</value> + </entry> + <entry> + <key>Deparment</key> + </entry> + <entry> + <key>Add new User Permission</key> + <value>Neue Benutzer-Berechtigung hinzufügen</value> + </entry> + <entry> + <key>Add new Department Permission</key> + <value>Neue Abteilungs-Berechtigung hinzufügen</value> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod index 703a87b398aff5601af9e96c2dec60b8f02d697d..fcac10f43ec09a0db4ddd7e92190b5da1a2be4c7 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -6134,6 +6134,109 @@ <key>${CONDITION}</key> <value>Condition</value> </entry> + <entry> + <key>Permission procurer</key> + </entry> + <entry> + <key>PermissionCalendar_entity.PermissionCalendarJDito.onUpdate: AB_PERMISSIONCALENDARID or UID and OBJECT_TYPE and PERMISSIONDEALER_ID is not set.</key> + </entry> + <entry> + <key>Workflow signal</key> + </entry> + <entry> + <key>Signals</key> + </entry> + <entry> + <key>PermissionCalendar_entity.PermissionCalendarJDito.onUpdate: PERMISSION is not set.</key> + </entry> + <entry> + <key>AddAction</key> + </entry> + <entry> + <key>NoPermissions</key> + <value>no read and write permission</value> + </entry> + <entry> + <key>add new Department Permission</key> + </entry> + <entry> + <key>permission</key> + </entry> + <entry> + <key>Permission Dealer Department</key> + </entry> + <entry> + <key>add new User Permission</key> + </entry> + <entry> + <key>ReadWritePermission</key> + <value>full read and write permission</value> + </entry> + <entry> + <key>Context</key> + </entry> + <entry> + <key>Permission Dealer</key> + </entry> + <entry> + <key>PermissionCalendar_entity.PermissionCalendarJDito.onInsert: This operation isn't allowed.</key> + </entry> + <entry> + <key>LimitedReadPermission</key> + <value>limited read permission</value> + </entry> + <entry> + <key>Signal</key> + </entry> + <entry> + <key>Permission Dealer User</key> + </entry> + <entry> + <key>Claim task</key> + </entry> + <entry> + <key>permission dealer type</key> + </entry> + <entry> + <key>ReadPermission</key> + <value>full read permission</value> + </entry> + <entry> + <key>Scope</key> + </entry> + <entry> + <key>permission procurer type</key> + </entry> + <entry> + <key>Calendar Permission</key> + </entry> + <entry> + <key>PermissionCalendar_entity.PermissionCalendarJDito.onDelete: This operation isn't allowed.</key> + </entry> + <entry> + <key>Claim date</key> + </entry> + <entry> + <key>You can't set a permission to yourself!</key> + </entry> + <entry> + <key>There is already a permission existing!</key> + </entry> + <entry> + <key>Auf eigenen Benutzer kann keine Berechtigung gesetzt werden!</key> + </entry> + <entry> + <key>Berechtigungen</key> + </entry> + <entry> + <key>Deparment</key> + </entry> + <entry> + <key>Add new User Permission</key> + </entry> + <entry> + <key>Add new Department Permission</key> + </entry> <entry> <key>Signals</key> </entry> diff --git a/neonContext/PermissionCalendar/PermissionCalendar.aod b/neonContext/PermissionCalendar/PermissionCalendar.aod new file mode 100644 index 0000000000000000000000000000000000000000..0c5f7320e41f74db81f43da80ed238b366fe36fc --- /dev/null +++ b/neonContext/PermissionCalendar/PermissionCalendar.aod @@ -0,0 +1,23 @@ +<?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>PermissionCalendar</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <filterView>PermissionCalendarFilter_view</filterView> + <editView>PermissionCalendarEdit_view</editView> + <previewView>PermissionCalendarPreview_view</previewView> + <entity>PermissionCalendar_entity</entity> + <references> + <neonViewReference> + <name>c6aeffac-6de9-45f0-bdf8-452f6ea09015</name> + <view>PermissionCalendarFilter_view</view> + </neonViewReference> + <neonViewReference> + <name>0c78e394-344e-4f62-a87a-cd0efe3c76d4</name> + <view>PermissionCalendarEdit_view</view> + </neonViewReference> + <neonViewReference> + <name>33122cbe-2bc2-47c1-b1db-8a15d516915c</name> + <view>PermissionCalendarPreview_view</view> + </neonViewReference> + </references> +</neonContext> diff --git a/neonView/EmployeeFilter_view/EmployeeFilter_view.aod b/neonView/EmployeeFilter_view/EmployeeFilter_view.aod index 307c9e9479077f1253f0b78239109636eaea967c..75f5c242fb01d3a477726b7d1b989920aaaa17c7 100644 --- a/neonView/EmployeeFilter_view/EmployeeFilter_view.aod +++ b/neonView/EmployeeFilter_view/EmployeeFilter_view.aod @@ -52,6 +52,18 @@ <name>5acac530-7ff7-4fd1-ac48-4a9c441a8b13</name> <entityField>DESCRIPTION</entityField> </neonTableColumn> + <neonTableColumn> + <name>02d4201a-d6f1-4155-a637-2807d19ebba3</name> + <entityField>UID</entityField> + </neonTableColumn> + <neonTableColumn> + <name>d5424182-30ee-4da4-a8ca-74a3f44cbdfc</name> + <entityField>SHORT_UID</entityField> + </neonTableColumn> + <neonTableColumn> + <name>9183e905-7784-46b8-b94a-365c8de9f676</name> + <entityField>CONTACT_ID</entityField> + </neonTableColumn> </columns> </tableViewTemplate> </children> diff --git a/neonView/EmployeeMain_view/EmployeeMain_view.aod b/neonView/EmployeeMain_view/EmployeeMain_view.aod index 7bb3f3c818b2ff1e15ec25da7251af719bb50e51..eac65e321040550c5986a9f2d1af5bc2df40edf7 100644 --- a/neonView/EmployeeMain_view/EmployeeMain_view.aod +++ b/neonView/EmployeeMain_view/EmployeeMain_view.aod @@ -29,5 +29,10 @@ <entityField>Documents</entityField> <view>DocumentFilter_view</view> </neonViewReference> + <neonViewReference> + <name>d5135f0a-87cb-4a34-a2bb-3fe3f95c2bb8</name> + <entityField>Permissions</entityField> + <view>PermissionCalendarFilter_view</view> + </neonViewReference> </children> </neonView> diff --git a/neonView/PermissionCalendarEdit_view/PermissionCalendarEdit_view.aod b/neonView/PermissionCalendarEdit_view/PermissionCalendarEdit_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..738907c81ec50de628877b018e4e3e7345c90eb1 --- /dev/null +++ b/neonView/PermissionCalendarEdit_view/PermissionCalendarEdit_view.aod @@ -0,0 +1,32 @@ +<?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>PermissionCalendarEdit_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <isSmall v="true" /> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <genericViewTemplate> + <name>PermissionCalendarEditGeneric</name> + <editMode v="true" /> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>88d8020d-ef4e-46d6-b9e9-7a730136e277</name> + <entityField>PERMISSION</entityField> + </entityFieldLink> + <entityFieldLink> + <name>55190b00-158e-4cf6-b382-358a379df948</name> + <entityField>PERMISSIONDEALER_DEPARTMENT_ROWID</entityField> + </entityFieldLink> + <entityFieldLink> + <name>bf110421-8305-47c4-8bab-d859b14c7bd4</name> + <entityField>PERMISSIONDEALER_USER_ROWID</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> +</neonView> diff --git a/neonView/PermissionCalendarFilter_view/PermissionCalendarFilter_view.aod b/neonView/PermissionCalendarFilter_view/PermissionCalendarFilter_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..4a3d8eb73f0393c7ded234a84e8991d8cdf16676 --- /dev/null +++ b/neonView/PermissionCalendarFilter_view/PermissionCalendarFilter_view.aod @@ -0,0 +1,62 @@ +<?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>PermissionCalendarFilter_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <filterable v="true" /> + <layout> + <groupLayout> + <name>layout</name> + </groupLayout> + </layout> + <children> + <tableViewTemplate> + <name>PermissionCalendarFilterTable</name> + <favoriteActionGroup1>AddActions</favoriteActionGroup1> + <entityField>#ENTITY</entityField> + <isCreatable v="false" /> + <isEditable v="true" /> + <columns> + <neonTableColumn> + <name>ca7e825c-b14f-409d-aa87-ceabdc5e39b1</name> + <entityField>permissionIcon</entityField> + </neonTableColumn> + <neonTableColumn> + <name>114dc887-4894-45f3-a4ab-06dbc881dcfe</name> + <entityField>permissionDealer_rowId</entityField> + </neonTableColumn> + <neonTableColumn> + <name>2f6ba7b2-b2a5-4f7e-ad9e-c5d492c5948e</name> + <entityField>PERMISSIONDEALER_TYPE</entityField> + </neonTableColumn> + <neonTableColumn> + <name>a0bf3e28-e9de-4a00-8af2-1d0a3881f918</name> + <entityField>PERMISSION</entityField> + </neonTableColumn> + </columns> + </tableViewTemplate> + <treeTableViewTemplate> + <name>PermissionCalendarTreeTable</name> + <favoriteActionGroup1>AddActions</favoriteActionGroup1> + <defaultGroupFields> + <element>PERMISSION</element> + </defaultGroupFields> + <entityField>#ENTITY</entityField> + <isCreatable v="false" /> + <isEditable v="true" /> + <columns> + <neonTreeTableColumn> + <name>67f93a73-1b28-4c9d-9c07-4af16aaf3977</name> + <entityField>PERMISSION</entityField> + </neonTreeTableColumn> + <neonTreeTableColumn> + <name>3e63b2c1-03df-4250-900f-e95ef888493e</name> + <entityField>permissionDealer_rowId</entityField> + </neonTreeTableColumn> + <neonTreeTableColumn> + <name>b69d0020-2e26-4cdc-a5c5-7a6c49793f2e</name> + <entityField>PERMISSIONDEALER_TYPE</entityField> + </neonTreeTableColumn> + </columns> + </treeTableViewTemplate> + </children> +</neonView> diff --git a/neonView/PermissionCalendarPreview_view/PermissionCalendarPreview_view.aod b/neonView/PermissionCalendarPreview_view/PermissionCalendarPreview_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..517131f602246486657f3508e224b046c318dce3 --- /dev/null +++ b/neonView/PermissionCalendarPreview_view/PermissionCalendarPreview_view.aod @@ -0,0 +1,47 @@ +<?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>PermissionCalendarPreview_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <headerFooterLayout> + <name>layout</name> + <header>PermissionCalendarCard</header> + <footer>PermissionCalendarGeneric</footer> + </headerFooterLayout> + </layout> + <children> + <cardViewTemplate> + <name>PermissionCalendarCard</name> + <iconField>permissionIcon</iconField> + <titleField>permissionDealer_rowId</titleField> + <subtitleField>PERMISSIONDEALER_TYPE</subtitleField> + <descriptionField></descriptionField> + <entityField>#ENTITY</entityField> + </cardViewTemplate> + <genericViewTemplate> + <name>PermissionCalendarGeneric</name> + <entityField>#ENTITY</entityField> + <informationField></informationField> + <fields> + <entityFieldLink> + <name>fcdc753a-2e52-4de4-b9b8-a5347e038e60</name> + <entityField>PERMISSIONPROCURER_ROWID</entityField> + </entityFieldLink> + <entityFieldLink> + <name>b0fe8e05-cd91-4cb3-ae6f-03d87f6d63e0</name> + <entityField>PERMISSIONPROCURER_TYPE</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + <scoreCardViewTemplate> + <name>PermissionCalendarScoreCard</name> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>b79d8bff-c7e0-4971-ac55-86c1dd06f1d2</name> + <entityField>PERMISSION</entityField> + </entityFieldLink> + </fields> + </scoreCardViewTemplate> + </children> +</neonView> diff --git a/process/KeywordRegistry_basic/process.js b/process/KeywordRegistry_basic/process.js index b5423d3b67494aedc84cfc49575e3b63023bf05f..68564a9f84cd71fa036da02e0fba6690ee940f56 100644 --- a/process/KeywordRegistry_basic/process.js +++ b/process/KeywordRegistry_basic/process.js @@ -243,4 +243,9 @@ $KeywordRegistry.workflowTrigger$delete = function(){return "WORKFLOWTRIGGERDELE $KeywordRegistry.workflowSignalTrigger = function(){return "WorkflowSignalTrigger";}; $KeywordRegistry.workflowSignalTrigger$create = function(){return "TRIGGEREVENTINSERT";}; $KeywordRegistry.workflowSignalTrigger$update = function(){return "TRIGGEREVENTUPDATE";}; -$KeywordRegistry.workflowSignalTrigger$delete = function(){return "TRIGGEREVENTDELETE";}; \ No newline at end of file +$KeywordRegistry.workflowSignalTrigger$delete = function(){return "TRIGGEREVENTDELETE";}; + + +$KeywordRegistry.permissionCalendarCategory = function(){return "PermissionCalendarCategory";}; +$KeywordRegistry.permissionCalendarCategory$readwrite = function(){return "READWRITE";}; +$KeywordRegistry.permissionCalendarType = function(){return "PermissionCalendarType";}; \ No newline at end of file diff --git a/process/PermissionCalendar_lib/PermissionCalendar_lib.aod b/process/PermissionCalendar_lib/PermissionCalendar_lib.aod new file mode 100644 index 0000000000000000000000000000000000000000..2bb834eb6eb72928f730fb2f9734141f41244f58 --- /dev/null +++ b/process/PermissionCalendar_lib/PermissionCalendar_lib.aod @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.1"> + <name>PermissionCalendar_lib</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <process>%aditoprj%/process/PermissionCalendar_lib/process.js</process> + <variants> + <element>LIBRARY</element> + </variants> +</process> diff --git a/process/PermissionCalendar_lib/process.js b/process/PermissionCalendar_lib/process.js new file mode 100644 index 0000000000000000000000000000000000000000..f85e2844c534d30b3119b25e3474f10ed3ef2a5a --- /dev/null +++ b/process/PermissionCalendar_lib/process.js @@ -0,0 +1,369 @@ +import("system.translate"); +import("system.logging"); +import("AttributeRegistry_basic"); +import("Sql_lib"); +import("Employee_lib"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); +import("system.tools"); +import("system.calendars") + + +function PermissionCalendar() {} + +PermissionCalendar.objectTypeDepartment = function() +{ + return "DEPARTMENT"; +} + +PermissionCalendar.objectTypeUser = function() +{ + return "USER"; +} + +PermissionCalendar.getAlias = function() +{ + return "Data_alias"; +} + +PermissionCalendar.getDefaultPermission = function() +{ + return $KeywordRegistry.permissionCalendarCategory$readwrite(); +} + +/** + * Returns the categorys with the corresponding fields. If fields is null, every field is allowed to be read. + */ +PermissionCalendar.getCategories = function() +{ + var categories = []; + categories["NOTHING"] = {}; + categories["NOTHING"].fields = []; + categories["NOTHING"].writeable = false; + + categories["LIMITEDREAD"] = {}; + categories["LIMITEDREAD"].fields = [calendars.ATTENDEES, calendars.DTSTART, calendars.DTEND, calendars.DUE, calendars.DURATION]; + categories["LIMITEDREAD"].writeable = false; + + categories["FULLREAD"] = {}; + categories["FULLREAD"].fields = null; + categories["FULLREAD"].writeable = false; + + categories["READWRITE"] = {}; + categories["READWRITE"].fields = null; + categories["READWRITE"].writeable = true; + + return categories; +} + +/** + * Returns the objecttype of the passed rowId. + * Pay attention: a User-RowId must start with the Prefix. + * + * @param {String} pObjectRowId the rowId + * @return {String} the objecttype + */ +PermissionCalendar.getObjectType = function(pObjectRowId) +{ + if(pObjectRowId.length > 36) + return PermissionCalendar.objectTypeUser(); + else + return PermissionCalendar.objectTypeDepartment(); +} + +/** + * Returns for a permission-value the responding view-value. + * + * @param {String} pPermissionId the permission-keyword + * @return {String} the view-value + */ +PermissionCalendar.getPermissionDisplay = function(pPermissionId) +{ + return KeywordUtils.getViewValue($KeywordRegistry.permissionCalendarCategory(), pPermissionId.trim()); +} + +/** + * Returns the display-value for a rowId. Attention: If the type is User, the rowId must be without the prefix. + * + * @param {String} pRowId the rowId + * @param {String} pType the type of the rowId + * @return {String} the display-value or "undefined", if an error occured. + */ +PermissionCalendar.getNameDisplay = function(pRowId, pType) +{ + if(pType == PermissionCalendar.objectTypeUser()) + { + let user = tools.getUserByAttribute(tools.NAME, EmployeeUtils.prefixUserId(pRowId), tools.PROFILE_TITLE); + if(user != null) + return user.title; + else + return "undefined"; + } + else if(pType == PermissionCalendar.objectTypeDepartment()) + { + let dept = new SqlBuilder().select("AB_Attribute.ATTRIBUTE_NAME") + .from("AB_Attribute") + .where("AB_Attribute.AB_ATTRIBUTEID", pRowId) + .arrayRow(); + + if(dept.length == 1) + return translate.text(dept[0]); + else + return "undefined"; + + } + else + return "undefined"; +} + +/** + * Checks, if an permission for the passed combination of parameters exists. + * + * @param {String} pPermissionDealer_RowId the rowId of the permission dealer + * @param {String} pPermissionDealer_Type the type of the permission dealer + * @param {String} pPermissionProcurer_RowId the rowId for the permisison procurer + * + * @retun {boolean} true if one exists, else false + */ +PermissionCalendar.isPermissionExisting = function(pPermissionDealer_RowId, pPermissionDealer_Type, pPermissionProcurer_RowId) +{ + let temp = new SqlBuilder().select("AB_PERMISSIONCALENDAR.AB_PERMISSIONCALENDARID") + .from("AB_PERMISSIONCALENDAR") + .where("AB_PERMISSIONCALENDAR.PERMISSIONDEALER_ROWID", pPermissionDealer_RowId) + .and("AB_PERMISSIONCALENDAR.PERMISSIONDEALER_TYPE", pPermissionDealer_Type) + .and("AB_PERMISSIONCALENDAR.PERMISSIONPROCURER_ROWID", pPermissionProcurer_RowId) + .table(); + if(temp.length > 0) + return true; + else + return false; +} + +/** + * Sets the permissions of the passed user. It is highly recommend to use this function for the autostart. + * + * @param {String} pUserId the user without the prefix for whom the permissions should be set. + */ +PermissionCalendar.setPermissions = function(pUserId) +{ + var categories = PermissionCalendar.getCategories(); + let res = []; + let tree = PermissionCalendar.getTree(pUserId); + tree.forEach(function(item, i) + { + if(item[1] == PermissionCalendar.objectTypeUser()) + { + if(!res[item[3]]) + { + res[item[3]] = []; + } + res[item[3]].push(item[2]); + } + }); + for (var key in res) { + if(categories[key].writeable) + { + // With Write + calendars.setCalendarUser(res[key], calendars.RIGHT_WRITE_APPOINTMENT, false, calendars.SORTSTRATEGY_NATURAL); + calendars.addPermissions(res[key], calendars.VEVENT, ["READ"], categories[key].fields, false, calendars.SORTSTRATEGY_NATURAL); + } + else + { + // Only Read + // if permission has 0 fields: do not set the permission + if(categories[key].fields != null && categories[key].fields.length > 0 || categories[key].fields == null) + calendars.addPermissions(res[key], calendars.VEVENT, ["READ"], categories[key].fields, false, calendars.SORTSTRATEGY_NATURAL); + } + } + // User itself can read and write his own calendar + calendars.setCalendarUser([EmployeeUtils.getCurrentUserName()], calendars.RIGHT_WRITE_APPOINTMENT | calendars.RIGHT_READ_APPOINTMENT, false, calendars.SORTSTRATEGY_NATURAL); +} + +/** + * Builds the tree with all departments, users and permissions for the passed userId. + * + * @param {String} pCurrentUser the user without the prefix + * @return {Array} an array with all departments, users and their permissions + */ +PermissionCalendar.getTree = function(pCurrentUser) +{ + var resultArr = []; + let permissions = PermissionCalendar.getPermissions(pCurrentUser); + let user = PermissionCalendar._getUser(); + + let root = PermissionCalendar._getDepartment($AttributeRegistry.departments(), permissions, resultArr); + // Rekursion aufrufen + PermissionCalendar._getDataRecursive(root[0], pCurrentUser, permissions, user, resultArr); + + return resultArr; + resultArr = []; +} + +/** + * Get all Permissions of the Departments and Users recursive + * + * @param {String[]} pRoot the Root-Department + * @param {String} pCurrentUser the id of the currentUser + * @param {String[]} pPermissions the permissions of the currentUser + * @param {String} pUser all active Users + * @param {String} pResultArr the array, where the result should be pushed + */ +PermissionCalendar._getDataRecursive = function(pRoot, pCurrentUser, pPermissions, pUser, pResultArr) +{ + // displayValue von permission + let inheritedPermission = pRoot[3]; + + PermissionCalendar._createRowUser(pRoot[0], inheritedPermission, pCurrentUser, pPermissions, pUser, pResultArr); + let depts = PermissionCalendar._getDepartments(pRoot[0], inheritedPermission, pPermissions); + depts.forEach(function(item, i) + { + PermissionCalendar._getDataRecursive(item, pCurrentUser, pPermissions, pUser); + }); +} + +/** + * Checks the permissions of the User and whether the user inherits permissions + * + * @param {String} pDept the user without the prefix + * @param {String} inheritedPermission the "default" permission, which should be set, if there is no permission explicit is set. The "default" permission + * should be the inherited permission of the department of the user. + * @param {String} pCurrentUser the id of the currentUser + * @param {String[]} pPermissions the permissions of the currentUser + * @param {String} pUser all active Users + * @param {String} pResultArr the array, where the result should be pushed + */ +PermissionCalendar._createRowUser = function(pDept, inheritedPermission, pCurrentUser, pPermissions, pUser, pResultArr) +{ + pUser.forEach(function(user, i) + { + if(EmployeeUtils.sliceUserId(user[0]) != pCurrentUser) + { + if(user[2] == pDept) + { + let flag = true; + for(let i = 0; i < pPermissions.length; i++) + { + if(pPermissions[i][1] == EmployeeUtils.sliceUserId(user[0])) + { + flag = false; + pResultArr.push([user[0], pPermissions[i][2], user[1], pPermissions[i][4]]); + break; + } + } + if(flag) + { + pResultArr.push([user[0], PermissionCalendar.objectTypeUser(), user[1], inheritedPermission]); + } + } + } + }); +} + +/** + * Get the root-Department with the permissions + * + * @param {String} pAttributeId the ID of the Root department + * @param {String[]} pPermissions the permissions of the currentUser + * @param {String} pResultArr the array, where the result should be pushed + * + * @return the root-Department with permissions. If there isn't set a permission, the default-permisson would be used + */ +PermissionCalendar._getDepartment = function(pAttributeId, pPermissions, pResultArr) +{ + let d = new SqlBuilder() + .select("AB_Attribute.AB_ATTRIBUTEID, AB_Attribute.ATTRIBUTE_PARENT_ID, AB_Attribute.ATTRIBUTE_NAME") + .from("AB_Attribute") + .where("AB_Attribute.AB_ATTRIBUTEID", pAttributeId) + .table(); + + // If there is no permission set for the Root-deparment, then the default-permission shoud be used + let inherited = PermissionCalendar.getDefaultPermission(); + return PermissionCalendar._createRowDept(d, inherited, pPermissions, pResultArr); +} + +/** + * Returns all subordinate departments of pParentId + * + * @param {String} pParentId the ID of the parent department + * @param {String[]} inheritedPermission the permissions of the parent department. This permission is used if there is no permission set. + * @param {String[]} pPermissions the permissions of the currentUser + * @param {String} pResultArr the array, where the result should be pushed + * + * @return the departments with permissions + */ +PermissionCalendar._getDepartments = function(pParentId, inheritedPermission, pPermissions, pResultArr) +{ + let dept = new SqlBuilder() + .select("AB_Attribute.AB_ATTRIBUTEID, AB_Attribute.ATTRIBUTE_PARENT_ID, AB_Attribute.ATTRIBUTE_NAME") + .from("AB_Attribute") + .where("AB_Attribute.ATTRIBUTE_PARENT_ID", pParentId) + .table(); + + return PermissionCalendar._createRowDept(dept, inheritedPermission, pPermissions, pResultArr); +} + +/** + * Checks the Permissions of the Departments and whether the departments inherits permissions + * + * @param {String} pTable The deparments, which should be check + * @param {String} inheritedPermission the permission of the parent department + * @param {String[]} pPermissions the permissions of the currentUser + * @param {String} pResultArr the array, where the result should be pushed + * + * @return the departments with permissions + */ +PermissionCalendar._createRowDept = function(pTable, inheritedPermission, pPermissions, pResultArr) +{ + let temp = []; + for(let i = 0; i < pTable.length; i++) + { + let flag = false; + for(let j = 0; j < pPermissions.length; j++) + { + if(pPermissions[j][1] == pTable[i][0]) + { + temp.push([pTable[i][0], pPermissions[j][2], pTable[i][2], pPermissions[j][4]]); + flag = true; + break; + } + } + if(!flag) + { + temp.push([pTable[i][0], PermissionCalendar.objectTypeDepartment(), pTable[i][2], inheritedPermission]); + } + } + pResultArr = pResultArr.concat(temp); + return temp; +} + +/** + * Returns all permisisons of the passed user. + * + * @param {String} pCurrentUser the user-id without the prefix, who is the permission procurer. + * @return {Array} an array of all permissions + */ +PermissionCalendar.getPermissions = function(pCurrentUser) +{ + return new SqlBuilder(PermissionCalendar.getAlias()) + .select("AB_PERMISSIONCALENDARID, PERMISSIONDEALER_ROWID, PERMISSIONDEALER_TYPE, PERMISSIONPROCURER_ROWID, PERMISSION") + .from("AB_PERMISSIONCALENDAR") + .where("AB_PERMISSIONCALENDAR.PERMISSIONPROCURER_ROWID", pCurrentUser) + .orderBy("PERMISSIONDEALER_ROWID ASC") + .table(); +} + +/* + * Returns all active users + */ +PermissionCalendar._getUser = function() +{ + users = tools.getUsersByAttribute(tools.ISACTIVE, ["true"], tools.PROFILE_FULL); + return users.map(function (user) + { + return [ + user[tools.NAME], + user[tools.TITLE], + user[tools.PARAMS].department + ]; + }); +} diff --git a/process/autostartNeon/autostartNeon.aod b/process/autostartNeon/autostartNeon.aod index 348fc7c6ca8c2be930aa7723be1d1012d813380c..5cae2b54c4df27afd135f072eb2e42809dfd90c7 100644 --- a/process/autostartNeon/autostartNeon.aod +++ b/process/autostartNeon/autostartNeon.aod @@ -3,4 +3,5 @@ <name>autostartNeon</name> <majorModelMode>DISTRIBUTED</majorModelMode> <process>%aditoprj%/process/autostartNeon/process.js</process> + <alias>Data_alias</alias> </process> diff --git a/process/autostartNeon/process.js b/process/autostartNeon/process.js index 8ab0fd79bc02b12e10a6bc0182897f285199af0c..01484cbf1bdac65705059f367e2819afad3ffde9 100644 --- a/process/autostartNeon/process.js +++ b/process/autostartNeon/process.js @@ -1,18 +1,8 @@ -import("Permission_lib"); -import("system.project"); -import("system.tools"); -import("system.calendars") -import("system.notification") -import("system.text"); -import("system.util"); +import("PermissionCalendar_lib"); +import("Employee_lib"); +import("system.calendars"); -var usersTools = tools.getStoredUsers(); -var users = []; - -for(var i = 0; i < usersTools.length; i++) -{ - users.push(usersTools[i][1]); -} - -calendars.setCalendarUser(users, calendars.RIGHT_READ | calendars.RIGHT_WRITE, false, calendars.SORTSTRATEGY_NATURAL); calendars.setCheckAttendeesOnWrite(false); + +var currentUser = EmployeeUtils.sliceUserId(EmployeeUtils.getCurrentUserId()); +PermissionCalendar.setPermissions(currentUser); \ No newline at end of file