DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:authmysql:flyspray

Flyspray

Configuration for authMySQL Auth plugin to authenticate with Flyspray Bugtrackingsystem, which let's do:

  • Authentication
  • User adding, modification and deletion

Flyspray 0.9.9

Flyspray 0.9.8

Use the Config Manager or add it to the conf/local.protected.php to store the config protected.

This is the setup used here at splitbrain to authenticate against the Flyspray Bugtrackingsystem.

conf/local.protected.php
<?php
/**
 * Flyspray configuration for MySQL Auth Plugin
 * See https://www.dokuwiki.org/plugin:authmysql:flyspray for details and explanation
 */
 
$conf['passcrypt']    = 'md5';
$conf['authtype']     = 'mysql';
$conf['defaultgroup'] = 'reporters';
 
$conf['plugin']['authmysql']['debug'] = 0; //set to 1 during config
 
$conf['plugin']['authmysql']['server']   = 'localhost';
$conf['plugin']['authmysql']['user']     = 'flyspray';
$conf['plugin']['authmysql']['password'] = 'secret';
$conf['plugin']['authmysql']['database'] = 'flyspray';
 
$conf['plugin']['authmysql']['getUserID']   = "SELECT user_id AS id
                                                 FROM flyspray_users
                                                WHERE user_name='%{user}'";
 
$conf['plugin']['authmysql']['getGroupID']  = "SELECT group_id AS id
                                                 FROM flyspray_groups
                                                WHERE LOWER(group_name)='%{group}'";
 
$conf['plugin']['authmysql']['checkPass']   = "SELECT user_pass AS pass
                                                 FROM flyspray_users
                                                WHERE user_name='%{user}'
                                                  AND account_enabled=1";
 
$conf['plugin']['authmysql']['getGroups']   = "SELECT LOWER(g.group_name) as `group`
                                                 FROM flyspray_groups AS g, flyspray_users AS u, flyspray_users_in_groups AS ug
                                                WHERE g.group_id = ug.group_id
                                                  AND ug.user_id = u.user_id
                                                  AND u.user_name='%{user}'";
 
$conf['plugin']['authmysql']['getUserInfo'] = "SELECT user_pass AS pass, real_name AS name, email_address AS mail
                                                 FROM flyspray_users
                                                WHERE user_name='%{user}'";
 
$conf['plugin']['authmysql']['getUsers']    = "SELECT DISTINCT u.user_name AS user
                                                 FROM flyspray_users AS u
                                                 LEFT JOIN flyspray_users_in_groups AS ug ON u.user_id=ug.user_id
                                                 LEFT JOIN flyspray_groups AS g ON ug.group_id=g.group_id";
$conf['plugin']['authmysql']['FilterLogin'] = "u.user_name LIKE '%{user}'";
$conf['plugin']['authmysql']['FilterName']  = "u.real_name LIKE '%{name}'";
$conf['plugin']['authmysql']['FilterEmail'] = "u.email_address LIKE '%{email}'";
$conf['plugin']['authmysql']['FilterGroup'] = "g.group_name LIKE '%{group}'";
$conf['plugin']['authmysql']['SortOrder']   = "ORDER BY u.user_name";
 
$conf['plugin']['authmysql']['addUser']     = "INSERT INTO flyspray_users
                                                   SET user_name = '%{user}',
                                                       user_pass = '%{pass}',
                                                       real_name = '%{name}',
                                                       email_address = '%{email}',
                                                       jabber_id = '',
                                                       notify_type = 1,
                                                       account_enabled = 1,
                                                       dateformat = '',
                                                       dateformat_extended = '',
                                                       magic_url = '',
                                                       last_search = '',
                                                       tasks_perpage = 25";
$conf['plugin']['authmysql']['updateUser']  = "UPDATE flyspray_users SET";
$conf['plugin']['authmysql']['UpdateLogin'] = "user_name='%{user}'";
$conf['plugin']['authmysql']['UpdatePass']  = "user_pass='%{pass}'";
$conf['plugin']['authmysql']['UpdateEmail'] = "email_address='%{email}'";
$conf['plugin']['authmysql']['UpdateName']  = "real_name='%{name}'";
$conf['plugin']['authmysql']['UpdateTarget']= "WHERE user_id=%{uid}";
$conf['plugin']['authmysql']['addGroup']    = "INSERT INTO flyspray_groups
                                                  SET group_name = '%{group}',
                                                      group_desc = '%{group} group'";
 
#$conf['plugin']['authmysql']['delGroup']    = "DELETE FROM flyspray_groups
#                                               WHERE group_id='%{gid}'";

$conf['plugin']['authmysql']['addUserGroup'] = "INSERT INTO flyspray_users_in_groups
                                                  (user_id,group_id) VALUES ('%{uid}', '%{gid}')";
 
$conf['plugin']['authmysql']['delUserGroup']= "DELETE FROM flyspray_users_in_groups
                                               WHERE user_id='%{uid}'
                                                 AND group_id='%{gid}'";
 
#$conf['plugin']['authmysql']['delUserRefs'] = "DELETE FROM flyspray_users_in_groups
#                                               WHERE group_id='%{gid}';";

 
$conf['plugin']['authmysql']['TablesToLock']= array("flyspray_users",
                                                    "flyspray_users AS u",
                                                    "flyspray_groups",
                                                    "flyspray_groups AS g",
                                                    "flyspray_users_in_groups",
                                                    "flyspray_users_in_groups AS ug");

Note all delete commands are commented because I don't use them, so these are untested but should work.

plugin/authmysql/flyspray.txt · Last modified: 2013-02-10 14:09 by Klap-in