diff options
author | matthiasgrimm <matthiasgrimm@users.sourceforge.net> | 2006-02-01 19:14:22 +0100 |
---|---|---|
committer | matthiasgrimm <matthiasgrimm@users.sourceforge.net> | 2006-02-01 19:14:22 +0100 |
commit | b0a0ac793b5f8794c458eb10e10efca5cede3d75 (patch) | |
tree | c4c8b8974290b5a846f2cc8f513bd9f9c85b03d9 | |
parent | 904377f5a44da9b49a2411f801d39361cc885438 (diff) | |
download | rpg-b0a0ac793b5f8794c458eb10e10efca5cede3d75.tar.gz rpg-b0a0ac793b5f8794c458eb10e10efca5cede3d75.tar.bz2 |
optional READ Lock
The option TablesToLock is no longer required for read operations.
The small risk to feed invalid data into dokuwiki was accepted by
the project leader.
Nevertheless locks will be used for read operations too, if the
option 'TablesToLock' is given.
darcs-hash:20060201181422-7ef76-e89c5d9c305ca8c076281a58b6208e60dfce4c9f.gz
-rw-r--r-- | inc/auth/mysql.class.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/inc/auth/mysql.class.php b/inc/auth/mysql.class.php index cb789fc12..fb7f43d80 100644 --- a/inc/auth/mysql.class.php +++ b/inc/auth/mysql.class.php @@ -53,14 +53,12 @@ class auth_mysql extends auth_basic { * @return bool */ function canDo($fn) { + $wop = false; /* function is write operation */ + /* general database configuration set? */ if (empty($this->cnf['server']) || empty($this->cnf['user']) || empty($this->cnf['password']) || empty($this->cnf['database'])) return false; - - /* lock array filled with tables names? */ - if (!is_array($this->cnf['TablesToLock']) || empty($this->cnf['TablesToLock'])) - return false; switch($fn) { case 'checkPass': @@ -72,14 +70,17 @@ class auth_mysql extends auth_basic { case 'createUser': $config = array('getUserInfo','getGroups','addUser', 'getUserID','addGroup','addUserGroup','delGroup'); + $wop = true; break; case 'modifyUser': $config = array('getUserID','updateUser','UpdateTarget', 'getGroups','getGroupID','addGroup','addUserGroup', 'delGroup','getGroupID','delUserGroup'); + $wop = true; break; case 'deleteUsers': $config = array('getUserID','delUser','delUserRefs'); + $wop = true; break; case 'getUserCount': $config = array('getUsers'); @@ -90,14 +91,20 @@ class auth_mysql extends auth_basic { case 'joinGroup': $config = array('getUserID','getGroupID','addGroup', 'addUserGroup','delGroup'); + $wop = true; break; case 'leaveGroup': $config = array('getUserID','getGroupID','delUserGroup'); + $wop = true; break; default: return false; /* unknown function call */ } + /* write operation and lock array filled with tables names? */ + if ($wop && (!is_array($this->cnf['TablesToLock']) || empty($this->cnf['TablesToLock']))) + return false; + foreach ($config as $statement) if (empty($this->cnf[$statement])) return false; /* required statement not set */ |