Welcome, Guest. Please login or register.
Did you miss your activation email?
May 27, 2012, 05:35:31 AM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155555 Posts in 21715 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Patch for multiple groups & LDAP support  (Read 2725 times)
tavitar

Offline Offline

Posts: 9


« on: August 27, 2007, 01:13:57 AM »

Hi,

We've being using WebsiteBaker for a couple of years in our organisation and have found it brilliant in terms of logical layout and simplicity.

There's just been a few things missing which we've really missed so I've created a set of patches (for WB 2.6.7) and placed them at: http://wb-mods.lism.catholic.edu.au/pages/patches.php

I know they're not modules as such but I wasn't sure where else to post this.

I hope people find them useful.  smiley

Regards,
David
Logged
doc
Guest
« Reply #1 on: August 27, 2007, 06:06:38 AM »

Hello,

thanks for the link with your patches. Maybe some of them can be taken over to one of the next WB releases.

Regards Christian
Logged
bhb2000

Offline Offline

Posts: 1


« Reply #2 on: August 28, 2007, 08:12:14 AM »

Hi there,

Great patch .. I think it should be included as a feature in future Baker versions.

I tested it under Windows and it is working just fine except for two tiny bugs described below:

Code:
{bug: 00001}
 {file: wb\admin\pages\index.php}
 {ver: 2.6.7 + multiple groups patch}
 {author: Bushra Addlan}
 {timestamp: 20070828:015526}

 Overview:
 When loading the index.php file in the "Pages" section,
 the form that is supposed to be used for adding pages is
 missing one or more groups in the administrators panel on
 the right as well as the page visibility panel.

 The logic behind this part of the code is to load all
 groups from the database except the ones that belong to
 the current user. However if the user is an administrator
 all the groups will be loaded and displayed. The
 Administrators group option is displayed at the top of the
 list and is selected by default. After that come the
 current user's groups (loaded from session) to be displayed
 and selected by default as well. Finally the code loops
 through the rest of the groups that had been loaded by the
 query and displays them based on their "pages_modify"
 permission.
 
 The problem:
 In this section of the code the system only
 loads the current user's group which is deprecated in the
 utliple groups patch with the new groups_id logic. The
 patch ignored this part completely; consequently, the
 system only displays the Administrators group and the last
 group returned by first query (see bug 00002).

 The solution:
 Loop through all current user's groups (loaded from session
 using admin->get_groups_id()) and display the groups
 recursively.



Code:
{bug: 00002}
 {file: wb\framework\class.login.php}
 {ver: 2.6.7 + multiple groups patch}
 {author: Bushra Addlan}
 {timestamp: 20070828:025011}

 The problem:
 Only the name of the last group in the groups table is
 written to the session under the variable GROUP_NAME.

 The solution:
 The variable GROUP_NAME is initialized as an array and
 the mutliple groups' names are appended to it. This
 leads to the modification of the function:
 class.wb.php::get_group_name() and the creation of:
 class.wb.php::get_groups_names().


Additional code:

Code:
   // Get the current user's group name
    function get_group_name() {
        return implode(",", $_SESSION['GROUP_NAME']); // returns an string
    }
   
    // Get the current user's mutliple groups names (if more than one exist)
    function get_groups_names() {
        return $_SESSION['GROUP_NAME']; // returns an array
    }
   
    /* Utility function to combine the keys and values from two different arrays.
     * Required for php.version > 5.0
     */
    function array_combine($keys, $values) {
        $result = array();
        foreach(array_map(null, $keys, $values) as $pair)
            $result[$pair[0]]=$pair[1];
        return $result;
    }

Logged
tavitar

Offline Offline

Posts: 9


« Reply #3 on: August 29, 2007, 12:20:21 AM »

@bhb2000

Thanks for the clear bug reports. I'll post an update soon.

David
Logged
tavitar

Offline Offline

Posts: 9


« Reply #4 on: August 29, 2007, 05:23:24 AM »

