How to Create a Private Category

A very simple introductory example with a Category, its Downloads, and a menu item that can only be seen by specific users.

Here by a private category we mean that only people who belong to a specific Joomla User Group can see the category, and as a result only those people would be able to access any download within that category. The reason why this is quite simple to implement is because jDownloads fully implements the Joomla ACL scheme.

This simple example will outline what needs to be done to create a Private Category, or rather will show a way in which a Private Category may be implemented. There may well be other ways!

Actually most of the setup is with the Joomla ACL. We will have a user called Sam who will belong to a Joomla User Group called Sam-group. We will also create a View Access called Sam-view. So first let us do the Joomla part.

The first step is to create a new Joomla User Group. This is very simple, just go to User Groups, use the create a new group button.

Give it the appropriate name, which in this case is Sam-group. Then assign it to a Parent Group.

For users of a Private Category who will only be allowed to ‘download’ then it is suggested using Registered as the Parent Group. When these Private Category users are also to be allowed to  ‘upload’ to create a Download then create another user group.  This could conveniently have the 'downloader only' group as its parent so that it will automatically inherit any permissions from the 'downloader only' group.

You may ask why use the Registered group as the 'base' group?  The reason is that if you give Edit or higher as the parent group then those users in the group may be able to edit other articles unless you specifically 'deny' in Joomla! articles.  That could be a lot of work!

CrePriv01

The results of creating the Sam-group with Registered as its parent group are shown opposite.

It is not the position in the list but the degree of indenting that indicates the ‘parent group’.

Once we have created the group we can assign users to it, and, most importantly, add the user group to a View Access.

CrePriv02
The picture on the right shows Sam is just assigned to the ‘Sam-group’ Group. CrePriv03A

The next step is to add User Group ‘Sam-group’ to a View Access.


Here ‘Sam-group’ has been added to Viewing Access Level ‘sam-view’. It is in fact the only user group that has that specific level of view access. This of course is the mechanism which will ensure having a ‘Private Category’ in jDownloads.

CrePriv04

The Joomla! Parts are now done. So the next step is to create or modify a jDownload Category. In keeping with the rest of this example we will call the category ‘sam-cat’.

 

 

As shown opposite category ‘sam-cat’ is assigned to a suitable parent category, which in this example happens to be one called ‘Other’. It could be a top level category if wanted.
The key step is of course to set its access to ‘sam-view’.

CrePriv05
We are now done, but let us see what happens from the front end. As illustrated opposite a regular way of seeing jDownload Categories would be through a List All Categories menu type, which in this example has a name ‘List All Cats’ CrePriv07
The result, as illustrated opposite, shows the top level categories. Recall that 'sam-cat' is a sub category of 'other'.
Note all the details about the categories have been omitted from the screen-shot.
CrePriv08
If we select the ‘other’ category to show is sub categories then the result depends on whether someone, such as Sam, from the ‘Sam-group’ is or is not logged in. Notice that jDownloads gives the correct number of categories in both cases. That is as far as the non-members of ‘Sam-group’ are concerned they are not being denied access, they are simply not aware that the category ‘sam-cat’ exists.
         View when Sam logged in     | View when Sam not logged in
CrePriv08ACrePriv08B

This however is not the end of the story as we could be even more selective by using the jDownloads ‘Single Category’ menu type. Here we would have a Joomla menu item for each ‘Private Category’. The jDownloads setup is the same as before but we use the View Access in the Joomla menu to see who can see what.

Setting up the Joomla menu is straightforward.

In my very simple test site the jDownloads Menu is in the Main menu, so the menu below was set up accordingly.

  • The menu title is ‘Sam-group Only’.
  • Menu type is jDownloads ‘Single Category’.
  • The category is ‘sam-cat’, also note that jDownloads indicates the category level with the --.
  • Access is Sam-view.

At the Front End the result is as below, that is only logged in members of the 'Sam-group' see the 'Sam-group Only' menu item.

Menu when no one from Sam-group logged in   Menu when someone from Sam-group logged in
CrePriv12             CrePriv11

This can obviously be extended so that different groups have different 'Private Categories' and they have their own menu item.  Some people could belong to multiple groups.

ACL and View management can be "challenging" at first.  Many tutorials concentrate on just the ACL permisions themselves but it is the combination of that with View Access that creates the flexibility.  For more extensive examples see Controlled Access to Categories and Downloads

Colin Mercer May 2014, modified January 2015