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

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
云数据库 RDS PostgreSQL,集群系列 2核4GB
简介: 老外们把精力都放在了怎样做通用性上面了。Doku后台有切换授权方式的选项,改成mysql。注:如下修改mysql.conf.php后,要把分组和权限设置结合起来,还需要配置dokuwiki的分组,zentao默认有一些角色分组:acl.

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

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

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

acl.auth.php

# 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

conf/mysql.conf.php

<?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't be able to access you
 * database.
 */
$conf['plugin']['authmysql']['server']   = 'localhost';
$conf['plugin']['authmysql']['user']     = 'zentaoxx';
$conf['plugin']['authmysql']['password'] = 'xxxxx';
$conf['plugin']['authmysql']['database'] = 'zentaoxx';

/* This option enables debug messages in the mysql plugin. It is
 * mostly useful for system admins.
 */
$conf['plugin']['authmysql']['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['plugin']['authmysql']['forwardClearPass'] = 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['plugin']['authmysql']['TablesToLock']= 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 '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['plugin']['authmysql']['checkPass']   = "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='%{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['plugin']['authmysql']['getUserInfo'] = "SELECT password, realname AS name, email AS mail
                                               FROM zt_user
                                               WHERE account='%{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 plugin accesses the group name as 'group' so an alias
 * might be nessecary.
 *
 * Following patters will be replaced:
 *   %{user}    user name
 */
$conf['plugin']['authmysql']['getGroups']   = "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='%{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 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 '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['plugin']['authmysql']['getUsers']    = "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['plugin']['authmysql']['FilterLogin'] = "account LIKE '%{user}'";
$conf['plugin']['authmysql']['FilterName']  = "realname LIKE '%{name}'";
$conf['plugin']['authmysql']['FilterEmail'] = "email LIKE '%{email}'";
$conf['plugin']['authmysql']['FilterGroup'] = "name LIKE '%{group}'";
$conf['plugin']['authmysql']['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['plugin']['authmysql']['addUser']     = "";

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

/* 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['plugin']['authmysql']['addUserGroup']= "";

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

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

/***********************************************************************/
/*   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['plugin']['authmysql']['delUser']     = "";

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

/***********************************************************************/
/*   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['plugin']['authmysql']['updateUser']  = "UPDATE zt_user SET";
$conf['plugin']['authmysql']['UpdateLogin'] = "account='%{user}'";
$conf['plugin']['authmysql']['UpdatePass']  = "password='%{pass}'";
$conf['plugin']['authmysql']['UpdateEmail'] = "email='%{email}'";
$conf['plugin']['authmysql']['UpdateName']  = "";
$conf['plugin']['authmysql']['UpdateTarget']= "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's login name
 *   %{uid}     id of a user dataset
 *   %{group}   group name
 *   %{gid}     id of a group dataset
 */
$conf['plugin']['authmysql']['delUserGroup']= "";

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

相关实践学习
如何快速连接云数据库RDS MySQL
本场景介绍如何通过阿里云数据管理服务DMS快速连接云数据库RDS MySQL,然后进行数据表的CRUD操作。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
运维 网络安全 数据库
【运维知识进阶篇】一篇文章带你搞懂Jumperserver(保姆级教程:安装+用户与用户组+创建资产+授权资产+创建数据库+sudo提权+命令过滤+多因子认证+网域功能+审计台)(一)
【运维知识进阶篇】一篇文章带你搞懂Jumperserver(保姆级教程:安装+用户与用户组+创建资产+授权资产+创建数据库+sudo提权+命令过滤+多因子认证+网域功能+审计台)
1121 0
|
运维 数据库
【运维知识进阶篇】一篇文章带你搞懂Jumperserver(保姆级教程:安装+用户与用户组+创建资产+授权资产+创建数据库+sudo提权+命令过滤+多因子认证+网域功能+审计台)(三)
【运维知识进阶篇】一篇文章带你搞懂Jumperserver(保姆级教程:安装+用户与用户组+创建资产+授权资产+创建数据库+sudo提权+命令过滤+多因子认证+网域功能+审计台)(三)
235 0
|
运维 监控 小程序
【运维知识进阶篇】一篇文章带你搞懂Jumperserver(保姆级教程:安装+用户与用户组+创建资产+授权资产+创建数据库+sudo提权+命令过滤+多因子认证+网域功能+审计台)(四)
【运维知识进阶篇】一篇文章带你搞懂Jumperserver(保姆级教程:安装+用户与用户组+创建资产+授权资产+创建数据库+sudo提权+命令过滤+多因子认证+网域功能+审计台)(四)
714 0
|
运维 数据库 数据安全/隐私保护
【运维知识进阶篇】一篇文章带你搞懂Jumperserver(保姆级教程:安装+用户与用户组+创建资产+授权资产+创建数据库+sudo提权+命令过滤+多因子认证+网域功能+审计台)(二)
【运维知识进阶篇】一篇文章带你搞懂Jumperserver(保姆级教程:安装+用户与用户组+创建资产+授权资产+创建数据库+sudo提权+命令过滤+多因子认证+网域功能+审计台)(二)
258 0
|
安全 数据安全/隐私保护
JeeSite 访问控制权限
JeeSite 访问控制权限
210 0
|
运维 负载均衡 Kubernetes
Ansible最佳实践之委派任务和事实
写在前面 分享一些 Ansible 委派任务和事实委派 的笔记 博文内容涉及: Ploybook 任务委派 Demo Ploybook 事实委派 Demo 理解不足小伙伴帮忙指正
182 0
|
数据采集 存储 搜索推荐
用户身份标识与账号体系实践
用户身份的全局统一标识至关重要,用户实体在不同业务线所产生的行为数据,通过唯一序列号进行识别,这样进行用户分析时看到的画像比较全面;
377 0
用户身份标识与账号体系实践
|
数据采集 运维 安全
Dataphin权限体系(1):权限体系介绍与角色权限【视频】
在数据系统中,优秀的权限体系设计对系统的数据安全和开发效率都非常重要,本文将从下面三个角度对Dataphin的权限体系介绍: 1、Dataphin权限体系整体设计 2、Dataphin全局角色介绍 3、Dataphin项目角色介绍
Dataphin权限体系(1):权限体系介绍与角色权限【视频】
|
存储 SQL 监控
零信任策略下云上安全信息与事件管理最佳实践
随着企业数字化转型的深入推进,网络安全越来越被企业所重视。为了构建完备的安全防御体系,企业通常会引入了防火墙(Firewall)、防病毒系统(Anti-Virus System,AVS)、入侵防御系统(Intrusion Prevention System,IPS)、入侵检测系统(Intrusion Detection System,IDS)、审计系统等大量安全产品,然而这些安全产品往往各自为政、缺乏联动,难以形成有价值的、全面系统的安全态势分析报告,也就难以应对复杂多变的安全威胁。
零信任策略下云上安全信息与事件管理最佳实践
|
Web App开发 安全 网络协议
如何设置对CDP的访问权限
在公有云或者内外网环境中,Cloudera的平台产品CDH/CDP/HDP需要访问很多Web UI,但系统网络可能仅支持SSH访问(22端口)。要访问Cloudera Manager(7180端口)或者其他服务,可以通过下列两种方式: • 在客户端计算机上设置SOCKS(套接字安全协议)代理。Cloudera建议您使用此选项。 • 将CDP/CDP部署到公有云之后,将入站规则添加到公有云实例中的网络安全组。
430 0
如何设置对CDP的访问权限