How to Create a Private Category

Introduction

A simple introductory example with a Category, its Downloads, and a menu item that can only be seen by specific users.
For Individual User Access see Single User Acess (opens in separate tab/window).

Here by a private category we mean that only people belonging to a specific Joomla User Group are able to 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 is because jDownloads fully implements the Joomla ACL scheme.

This 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!

Much of the setup is within Joomla!.  We will have a user called Sam who will belong to a Joomla User Group called SamUG. We will also create a View Access called 'sam-view'. So first let us do the Joomla part.

Setting up User Groups and View Access Levels

The first step is to create a new Joomla User Group. This is very simple, just go to Users button then click on V4 button groups. This shows the V4 button groups This shows all the existing User Groups. To create a new goup click on the V4 button new which will give an entry form susch as shown opposite.

Give it the appropriate name, which in this case is SamUG and assign Registered as its Parent Group. Then V4 button save close.

crepriv20
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 'SamUG' group may be able to edit articles and other non jDownloads content.

If some of these Private Category users are also to be allowed to create or edit a Download in the Private category, then create another user group called say 'SamUploaderUG'. 
This User Group would have 'SamUG' group as its parent.  Members of the 'SamUploaderUG' will automatically become members of the 'SamUG' and the Registered user group by inheritance.
crepriv21

The result of creating the Sam-group with Registered as its parent group, and if appropriate the SamUploaderUG with SamUG as its parent, 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(s) to a view Access Level.
crepriv23
The next step is to create a suitable view Access level so that only members of the SamUG will be able to see the Private Category.
So go to V4 Users buttonV4 button access levelsV4 button new and create an access level called SamView.
Add the SamUG as its only user group member.

If you have created a 'SamUploaderUG' then another view Access Level, called say SamUploaderView, will be required.  So repeat the process but with 'SamUploaderUG' as the only member.
crepriv22

Create Test Users

At this point it is useful to create some test users, one as a member of the SamUG and, if appropriate, another user as a member of the SamUploaderUG.  In my testing I called one Sam with an email of 'sam@nowhere.com' and the other as SamUploader with an email 'samuploader@nowhere.com'.   Sam was allocated to the SamUG user group and SamUploader was allocated to SamUploaderUG.
To create, or edit, a user click on V4 button Add UsersThis opens up the New User Details which has five sections as shown opposite.  For present puposes  we just need to use the first two sections: Account Details and Assigned User Groups.
User Sam was created as usual and was assigned to the 'SamUG' usergroup. User SamUploader is allocated to the 'SamUploaderUG' usergroup.
V4 NewUserDetails

Menu Link to Create/Edit Downloads from Frontend

(This section is only required if you are allowing Downloads to be created in a 'private' category, such as sam-cat and any of its subcategories, in the front-end.)

Create a jDownloads menu in the usual way - for more information see Create jD Menu Item (opens in a new window/tab)

On the Details tab select menu item type as 'Create Download', and ensure you set view Access as 'SamUploaderView'.




On the Options tab ensure you set 'Default Category' to No (this is the default setting).

If you set to Yes then you will ONLY be able to create or edit in that particular category and not any of its subcategories.  See notes on User Groups Settings below.
crepriv26V4 create menu item04crepriv27
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'.

Create the jDownloads Category and Set Permissions



The simplest organisation is to create 'Sam-Cat' as a top level category, that is one with no parent category.  Ensure it is 'Published' and the Access is set to SamView.

If you create a sub category of 'sam-cat' then when it is saved the Access Level will automatically be set  to ‘SamView’.

CrePriv05
After creating the category select the Permissions tab, then select the 'SamUploaderUG' user group.

Then as illustrated, in the 'Select New Setting' column choose Allowed for Create, Edit and Edit Own.  If you wish to allow the uploader to be able to change the Pubished state then also select the Edit State.  A tickcrepriv tick will appear along side each permission as it is selected for modification.

Next click on the Save button crepriv save  in the tool bar.







This will show the permssions again but the black V4 black tick matks are no longer present. 


This indicates that the permission have been saved and will propogate to any sub categories or Downloads.


crepriv34crepriv35

Setting jDownloads User Group Ranking values and the Default Category

(This section is only required if you wish to allow Downloads in the 'private' category to be created or edited in the frontend.)

So that the correct jDownloads User Groups settings apply then 'SamUploaderUG' must have a jDownloads ranking value larger that that of the Registered usergroup.

Please see Initial view of permissions (opens in a new window/tab) if you need more information about the importance of jDownloads ranking values.

To set the Ranking value go to Components and select jDownloads.

Then select V4 button User group setting.

The Ranking entry is at the top of the page just under the Group Title and before the tabs.
A suitable value for the 'SamUploaderUG' would be say 125.
crepriv24

User Group Settings


We can use the User Groups Settings to specify what items the SamUploaderUG users can set when creating or modifying a Download in the private category, 'sam-cat'.

There is one particular setting which is most important for our 'private' category in order to let it have private subcategories.

This is in the 'Group Creation/Editing Settings'.  Make sure that the option 'May select a different Category is set to Yes as indicated opposite.

To demonstrate this a subcategory of 'sam-cat' called 'SamCat-sub1' was created in the backend. NOTE Categories and Sub Categories can only be created in the Back End. 

When it was created then 'sub-private' automatically acquired the permissions and view access of its parent, 'sam-cat'. 

Similarly when Downloads are created they acquire the permissions and view access of their containing category.


So when creating a new Download from the front end, jDownloads will only show the appropriate categories as illustrated opposite.

crepriv36crepriv37

Front End View

We are now done, but let us see what happens from the front end.



The first image on the right shows the results of  List All Categories menu item when user sam is Logged in.

The image on the far right is when sam is not Logged In

CrePriv30V4 Sam logged out


This can obviously be extended so that different groups have different 'Private Categories' and they have their own menu item for creating/editing Downloads from the frontend.  Some users 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.

ColinM November 2019, updated May 2023

Print Email

We use cookies

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.