www.frotzware.com

Mambo - Adding support for Customers and Partners PDF Print E-mail
Written by Frotz   
Monday, 25 July 2005
This article walks through the changes that need to be made to support a corporate website with customers and partners.

Prerequisites:

  • It is assumed that you are running MamboServer 4.5.2 or later.
  • Although not necessarily required, I use phpmyadmin to access the MySQL database behind MamboServer. The specific instance that I prefer to use comes from the fine folks at ApacheFriends.org.

Database Changes:

Use your favorite MySQL tool to issue the SQL found below against your Mambo database. I use phpmyadmin for simplicity and accessibility regardless of my workstation capabilities.

WARNING: Your tables may be different, so you may need to adjust the SQL below appropriately.

-- Add Customers
SET @parent_name = 'Registered';
SET @new_name = 'Customer';

SELECT @ins_id := group_id, @ins_lft := lft, @ins_rgt := rgt
FROM mos_core_acl_aro_groups
WHERE name = @parent_name;

SELECT @new_id := MAX(group_id) + 1 FROM mos_core_acl_aro_groups;

UPDATE mos_core_acl_aro_groups SET rgt=rgt+2 WHERE rgt>=@ins_rgt;
UPDATE mos_core_acl_aro_groups SET lft=lft+2 WHERE lft>@ins_rgt;

INSERT INTO mos_core_acl_aro_groups (group_id,parent_id,name,lft,rgt)
VALUES (@new_id,@ins_id,@new_name,@ins_rgt,@ins_rgt+1);

-- Overwrite the "special" access level.
SELECT @next_gid := MAX(id) FROM mos_groups
UPDATE mos_groups set name = @new_name;

-- Add Partners
SET @parent_name = 'Customer';
SET @new_name = 'Partner';

SELECT @ins_id := group_id, @ins_lft := lft, @ins_rgt := rgt
FROM mos_core_acl_aro_groups
WHERE name = @parent_name;

SELECT @new_id := MAX(group_id) + 1 FROM mos_core_acl_aro_groups;

UPDATE mos_core_acl_aro_groups SET rgt=rgt+2 WHERE rgt>=@ins_rgt;
UPDATE mos_core_acl_aro_groups SET lft=lft+2 WHERE lft>@ins_rgt;

INSERT INTO mos_core_acl_aro_groups (group_id,parent_id,name,lft,rgt)
VALUES (@new_id,@ins_id,@new_name,@ins_rgt,@ins_rgt+1);

SELECT @next_gid := MAX(id)+1 FROM mos_groups
INSERT INTO mos_groups (id, name)
VALUES (@next_gid, @new_name);

-- Add Employees
SET @parent_name = 'Partner';
SET @new_name = 'Employee';

SELECT @ins_id := group_id, @ins_lft := lft, @ins_rgt := rgt
FROM mos_core_acl_aro_groups
WHERE name = @parent_name;

SELECT @new_id := MAX(group_id) + 1 FROM mos_core_acl_aro_groups;

UPDATE mos_core_acl_aro_groups SET rgt=rgt+2 WHERE rgt>=@ins_rgt;
UPDATE mos_core_acl_aro_groups SET lft=lft+2 WHERE lft>@ins_rgt;

INSERT INTO mos_core_acl_aro_groups (group_id,parent_id,name,lft,rgt)
VALUES (@new_id,@ins_id,@new_name,@ins_rgt,@ins_rgt+1);

SELECT @next_gid := MAX(id)+1 FROM mos_groups
INSERT INTO mos_groups (id, name)
VALUES (@next_gid, @new_name);

Net Result:

When you are done, you will have updated the table mos_groups (access level) so that content items can be visible only for certain groups of users. For example. Employees are entitled to see articles that Partners cannot, Partners can see articles that Customers cannot, and Customers can see articles that Registered or Public users cannot see.

You will also have created corresponding entries so that you can tag the users as Customer, Partner, or Employee, in addition to the default user classes. You will now need to run through your Users database and ensure that all users have the correct access level.

Attribution:

These instructions were found in ./includes/gacl.class.php. [gaclphp.sourceforge.net]

Last Updated ( Thursday, 18 May 2006 )
 
< Prev   Next >