[feladat @ 291]
authorrejo
Fri, 11 Jul 2008 07:44:10 +0000
changeset 183 aae57715199e
parent 182 049347a649e0
child 184 b60b88b1ae08
[feladat @ 291] Bugfix. A user without the privilige to change the permission templates for users couldn't change user properties. Closes: #80.
inc/users.inc.php
users.php
--- a/inc/users.inc.php	Fri Jun 20 12:21:03 2008 +0000
+++ b/inc/users.inc.php	Fri Jul 11 07:44:10 2008 +0000
@@ -712,10 +712,15 @@
 				username = " . $db->quote($details['username']) . ",
 				fullname = " . $db->quote($details['fullname']) . ",
 				email = " . $db->quote($details['email']) . ",
-				perm_templ = " . $db->quote($details['templ_id']) . ",
 				description = " . $db->quote($details['descr']) . ", 
 				active = " . $db->quote($active) ;
 
+		// If the user is alllowed to change the permission template, set it.
+		if ($perm_templ_perm_edit == "1") {
+			$query .= ", perm_templ = " . $db->quote($details['templ_id']) ;
+
+		}
+
 		// TODO Check if function works if password is set too.
 		if($details['password'] != "") {
 			$query .= ", password = '" . md5($db->quote($details['password'])) . "' ";
--- a/users.php	Fri Jun 20 12:21:03 2008 +0000
+++ b/users.php	Fri Jul 11 07:44:10 2008 +0000
@@ -77,7 +77,8 @@
 			}
 			echo "         </select>\n";
 		} else {
-			echo $user['tpl_name'];
+			echo "         <input type=\"hidden\" name=\"user[" . $user['uid'] . "][templ_id]\" value=\"" . $user['tpl_id'] . "\">\n";
+			echo "         " . $user['tpl_name'] . "\n";
 		}
 		echo "       </td>\n";
 		echo "       <td><input type=\"checkbox\" name=\"user[" . $user['uid'] . "][active]\"" . $active . "></td>\n";