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

Permissions - #1039594 - creating/updating/deleting custom roles in client

parent 070d8302
No related branches found
No related tags found
No related merge requests found
Showing
with 83 additions and 11 deletions
......@@ -5,7 +5,8 @@
<documentation>%aditoprj%/entity/Role_entity/documentation.adoc</documentation>
<icon>VAADIN:USER_CHECK</icon>
<title>Roles</title>
<grantCreate v="false" />
<grantUpdateProcess>%aditoprj%/entity/Role_entity/grantUpdateProcess.js</grantUpdateProcess>
<grantDeleteProcess>%aditoprj%/entity/Role_entity/grantDeleteProcess.js</grantDeleteProcess>
<contentTitleProcess>%aditoprj%/entity/Role_entity/contentTitleProcess.js</contentTitleProcess>
<iconId>VAADIN:USER_CHECK</iconId>
<titlePlural>Roles</titlePlural>
......@@ -17,6 +18,7 @@
<entityField>
<name>ROLETITLE</name>
<title>Title</title>
<mandatory v="true" />
</entityField>
<entityField>
<name>ROLETYPE</name>
......@@ -27,7 +29,9 @@
<title>Description</title>
</entityField>
<entityField>
<name>UID</name>
<name>ROLENAME</name>
<title>Name</title>
<mandatory v="true" />
</entityField>
<entityField>
<name>USERCOUNT</name>
......@@ -101,6 +105,16 @@
</entityDependency>
</dependencies>
</entityProvider>
<entityField>
<name>IS_ASSIGNABLE</name>
<title>is assignable</title>
<contentType>BOOLEAN</contentType>
<dropDownProcess>%aditoprj%/entity/Role_entity/entityfields/is_assignable/dropDownProcess.js</dropDownProcess>
<valueProcess>%aditoprj%/entity/Role_entity/entityfields/is_assignable/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>UID</name>
</entityField>
</entityFields>
<recordContainers>
<jDitoRecordContainer>
......@@ -108,10 +122,16 @@
<jDitoRecordAlias>_____SYSTEMALIAS</jDitoRecordAlias>
<isFilterable v="true" />
<contentProcess>%aditoprj%/entity/Role_entity/recordcontainers/jdito/contentProcess.js</contentProcess>
<onInsert>%aditoprj%/entity/Role_entity/recordcontainers/jdito/onInsert.js</onInsert>
<onUpdate>%aditoprj%/entity/Role_entity/recordcontainers/jdito/onUpdate.js</onUpdate>
<onDelete>%aditoprj%/entity/Role_entity/recordcontainers/jdito/onDelete.js</onDelete>
<recordFieldMappings>
<jDitoRecordFieldMapping>
<name>UID.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>ROLENAME.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>ROLETITLE.value</name>
<isFilterable v="true" />
......@@ -128,6 +148,9 @@
<name>USERCOUNT.value</name>
<isFilterable v="false" />
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>IS_ASSIGNABLE.value</name>
</jDitoRecordFieldMapping>
</recordFieldMappings>
</jDitoRecordContainer>
</recordContainers>
......
import("system.translate");
import("system.result");
result.object([
["1", translate.text("yes")]
,["0", translate.text("no")]
]);
\ No newline at end of file
import("system.result");
import("system.vars");
import("system.neon");
if (vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) {
result.string("1");
}
\ No newline at end of file
import("system.vars");
import("system.result");
result.string(vars.get("$field.UID"));
\ No newline at end of file
result.string(vars.get("$field.ROLENAME"));
\ No newline at end of file
import("system.vars");
import("system.result");
result.string(vars.get("$field.UID"));
\ No newline at end of file
result.string(vars.get("$field.ROLENAME"));
\ No newline at end of file
import("system.vars");
import("system.result");
if (vars.get("$field.ROLETYPE") == "CUSTOM") {
result.string(true);
} else {
result.string(false);
}
\ No newline at end of file
import("system.vars");
import("system.result");
if (vars.get("$field.ROLETYPE") == "CUSTOM") {
result.string(true);
} else {
result.string(false);
}
\ No newline at end of file
......@@ -23,7 +23,7 @@ for each (let role in allRoles) {
var roleName = role[3];
if (!excludeRoles[roleName]) {
let numberOfUsersInSelectedRole = tools.getUsersWithRole(roleName).length;
res.push([roleName, role[0], role[1], role[2], numberOfUsersInSelectedRole + " " + translate.text("User", locale)]);
res.push([roleName, roleName, role[0], role[1], role[2], numberOfUsersInSelectedRole + " " + translate.text("User", locale), role[4] ? "1" : "0"]);
}
}
......
import("system.tools");
import("system.vars");
var name = vars.get("$field.ROLENAME"); // field got prefix "CUSTOM_" already
tools.deleteRole(name);
\ No newline at end of file
import("system.tools");
import("system.vars");
var name = "CUSTOM_" + vars.get("$field.ROLENAME"); // field gets prefix "CUSTOM_"
tools.createRole(name, vars.get("$field.ROLETITLE"), vars.get("$field.ROLEDESCRIPTION"), vars.get("$field.IS_ASSIGNABLE") == "0" ? false : true, null);
\ No newline at end of file
import("system.tools");
import("system.vars");
var name = vars.get("$field.ROLENAME"); // field got prefix "CUSTOM_" already
tools.updateRole(name, vars.get("$field.ROLETITLE"), vars.get("$field.ROLEDESCRIPTION"), true, null);
\ No newline at end of file
......@@ -14,17 +14,21 @@
<entityField>#ENTITY</entityField>
<fields>
<entityFieldLink>
<name>13372a89-9e3c-441f-a80a-2ebb2dd0d54d</name>
<entityField>ROLETITLE</entityField>
<name>851dc6d8-7522-4fb8-a46a-15fb8010f6e7</name>
<entityField>ROLENAME</entityField>
</entityFieldLink>
<entityFieldLink>
<name>2818c096-b602-406d-8765-ec85356da84c</name>
<entityField>ROLETYPE</entityField>
<name>13372a89-9e3c-441f-a80a-2ebb2dd0d54d</name>
<entityField>ROLETITLE</entityField>
</entityFieldLink>
<entityFieldLink>
<name>c1008a40-23d4-43f9-a5f4-e96b9ad4e480</name>
<entityField>ROLEDESCRIPTION</entityField>
</entityFieldLink>
<entityFieldLink>
<name>e09d4310-1cc4-4e91-b93c-aba335456ccb</name>
<entityField>IS_ASSIGNABLE</entityField>
</entityFieldLink>
</fields>
</genericViewTemplate>
</children>
......
......@@ -26,7 +26,7 @@
</neonTableColumn>
<neonTableColumn>
<name>954cb883-bf05-4807-b303-98b31bf8f75e</name>
<entityField>UID</entityField>
<entityField>ROLENAME</entityField>
</neonTableColumn>
<neonTableColumn>
<name>e6d9050e-3139-48cc-b186-085dab1cec89</name>
......
......@@ -11,7 +11,7 @@
<cardViewTemplate>
<name>Card</name>
<iconField>#ICON</iconField>
<titleField>UID</titleField>
<titleField>ROLENAME</titleField>
<subtitleField>ROLETITLE</subtitleField>
<descriptionField>USERCOUNT</descriptionField>
<entityField>#ENTITY</entityField>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment