Rumah > pembangunan bahagian belakang > tutorial php > DokuWiki整合Zentao的用户授权及分组体系

DokuWiki整合Zentao的用户授权及分组体系

WBOY
Lepaskan: 2016-08-08 09:28:24
asal
2470 orang telah melayarinya

老外们把精力都放在了怎样做通用性上面了。

Doku后台有切换授权方式的选项,改成mysql。

注:如下修改mysql.conf.php后,要把分组和权限设置结合起来,还需要配置dokuwiki的分组,zentao默认有一些角色分组:

acl.auth.php

<code># acl.auth.php
# <?php exit()?>
# Don't modify the lines above
#
# Access Control Lists
#
# Auto-generated by install script
# Date: Mon, 05 Jan 2015 13:09:23 +0000
*	@ALL	1
*	@admin	8
*	@user	8
*	@dev	8
*	@qa	8
*	@pm	8
*	@po	8
*	@td	8
*	@pd	8
*	@top	8
*	@guest	1
</code>
Salin selepas log masuk

conf/mysql.conf.php

<code><?php /*
 * This is an example configuration for the mysql auth plugin.
 *
 * 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.protected.php
 * or at least include this file in local.protected.php.
 */

/* Options to configure database access. You need to set up this
 * options carefully, otherwise you won&#39;t be able to access you
 * database.
 */
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;server&#39;]   = &#39;localhost&#39;;
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;user&#39;]     = &#39;zentaoxx&#39;;
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;password&#39;] = &#39;xxxxx&#39;;
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;database&#39;] = &#39;zentaoxx&#39;;

/* This option enables debug messages in the mysql plugin. It is
 * mostly useful for system admins.
 */
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;debug&#39;] = 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 &#39;forwardClearPass&#39; to &#39;1&#39; and the cleartext password is forwarded to
 * the database, otherwise the encrypted one.
 */
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;forwardClearPass&#39;] = 1;

/* Multiple table operations will be protected by locks. This array tolds
 * the plugin 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[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;TablesToLock&#39;]= 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 plugin accesses the password as &#39;pass&#39; so a alias might be necessary.
 *
 * Following patters will be replaced:
 *   %{user}    user name
 *   %{pass}    encrypted or clear text password (depends on &#39;encryptPass&#39;)
 *   %{dgroup}  default group name
 */
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;checkPass&#39;]   = "SELECT password
                                               FROM zt_usergroup AS ug
                                               JOIN zt_user AS u ON u.account=ug.account
                                               JOIN zt_group AS g ON g.id=ug.group
                                               WHERE account=&#39;%{user}&#39;
                                               AND name=&#39;%{dgroup}&#39;";

/* This statement should return a table with exact one row containing
 * information about one user. The field needed are:
 * &#39;pass&#39;  containing the encrypted or clear text password
 * &#39;name&#39;  the user&#39;s full name
 * &#39;mail&#39;  the user&#39;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[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;getUserInfo&#39;] = "SELECT password, realname AS name, email AS mail
                                               FROM zt_user
                                               WHERE account=&#39;%{user}&#39;";

/* 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 plugin accesses the group name as &#39;group&#39; so an alias
 * might be nessecary.
 *
 * Following patters will be replaced:
 *   %{user}    user name
 */
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;getGroups&#39;]   = "SELECT name as `group`
                                               FROM zt_group g, zt_user u, zt_usergroup ug
                                               WHERE u.account = ug.account
                                               AND g.id = ug.group
                                               AND u.account=&#39;%{user}&#39;";

/***********************************************************************/
/*      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 plugin. 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 &#39;user&#39; 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&#39;s login name
 *   %{name}    in FilterName   user&#39;s full name
 *   %{email}   in FilterEmail  user&#39;s email address
 *   %{group}   in FilterGroup  group name
 */
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;getUsers&#39;]    = "SELECT DISTINCT account AS user
                                               FROM zt_user AS u
                                               LEFT JOIN zt_usergroup AS ug ON u.account=ug.account
                                               LEFT JOIN zt_group AS g ON ug.group=g.id";
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;FilterLogin&#39;] = "account LIKE &#39;%{user}&#39;";
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;FilterName&#39;]  = "realname LIKE &#39;%{name}&#39;";
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;FilterEmail&#39;] = "email LIKE &#39;%{email}&#39;";
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;FilterGroup&#39;] = "name LIKE &#39;%{group}&#39;";
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;SortOrder&#39;]   = "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&#39;s login name
 *   %{pass}    password (encrypted or clear text, depends on &#39;encryptPass&#39;)
 *   %{email}   email address
 *   %{name}    user&#39;s full name
 */
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;addUser&#39;]     = "";

/* This statement should add a group to the database.
 * Following patterns will be replaced:
 *   %{group}   group name
 */
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;addGroup&#39;]    = "";

/* This statement should connect a user to a group (a user become member
 * of that group).
 * Following patterns will be replaced:
 *   %{user}    user&#39;s login name
 *   %{uid}     id of a user dataset
 *   %{group}   group name
 *   %{gid}     id of a group dataset
 */
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;addUserGroup&#39;]= "";

/* This statement should remove a group fom the database.
 * Following patterns will be replaced:
 *   %{group}   group name
 *   %{gid}     id of a group dataset
 */
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;delGroup&#39;]    = "";

/* This statement should return the database index of a given user name.
 * The plugin will access the index with the name &#39;id&#39; so a alias might be
 * necessary.
 * following patters will be replaced:
 *   %{user}    user name
 */
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;getUserID&#39;]   = "";

/***********************************************************************/
/*   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&#39;s login name
 *   %{uid}     id of a user dataset
 */
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;delUser&#39;]     = "";

/* 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[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;delUserRefs&#39;] = "";

/***********************************************************************/
/*   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&#39;s login name
 *   %{pass}    password (encrypted or clear text, depends on &#39;encryptPass&#39;)
 *   %{email}   email address
 *   %{name}    user&#39;s full name
 *   %{uid}     user id that should be updated
 */
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;updateUser&#39;]  = "UPDATE zt_user SET";
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;UpdateLogin&#39;] = "account=&#39;%{user}&#39;";
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;UpdatePass&#39;]  = "password=&#39;%{pass}&#39;";
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;UpdateEmail&#39;] = "email=&#39;%{email}&#39;";
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;UpdateName&#39;]  = "";
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;UpdateTarget&#39;]= "WHERE id=%{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&#39;s login name
 *   %{uid}     id of a user dataset
 *   %{group}   group name
 *   %{gid}     id of a group dataset
 */
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;delUserGroup&#39;]= "";

/* This statement should return the database index of a given group name.
 * The plugin will access the index with the name &#39;id&#39; so a alias might
 * be necessary.
 *
 * Following patters will be replaced:
 *   %{group}   group name
 */
$conf[&#39;plugin&#39;][&#39;authmysql&#39;][&#39;getGroupID&#39;]  = "SELECT id
                                               FROM zt_group
                                               WHERE name=&#39;%{group}&#39;";


</code></code>
Salin selepas log masuk

以上就介绍了DokuWiki整合Zentao的用户授权及分组体系,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan