How To - JACLPlus!
Written by Web Master   
Tuesday, 25 October 2005

Use JACLPlus to Enhance View/Browse Access Control

We think it would be nice for us to explain to you what you can do with JACLPlus. We know there are or will be a couple of Joomla! ACL enhancement hacks out there. However, we have great confidence, once you know how to use JACLPlus and with a few other Joomla! components, you will not choose other Joomla! ACL enhancement hacks and may be other CMS as well. :)

JACLPlus have been implemented to make Joomla! Access Control more powerful. Therefore, every core source code modification have been carefully made to ensure no performance drop or security issue after the modification. If no mistake, we did not add a single SQL query in our modifications to the core files. All we did is just modified the related SQL queries. However, of course we did add some functions and variables and altered a couple of database TABLEs to add some fields to store important data to prevent extra database query.

Okay, after some murmur, let start to show you what can you do with JACLPlus or more precisely how could you control your contents' view access with JACLPlus. Although JACLPlus have been enhanced to include add, edit and publish control, we will not include those guidance here. This article will only provide basic view/browse control setup.

Typical Case

Let say you want to create a website with member login system and you have many types of members. Basically or normally you want to open your website for FREE REGISTRATION and the self sign-up users will become 'Free Member'. After a few months, you think some 'Free Member's contribute a lot to your website and you decide to make them "special" - 'VIP Member'. Therefore you have created special items that only can be accessed by those 'VIP Member's.

However, some users do not have time to contribute to your website but they are willing to pay you to gain access to those "special" items. Then you decide to have 'Paid Member's. Nevertheless, some 'Paid Member's only want to access to certain "special" items and they prefer to pay less. Hence, based on your website items, you have decided to created a few types of 'Paid Member's.

Let say you decide the below types (Groups) of members:

  1. Registered ( Free Member )
  2. Free VIP Member
  3. Paid Member
  4. Paid Gold Member
  5. Paid VIP Member

and you have the below item groups (item can be your content, component, module, menu item etc):

  1. Item Group A - open to all users including public or non-registered users
  2. Item Group B - open to all registered users only
  3. Item Group C - open to Free VIP Members and Paid Gold Members
  4. Item Group D - open to Free VIP Members and Paid VIP Members
  5. Item Group E - open to all paid members ( Paid Members, Paid Gold Members and Paid VIP Members) and Free VIP Members

You should always consider Access Level as "Product Group". This will make more sense to you if you are new to Joomla! Access Level. Okay, let's start and see how to create your ACL (Access Control List).

By default, you have 3 Access Levels and let create another 3 access levels (for this typical case): 

  1. Public
  2. Registered
  3. Special
  4. ItemsC
  5. ItemsD
  6. ItemsE

Now change your items' access level to:

  1. Items in Item Group A, Access Level set to "Public".
  2. Items in Item Group B, Access Level set to "Registered"
  3. Items in Item Group C, Access Level set to "ItemsC"
  4. Items in Item Group D, Access Level set to "ItemsD"
  5. Items in Item Group E, Access Level set to "ItemsE"

And change your user groups' access levels to:

  1. Registered - Public, Registered
  2. Free VIP Member - Public, Registered, ItemsC, ItemsD, ItemsE
  3. Paid Member - Public, Registered, ItemsE
  4. Paid Gold Member - Public, Registered, ItemsC, ItemsE
  5. Paid VIP Member - Public, Registered, ItemsD, ItemsE

The example look very simple, is it? :) I try to give the simplest example so everyone can understand it.

Yeap, if you want to build more complex ACL than this example, you can too. All you have to keep in mind is that once an item group have conflict items, just break it into 2 item groups and create an access level to assign to the new item group. 

Example:

A few months later, you decide certain items in Item Group E can be accessed only by all paid members. However, there is no item group cater for this type of items. Therefore, you have to create a new item group named Item Group F and move the items to this item group:

  1. Item Group A - open to all users including public or non-registered users
  2. Item Group B - open to all registered users only
  3. Item Group C - open to Free VIP Members and Paid Gold Members
  4. Item Group D - open to Free VIP Members and Paid VIP Members
  5. Item Group E - open to all paid members ( Paid Members, Paid Gold Members and Paid VIP Members) and Free VIP Members
  6. Item Group F - open to all paid members only ( Paid Members, Paid Gold Members and Paid VIP Members)

And add an new Access Level named "ItemsF" and now your groups' access levels should be look like this:

  1. Registered - Public, Registered
  2. Free VIP Member - Public, Registered, ItemsC,ItemsD, ItemsE
  3. Paid Member - Public, Registered, ItemsE, ItemsF
  4. Paid Gold Member - Public, Registered, ItemsC, ItemsE, ItemsF
  5. Paid VIP Member - Public, Registered, ItemsD, ItemsE, ItemsF
Last Updated ( Thursday, 26 April 2007 )