I've update the patch to fix the page rights:
http://wb-mods.lism.catholic.edu.au/media/wb-multiple-groups-0_2_0.patch

I'm a bit unsure about how the access rights should work. At the moment, in the page setup, it selects all groups that the current user is in as mandatory rights, unless the user is in the administrator group in which case only the administrator group is selected.
The same action is taken when a user updates a page in the page settings. Is this the most logical setup?

I guess the alternative would be to allow the user to select any group (except administrator) and then make sure they haven't completely removed there own access to the page on a page add (add.php) or page save (save.php). ie. Post validation.

Any ideas?

Thanks,
David
Logged
tomhung

Offline Offline

Posts: 353


« Reply #5 on: August 29, 2007, 04:08:25 PM »

This is for all the Noobs who dont know how to apply a patch.  At least this is the steps I followed.

Code:
# cd /opt/lampp/htdocs
Code:
# wget http://wb-mods.lism.catholic.edu.au/media/wb-multiple-groups-0_2_0.patch
Code:
# patch -p0 < wb-multiple-groups-0_2_0.patch

My copy has already deleted the install/ directory.  You will have to skip patching this file, cause it ain't there....

Greg

Logged
tavitar

Offline Offline

Posts: 9


« Reply #6 on: August 29, 2007, 11:38:22 PM »



My copy has already deleted the install/ directory.  You will have to skip patching this file, cause it ain't there....


If you apply this patch to an existing installed site, you will need to manually add a field called groups_id varchar(255) to the users table and copy the value of the group_id into this new field for each user (admin users need the value 1).

To make it easy, apply the patch to a new site before running the website baker install.

David
Logged
XPfrik

Offline Offline

Posts: 4


« Reply #7 on: October 16, 2007, 12:26:17 PM »

How to apply patch in windows?

It would be maybe nice if someone could put together all changed files and publish them here so we could just owerwrite the old ones. Please do...

Thanks in advance.
Logged
tavitar

Offline Offline

Posts: 9


« Reply #8 on: January 06, 2008, 11:21:46 PM »

Sorry for the slow reply. For windows users here's some versions of WB with the patches already applied:

Multiple groups
http://wb-mods.lism.catholic.edu.au/media/websitebaker-2.6.7-mg.tar.gz

Multiple groups + LDAP Support
http://wb-mods.lism.catholic.edu.au/media/websitebaker-2.6.7-ldap.tar.gz
Logged
whowe82

Offline Offline

Posts: 2


« Reply #9 on: September 08, 2008, 03:02:10 PM »

not to sound like a n00b (to this I am though), but how do I configure wb after the patch so it will auth to server 2003 AD??  Thank you in advance!
Logged
kweitzel
Forum administrator
*****
Offline Offline

Posts: 6977


WWW
« Reply #10 on: September 08, 2008, 07:32:29 PM »

Since LDAP is a standard protocol it should be possible to connect against Windows AD via LDAP.

cheers

Klaus
Logged

WebsiteBaker Org e.V. - for WebsiteBaker

whowe82

Offline Offline

Posts: 2


« Reply #11 on: September 08, 2008, 09:12:17 PM »

Sorry, what I meant was, what information do I put in the fields??
Logged
tavitar

Offline Offline

Posts: 9


« Reply #12 on: September 09, 2008, 12:29:32 AM »

in ldap_config.php:

$ldap_host = // IP address (or dn) of the ldap server
$ldap_binddn = // if you need to bind to search this is the dn of the user to use. eg. cn=admin,dc=org
$ldap_bindpw = // the bind user's password
$ldap_base =  // where to start the search eg. dc=org
$ldap_user = // attribute the username is stored in, eg. cn
$ldap_pass = // attribute the password is stored in
$ldap_gn = // attribute the givenname is stored in
$ldap_sn = // attribute the surname is stored in
$ldap_mail = // attribute for the email address
$ldap_member = // attribute of the user for it's group membership
$ldap_admin = // a single username to place in the administrator group. eg. admin

Hope that helps,
David
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!