====== 整合 vBulletin 3.5.X 的驗證方式 ======
經實驗證明,3.6.0亦可使用此方法。
===== 修改 conf/local.php =====
<php>
//呼叫mysql.conf,將這一行插入local.php的最頂端
require(dirname(FILE).'/mysql.conf.php');
//相關的設定
$conf['useacl'] = 1; //使用存取控制清單(ACL,Access Control Lists)來限制存取?(『0』為關閉,『1』為開啟)
$conf['openregister']= 0; //允許使用者註冊的功能是否開啟?(『0』為關閉,『1』為開啟)
$conf['resendpasswd']= 0; //允許重送密碼的功能是否開啟?(『0』為關閉,『1』為開啟)
$conf['authtype'] = 'mysql';
</php>
===== 新增 conf/mysql.conf.php =====
原始的SQL字串已經被註解掉。假如你的VBB安裝的資料表,前置字元為"vb_"開頭,你必須要修改或者是反註解掉。\\
注意到所有的會員與群組管理,註冊與移除SQL值將會被設定為空字串或註解掉。請使用VBB來管理會員與群組。
<php>
/*
* This is an example configuration for the mysql auth module.
*
* This SQL statements are optimized for following table structure.
* If you use a different one you have to change them accordingly.
* See comments of every statement for details.
*
* TABLE users
* uid login pass firstname lastname email
*
* TABLE groups
* gid name
*
* TABLE usergroup
* uid gid
*
* To use this configuration you have to copy them to local.php
* or at least include this file in local.php.
*/
/* Options to configure database access. You need to set up this
* options carefully, otherwise you won't be able to access you
* database.
*/
$conf['auth']['mysql']['server'] = 'localhost';
$conf['auth']['mysql']['user'] = 'forum';
$conf['auth']['mysql']['password'] = 'forumpass';
$conf['auth']['mysql']['database'] = 'forum';
/* This option enables debug messages in the mysql module. It is
* mostly usefull for system admins.
*/
$conf['auth']['mysql']['debug'] = 0;
/* Normally password encryption is done by DokuWiki (recommended) but for
* some reasons it might be usefull to let the database do the encryption.
* Set 'forwardClearPass' to '1' and the cleartext password is forwarded to
* the database, otherwise the encrypted one.
*/
$conf['auth']['mysql']['forwardClearPass'] = 1;
/* Multiple table operations will be protected by locks. This array tolds
* the module which tables to lock. If you use any aliases for table names
* these array must also contain these aliases. Any unamed alias will cause
* a warning during operation. See the example below.
*/
$conf['auth']['mysql']['TablesToLock']= array(); //array("users", "users AS u","groups", "groups AS g", "usergroup", "usergroup AS ug");
/*/
/* Basic SQL statements for user authentication (required) */
/*/
/* 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. If the result table is empty or contains more than one
* row, access will be denied.
*
* The module access the password as 'pass' so a alias might be necessary.
*
* Following patters will be replaced:
* %{user} user name
* %{pass} encrypted or clear text password (depends on 'encryptPass')
* %{dgroup} default group name
*/
$conf['auth']['mysql']['checkPass'] = "SELECT username AS login FROM user WHERE LOWER(username)= LOWER('%{user}') and MD5(CONCAT(MD5('%{pass}'),salt)) = password";
/*"SELECT pass
FROM usergroup AS ug
JOIN users AS u ON u.uid=ug.uid
JOIN groups AS g ON g.gid=ug.gid
WHERE login='%{user}'
AND name='%{dgroup}'";*/
/* This statement should return a table with exact one row containing
* information about one user. The field needed are:
* 'pass' containing the encrypted or clear text password
* 'name' the user's full name
* 'mail' the user's email address
*
* Keep in mind that Dokuwiki will access thise information through the
* names listed above so aliasses might be neseccary.
*
* Following patters will be replaced:
* %{user} user name
*/
$conf['auth']['mysql']['getUserInfo'] = "SELECT username AS name, email AS mail
FROM user
WHERE LOWER(username)='%{user}'";
/*"SELECT pass, CONCAT(firstname,' ',lastname) AS name, email AS mail
FROM users
WHERE login='%{user}'"; */
/* This statement is used to get all groups a user is member of. The
* result should be a table containing all groups the given user is
* member of. The module access the group name as 'group' so a alias
* might be nessecary.
*
* Following patters will be replaced:
* %{user} user name
*/
$conf['auth']['mysql']['getGroups'] = "select g.title as ‘group`
from usergroup g, user u
where u.username = LOWER(’%{user}')
and g.usergroupid = u.usergroupid"; //"SELECT name as ‘group`
//FROM groups g, users u, usergroup ug
//WHERE u.uid = ug.uid
//AND g.gid = ug.gid
//AND u.login=’%{user}'";
/*/
/* Additional minimum SQL statements to use the user manager */
/*/
/* This statement should return a table containing all user login names
* that meet certain filter criteria. The filter expressions will be added
* case dependend by the module. At the end a sort expression will be added.
* Important is that this list contains no double entries fo a user. Each
* user name is only allowed once in the table.
*
* The login name will be accessed as 'user' to a alias might be neseccary.
* No patterns will be replaced in this statement but following patters
* will be replaced in the filter expressions:
* %{user} in FilterLogin user's login name
* %{name} in FilterName user's full name
* %{email} in FilterEmail user's email address
* %{group} in FilterGroup group name
*/
$conf['auth']['mysql']['getUsers'] = "";/*"SELECT DISTINCT login AS user
FROM users AS u
LEFT JOIN usergroup AS ug ON u.uid=ug.uid
LEFT JOIN groups AS g ON ug.gid=g.gid"; */
$conf['auth']['mysql']['FilterLogin'] = "";"login LIKE '%{user}'";
$conf['auth']['mysql']['FilterName'] = "";"CONCAT(firstname,' ',lastname) LIKE '%{name}'";
$conf['auth']['mysql']['FilterEmail'] = "";"email LIKE '%{email}'";
$conf['auth']['mysql']['FilterGroup'] = "";"name LIKE '%{group}'";
$conf['auth']['mysql']['SortOrder'] = "";//ORDER BY login";
/*/
/* Additional SQL statements to add new users with the user manager */
/*/
/* This statement should add a user to the database. Minimum information
* to store are: login name, password, email address and full name.
*
* 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
*/
$conf['auth']['mysql']['addUser'] = "";//"INSERT INTO users
//(login, pass, email, firstname, lastname)
// VALUES ('%{user}', '%{pass}', '%{email}',
// SUBSTRING_INDEX('%{name}',' ', 1),
//SUBSTRING_INDEX('%{name}',' ', -1))";
/* This statement should add a group to the database.
* Following patterns will be replaced:
* %{group} group name
*/
$conf['auth']['mysql']['addGroup'] = "";//"INSERT INTO groups (name)
// VALUES ('%{group}')";
/* This statement should connect a user to a group (a user become member
* of that group).
* Following patterns will be replaced:
* %{user} user's login name
* %{uid} id of a user dataset
* %{group} group name
* %{gid} id of a group dataset
*/
$conf['auth']['mysql']['addUserGroup']= "";//"INSERT INTO usergroup (uid, gid)
// VALUES ('%{uid}', '%{gid}')";
/* This statement should remove a group fom the database.
* Following patterns will be replaced:
* %{group} group name
* %{gid} id of a group dataset
*/
$conf['auth']['mysql']['delGroup'] = "";//"DELETE FROM groups
// WHERE gid='%{gid}'";
/* This statement should return the database index of a given user name.
* The module will access the index with the name 'id' so a alias might be
* necessary.
* following patters will be replaced:
* %{user} user name
*/
$conf['auth']['mysql']['getUserID'] = "SELECT userid AS id
FROM user
WHERE LOWER(username) ='%{user}'";
/*/
/* Additional SQL statements to delete users with the user manager */
/*/
/* This statement should remove a user fom the database.
* Following patterns will be replaced:
* %{user} user's login name
* %{uid} id of a user dataset
*/
$conf['auth']['mysql']['delUser'] = ""; //"DELETE FROM users
//WHERE uid='%{uid}'";
/* This statement should remove all connections from a user to any group
* (a user quits membership of all groups).
* Following patterns will be replaced:
* %{uid} id of a user dataset
*/
$conf['auth']['mysql']['delUserRefs'] = ""; // "DELETE FROM usergroup
//WHERE uid='%{uid}'";
/*/
/* Additional SQL statements to modify users with the user manager */
/*/
/* 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 single connection from a user to a
* group (a user quits membership of that group).
*
* Following patterns will be replaced:
* %{user} user's login name
* %{uid} id of a user dataset
* %{group} group name
* %{gid} id of a group dataset
*/
$conf['auth']['mysql']['delUserGroup']= "";//"DELETE FROM usergroup
//WHERE uid='%{uid}'
//AND gid='%{gid}'";
/* 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 necessary.
*
* Following patters will be replaced:
* %{group} group name
*/
$conf['auth']['mysql']['getGroupID'] = "SELECT usergroupid AS id
FROM usergroup
WHERE title='%{group}'";
</php>
===== 修改 conf/acl.auth.php =====
下面的設定值,限制未登入的使用者只能夠有讀取的權限,並且預設允許已經通過驗證的VBB使用者群組有編輯的權限。\\
注意,如果你的群組與預設的不相同,請自行修改。
<php>
- acl.auth.php
- <?php exit()?>
- 請勿修改上面那一行字。
#
- Access Control Lists
#
- Editing this file by hand shouldn't be necessary. Use the ACL
- Manager interface instead.
#
- 假如驗證時有用到特殊字元,例如群組名稱或使用者名稱有含『空白』,你必需要
- 以網址編碼來取代。(字元數必須小於128,保持UTF-8多位元字元原本的樣子)
#
- 禁止 0
- 讀取 1
- 編輯 2
- 建立 4
- 上傳 8
- @ALL 1
- @Registered%20Users 4
- @Administrators 4
- @Moderators 4
</php>
原文來自:\\
http://wiki.splitbrain.org/wiki:tips:integrate_with_vbulletin_3.5.x