From dfdd92d5662e73b29998dacc0aa2f79437dfd82f Mon Sep 17 00:00:00 2001 From: matthiasgrimm Date: Tue, 24 Jan 2006 20:06:25 +0100 Subject: MySQL modify user patch This patch changed the function modifyUser(). Before this update each data change was applied by deleting and re-adding the complete user entry. The new function uses the UPDATE SQL statement. Furthermore all human readable error messages were removed. The calling procedure is in charge now to inform the user about failures. Internal debug messages were added. They can be enabled in the configuration file. Last but not least the module retrieves the database version now to handle incompatible features between different MySQL versions. darcs-hash:20060124190625-7ef76-f6dffabf230155aa51bf3c8569c31fd444634407.gz --- conf/mysql.conf.php.example | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'conf/mysql.conf.php.example') diff --git a/conf/mysql.conf.php.example b/conf/mysql.conf.php.example index fe0664903..66fcf5f13 100644 --- a/conf/mysql.conf.php.example +++ b/conf/mysql.conf.php.example @@ -28,6 +28,11 @@ $conf['auth']['mysql']['user'] = ''; $conf['auth']['mysql']['password'] = ''; $conf['auth']['mysql']['database'] = ''; +/* This option enables debug messages in the mysql module. It is + * mostly usefull for system admins. + */ +$conf['auth']['mysql']['debug'] = 0; + /* Normally password encryptionis done by DokuWiki (recommended) but for * some reasons it might be usefull to let the database do the encryption. * Set 'encryptPass' to '1' and the cleartext password is forwarded to @@ -48,7 +53,9 @@ $conf['auth']['mysql']['TablesToLock']= array("users", "users AS u","groups", "g * following patters will be replaced: * %{user} user name */ -$conf['auth']['mysql']['getUserID'] = "SELECT uid AS id FROM users WHERE login='%{user}'"; +$conf['auth']['mysql']['getUserID'] = "SELECT uid AS id + FROM users + WHERE login='%{user}'"; /* This statement should return the database index of a given group name. * The module will access the index with the name 'id' so a alias might be @@ -56,7 +63,9 @@ $conf['auth']['mysql']['getUserID'] = "SELECT uid AS id FROM users WHERE login * following patters will be replaced: * %{group} group name */ -$conf['auth']['mysql']['getGroupID'] = "SELECT gid AS id FROM groups WHERE name='%{group}'"; +$conf['auth']['mysql']['getGroupID'] = "SELECT gid AS id + FROM groups + WHERE name='%{group}'"; /* This statement is used to grant or deny access to the wiki. The result should * be a table with exact one line containing at least the password of the user. @@ -137,6 +146,24 @@ $conf['auth']['mysql']['addUser'] = "INSERT INTO users SUBSTRING_INDEX('%{name}',' ', 1), SUBSTRING_INDEX('%{name}',' ', -1))"; +/* This statements should modify a user entry in the database. The statements + * UpdateLogin, UpdatePass, UpdateEmail and UpdateName will be added to + * updateUser on demand. Only changed parameters will be used. + * Following patterns will be replaced: + * %{user} user's login name + * %{pass} password (encrypted or clear text, depends on 'encryptPass') + * %{email} email address + * %{name} user's full name + * %{uid} user id that should be updated + */ +$conf['auth']['mysql']['updateUser'] = "UPDATE users SET"; +$conf['auth']['mysql']['UpdateLogin'] = "login='%{user}'"; +$conf['auth']['mysql']['UpdatePass'] = "pass='%{pass}'"; +$conf['auth']['mysql']['UpdateEmail'] = "email='%{email}'"; +$conf['auth']['mysql']['UpdateName'] = "firstname=SUBSTRING_INDEX('%{name}',' ', 1), + lastname=SUBSTRING_INDEX('%{name}',' ', -1)"; +$conf['auth']['mysql']['UpdateTarget']= "WHERE uid=%{uid}"; + /* This statement should remove a user fom the database. * Following patterns will be replaced: * %{user} user's login name -- cgit v1.2.3