Community Support for OpenDocMan (Deprecated)
Administrator rights cannot be set for users - Printable Version

+- Community Support for OpenDocMan (Deprecated) (https://forum.opendocman.com)
+-- Forum: OpenDocMan Community Discussion (https://forum.opendocman.com/forum-5.html)
+--- Forum: OpenDocMan Bug Reports (https://forum.opendocman.com/forum-8.html)
+--- Thread: Administrator rights cannot be set for users (/thread-723.html)



Administrator rights cannot be set for users - terenceb - 08-20-2014

Hi, I have a newly installed OpenDocMan on my CentOS and the website is being set ready. Under admin account, I tried to add new users and I would like assign some of them with admin rights. However, every time I checked the admin checkbox under the user profile and then submit, the system will prompt as update successfully. Then when I go back and display the user profile, the admin status shows as unchecked and it wont allow to perform admin task with that user. Appreciate if anyone can help on this.

Regards
Terence


RE: Administrator rights cannot be set for users - adminla - 08-28-2014

I have verified this issue. I am working on a new release but in the mean time here is the fix for this issue:

Code:
diff --git a/user.php b/user.php
index d6b0b8b..360dd1b 100644
--- a/user.php
+++ b/user.php
@@ -254,12 +254,12 @@ elseif(isset($_POST['submit']) && 'Add User' == $_POST['submit'])
         $stmt->execute();

         // INSERT into admin
-        $userid = mysql_insert_id($GLOBALS['connection']);
+        $userid = $pdo->lastInsertId();;
         if (!isset($_POST['admin']))
         {
             $_POST['admin']='0';
         }
-        $query = "INSERT INTO {$GLOBALS['CONFIG']['db_prefix']}admin (id, admin) VALUES('$userid', '$_POST[admin]')";
+        $query = "INSERT INTO {$GLOBALS['CONFIG']['db_prefix']}admin (id, admin) VALUES('$userid', '{$_POST['admin']}')";
         $result = mysql_query($query, $GLOBALS['connection']) or die ("Error in query: $query. " . mysql_error());
         if(isset($_POST['department_review']))
         {



RE: Administrator rights cannot be set for users - adminla - 08-29-2014

1.2.8.1 release. This release includes bug fixes and enhancements. No database changes.

#175 - Admin setting doesn't stick
#174 - Permissions Links inconsistent between themes
#173 - add image/svg as standard document type

#171 - Feature - Add Bengali Language
#157 - Add DWG to mimetypes.php