From a4498e17c0738c6ec65a38e31a5372741eb7fc8c Mon Sep 17 00:00:00 2001 From: reger Date: Sat, 8 Apr 2017 22:54:57 +0200 Subject: [PATCH] fix edit current user form to required post mehtod introduced with https://github.com/yacy/yacy_search_server/commit/cde237b68763c542da20038e5f62bea341ae1d37 --- htroot/ConfigAccounts_p.html | 4 ++-- htroot/ConfigAccounts_p.java | 25 +++++++++++++++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/htroot/ConfigAccounts_p.html b/htroot/ConfigAccounts_p.html index 40bd836aa..450e75f78 100644 --- a/htroot/ConfigAccounts_p.html +++ b/htroot/ConfigAccounts_p.html @@ -75,7 +75,7 @@
User Accounts -
+
Select user
@@ -128,7 +128,7 @@
-
+ #%env/templates/footer.template%# diff --git a/htroot/ConfigAccounts_p.java b/htroot/ConfigAccounts_p.java index 7ab11efc9..61bba4489 100644 --- a/htroot/ConfigAccounts_p.java +++ b/htroot/ConfigAccounts_p.java @@ -156,8 +156,8 @@ public class ConfigAccounts_p { //user != current_user //user=from userlist //current_user = edited user - } else if (post.containsKey("user") && !"newuser".equals(post.get("user"))){ - TransactionManager.checkPostTransaction(header, post); + } else if (post.containsKey("user") && !"newuser".equals(post.get("user"))) { + TransactionManager.checkPostTransaction(header, post); if (post.containsKey("change_user")) { //defaults for newuser are set above entry = sb.userDB.getEntry(post.get("user")); @@ -183,7 +183,7 @@ public class ConfigAccounts_p { sb.userDB.removeEntry(post.get("user")); } } else if (post.containsKey("change")) { //New User / edit User - TransactionManager.checkPostTransaction(header, post); + TransactionManager.checkPostTransaction(header, post); prop.put("text", "0"); prop.put("error", "0"); @@ -270,7 +270,24 @@ public class ConfigAccounts_p { prop.putHTML("text_username", username); prop.put("text", "2"); }//edit user + prop.putHTML("username", username); + if (entry != null) { + //TODO: set username read-only in html + prop.putHTML("current_user", entry.getUserName()); + prop.putHTML("username", entry.getUserName()); + prop.putHTML("firstname", entry.getFirstName()); + prop.putHTML("lastname", entry.getLastName()); + prop.putHTML("address", entry.getAddress()); + prop.put("timelimit", entry.getTimeLimit()); + prop.put("timeused", entry.getTimeUsed()); + int count = 0; + for (final AccessRight right : rights) { + prop.put("rights_" + count + "_set", entry.hasRight(right) ? "1" : "0"); + count++; + } + prop.put("rights", count); + } } //Generate Userlist @@ -289,4 +306,4 @@ public class ConfigAccounts_p { // return rewrite properties return prop; } -} + }