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:
{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.
{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:
// 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;
}