DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:authpgsql:gforge

Table of Contents

GForge database

Settings and statements for authPgSQL Auth Plugin needed to connect to GForge 4 and GForge 5 – http://gforgegroup.com/.

GForge 4

To have basic connectivity to a gforge database, set in the Config Manager or place in your conf/protected.local.php the following:

conf/protected.local.php
<?php
$conf['useacl']      = 1;                //Use Access Control Lists to restrict access?
$conf['openregister']= 0;                //Should users to be allowed to register?
$conf['authtype']    = 'pgsql';          //which authentication DB should be used (currently plain only)
$conf['plugin']['authpgsql']['server']   = '**yourserver**';
$conf['plugin']['authpgsql']['user']     = 'gforge';
$conf['plugin']['authpgsql']['password'] = '**yourpasswd**';
$conf['plugin']['authpgsql']['database'] = 'gforge';
$conf['plugin']['authpgsql']['forwardClearPass'] = 0;
$conf['passcrypt'] = 'md5';
$conf['plugin']['authpgsql']['checkPass']= "SELECT user_pw AS pass
                                            FROM users
                                            WHERE user_name='%{user}'";
 
$conf['plugin']['authpgsql']['getUserInfo'] = "SELECT user_pw AS pass, realname AS name, email AS mail
                                               FROM users
                                               WHERE user_name='%{user}'";
 
$conf['plugin']['authpgsql']['getGroups']   = "SELECT unix_group_name as group
                                               FROM groups a, users b, user_group c
                                               WHERE b.user_id = c.user_id
                                               AND a.group_id = c.group_id
                                               AND b.user_name='%{user}'";

The remaining user functions (add/remove/modify) should be done via the Gforge interface.

GForge 5

To have basic connectivity to a gforge database, set in the Config Manager or place in your conf/protected.local.php the following:

conf/protected.local.php
<?php
$conf['useacl']      = 1;                //Use Access Control Lists to restrict access?
$conf['openregister']= 0;                //Should users to be allowed to register?
$conf['authtype']    = 'pgsql';          //which authentication DB should be used (currently plain only)
$conf['plugin']['authpgsql']['server']   = '**yourserver**';
$conf['plugin']['authpgsql']['user']     = 'gforge';
$conf['plugin']['authpgsql']['password'] = '**yourpasswd**';
$conf['plugin']['authpgsql']['database'] = 'gforge';
$conf['plugin']['authpgsql']['forwardClearPass'] = 0;
$conf['passcrypt'] = 'md5';
 
$conf['plugin']['authpgsql']['checkPass'] = "
    SELECT password_md5 AS pass
    FROM \"user\" u
    WHERE u.unix_name = '%{user}' AND u.status = 1";
 
$conf['plugin']['authpgsql']['getUserInfo'] = "
    SELECT password_md5 AS pass, (firstname || ' ' || lastname) AS name, email AS mail
    FROM \"user\" u
    WHERE u.unix_name = '%{user}' AND u.status = 1";
 
/* Simple method: return all groups that a user is a member of
 *                (normalized to lower case)
 *  e.g.: docs test kernel
 */
$conf['plugin']['authpgsql']['getGroups']   = "SELECT project.unix_name as group
                                               FROM project, user_project, \"user\"
                                               WHERE project.project_id = user_project.project_id
                                                 AND user_project.user_id = \"user\".user_id
                                                 AND \"user\".unix_name = '%{user}'
                                                 AND \"user\".status = 1";
/* More complex: return all groups that a user is a member of, and return group:role info as well
 *               (normalized to lower case and spaces converted to underscores)
 *  e.g.: docs docs:administrator test test:developer kernel kernel:senior_developer
 */
$conf['plugin']['authpgsql']['getGroups'] = "
    SELECT p.unix_name || ':' || replace(lower(r.role_name), ' ', '_') as group
    FROM project p
        INNER JOIN user_project up ON p.project_id = up.project_id
        INNER JOIN \"user\" u ON up.user_id = u.user_id
        INNER JOIN role r ON p.project_id = r.project_id
        INNER JOIN user_project_role upr ON upr.role_id = r.role_id AND upr.user_project_id = up.user_project_id
    WHERE
        u.unix_name = '%{user}' AND u.status = 1
    UNION SELECT p.unix_name as group
    FROM project p
        INNER JOIN user_project up ON p.project_id = up.project_id
        INNER JOIN \"user\" u ON up.user_id = u.user_id
    WHERE
        u.unix_name = '%{user}' AND u.status = 1";
 
/* This part is optional, but allows read-only user browsing via the User Manager plugin */
$conf['plugin']['authpgsql']['getUsers']    = "
    SELECT DISTINCT u.unix_name AS user
    FROM project p
        INNER JOIN user_project up ON p.project_id = up.project_id
        INNER JOIN role r ON p.project_id = r.project_id
        INNER JOIN user_project_role upr ON upr.role_id = r.role_id AND upr.user_project_id = up.user_project_id
        RIGHT JOIN \"user\" u ON up.user_id = u.user_id
    WHERE u.status = 1";
$conf['plugin']['authpgsql']['FilterLogin'] = "u.unix_name LIKE '%{user}'";
$conf['plugin']['authpgsql']['FilterName']  = "(u.firstname || ' ' || u.lastname) LIKE '%{name}'";
$conf['plugin']['authpgsql']['FilterEmail'] = "u.email LIKE '%{email}'";
$conf['plugin']['authpgsql']['FilterGroup'] = "p.unix_name || ':' || replace(lower(r.role_name), ' ', '_') LIKE '%{group}'";
$conf['plugin']['authpgsql']['SortOrder']   = "ORDER BY u.unix_name";

The remaining user functions (add/remove/modify) should be done via the Gforge interface.

plugin/authpgsql/gforge.txt · Last modified: 2014-02-06 18:05 by 84.189.118.76

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki