diff --git a/software/open-qm-base-station/build.gradle b/software/open-qm-base-station/build.gradle index c1936f95b..37d54f700 100644 --- a/software/open-qm-base-station/build.gradle +++ b/software/open-qm-base-station/build.gradle @@ -47,7 +47,7 @@ dependencies { // implementation 'org.webjars:js-cookie:2.2.1' //out of date // implementation 'org.webjars:spin-js:2.1.0' - implementation 'tech.epic-breakfast-productions.openQuarterMaster.lib:open-qm-lib-core:1.0.3-DEV' + implementation 'tech.epic-breakfast-productions.openQuarterMaster.lib:open-qm-lib-core:1.0.4-DEV' implementation 'tech.epic-breakfast-productions.openQuarterMaster.lib:open-qm-lib-moduleDriver:1.0.1-DEV' // https://mvnrepository.com/artifact/tech.units/indriya diff --git a/software/open-qm-base-station/src/main/resources/templates/webui/pages/userAdmin.html b/software/open-qm-base-station/src/main/resources/templates/webui/pages/userAdmin.html index bc15c4dea..17fe8ebcd 100644 --- a/software/open-qm-base-station/src/main/resources/templates/webui/pages/userAdmin.html +++ b/software/open-qm-base-station/src/main/resources/templates/webui/pages/userAdmin.html @@ -171,7 +171,7 @@
Roles:
- +
@@ -324,6 +324,7 @@
Roles:
var userEditItemForm = $("#userEditItemForm"); var userEditModalLabel = $("#userEditModalLabel"); + var userEditFormUserId = $("#userEditFormUserId"); var userEditRolesInputs = $("#userEditRolesInputs"); var userEditKeywordDiv = userEditItemForm.find(".keywordInputDiv"); @@ -337,6 +338,7 @@
Roles:
function resetUserEditForm(){ userEditModalLabel.text(""); + userEditFormUserId.val(""); for (const [key, input] of Object.entries(userEditRolesInputsMap)) { input.prop("checked", false); } @@ -347,6 +349,7 @@
Roles:
function setupUserEdit(userId){ resetUserEditForm(); + userEditFormUserId.val(userId); doRestCall({ url: "/api/user/" + userId, @@ -368,6 +371,34 @@
Roles:
} }); } + + userEditItemForm.on("submit", function(e){ + e.preventDefault(); + + let data = { + roles: ["user"] + }; + + addKeywordAttData(data, userEditKeywordDiv, userEditAttDiv); + + for (const [key, input] of Object.entries(userEditRolesInputsMap)) { + if(input.prop("checked")){ + data.roles.push(key); + } + } + + doRestCall({ + url: "/api/user/" + userEditFormUserId.val(), + method: "PUT", + data: data, + fail: function (data){ + alert("Error: " + data); + }, + done: function (data) { + reloadPageWithMessage("Updated user "+data.username+"!", "success", "Success!"); + } + }); + }); {/pageScript} {/include} \ No newline at end of file