summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatthiasgrimm <matthiasgrimm@users.sourceforge.net>2006-02-08 19:59:13 +0100
committermatthiasgrimm <matthiasgrimm@users.sourceforge.net>2006-02-08 19:59:13 +0100
commit715e553e50052b5533d7e588b98fa8750c637055 (patch)
tree16e22d78516f1c9c515e391dc12cc473d0c13c83
parent26fb387be54a4d50158a4fd1e16d5b96601c82f8 (diff)
downloadrpg-715e553e50052b5533d7e588b98fa8750c637055.tar.gz
rpg-715e553e50052b5533d7e588b98fa8750c637055.tar.bz2
MySQL cando update
This patch fixed the cando capabilities array. darcs-hash:20060208185913-7ef76-b6e999ebd2ecfbf3d3b50305cee88d6eb85a3b65.gz
-rw-r--r--inc/auth/mysql.class.php23
1 files changed, 15 insertions, 8 deletions
diff --git a/inc/auth/mysql.class.php b/inc/auth/mysql.class.php
index 0fb311e26..fec617d56 100644
--- a/inc/auth/mysql.class.php
+++ b/inc/auth/mysql.class.php
@@ -38,6 +38,7 @@ class auth_mysql extends auth_basic {
if ($this->cnf['debug'])
msg("MySQL err: PHP MySQL extension not found.",-1);
$this->success = false;
+ return;
}
$this->cnf = $conf['auth']['mysql'];
@@ -59,7 +60,11 @@ class auth_mysql extends auth_basic {
'delUserRefs'),true);
$this->cando['modLogin'] = $this->_chkcnf(array('getUserID',
'updateUser',
- 'UpdateTarget',
+ 'UpdateTarget'),true);
+ $this->cando['modPass'] = $this->cando['modLogin'];
+ $this->cando['modName'] = $this->cando['modLogin'];
+ $this->cando['modMail'] = $this->cando['modLogin'];
+ $this->cando['modGroups'] = $this->_chkcnf(array('getUserID',
'getGroups',
'getGroupID',
'addGroup',
@@ -67,12 +72,9 @@ class auth_mysql extends auth_basic {
'delGroup',
'getGroupID',
'delUserGroup'),true);
- $this->cando['modPass'] = $this->cando['modLogin'];
- $this->cando['modName'] = $this->cando['modLogin'];
- $this->cando['modMail'] = $this->cando['modLogin'];
- $this->cando['modGroups'] = $this->cando['modLogin'];
+ /* getGroups is not yet supported
$this->cando['getGroups'] = $this->_chkcnf(array('getGroups',
- 'getGroupID'),false);
+ 'getGroupID'),false); */
$this->cando['getUsers'] = $this->_chkcnf(array('getUsers',
'getUserInfo',
'getGroups'),false);
@@ -209,10 +211,15 @@ class auth_mysql extends auth_basic {
* The password must be provides unencrypted. Pasword cryption is done
* automatically if configured.
*
- * If one or more groups could't be updated, no error would be set. In
+ * If one or more groups could't be updated, an error would be set. In
* this case the dataset might already be changed and we can't rollback
* the changes. Transactions would be really usefull here.
*
+ * modifyUser() may be called without SQL statements defined that are
+ * needed to change group membership (for example if only the user profile
+ * should be modified). In this case we asure that we don't touch groups
+ * even $changes['grps'] is set by mistake.
+ *
* @param $user nick of the user to be changed
* @param $changes array of field/value pairs to be changed (password
* will be clear text)
@@ -233,7 +240,7 @@ class auth_mysql extends auth_basic {
if (($uid = $this->_getUserID($user))) {
$rc = $this->_updateUserInfo($changes, $uid);
- if ($rc && isset($changes['grps'])) {
+ if ($rc && isset($changes['grps']) && $this->cando['modGroups']) {
$groups = $this->_getGroups($user);
$grpadd = array_diff($changes['grps'], $groups);
$grpdel = array_diff($groups, $changes['grps']);