Page 1 of 1

Hide Unaccessible Categories

Posted: 02 Mar 2016, 20:04
by ax_q3a
Hi there,

First of all, thanks for the Phoca Download Component, much appreciated.

However, I've got a question about hiding unaccessible categories. Maybe it's an option I've overlooked (in that case: sorry :oops:), but here is what I want to accomplish:

I have three users: Super User, UserA and UserB.
I have one parent Category (Parent), which has three subcategories (001, 002 and 003).

UserA has access to subcategory 001 and 003 (and the files within), UserB has access to subcategory 002 (and the files within).

So far so good, with the Access Group Level and Access Rights in place, the users can only access their own categories and files. However, I would like to hide the categories that a user cannot access. So that UserA only sees category 001 and 003 and UserB only sees category 002.

Two reasons for that: 1) It looks better and 2) the final download section will have more than 50 categories but the different users will only have access to about ten. So I would like to hide the 40 categories for which they don't have permission to download the files within.

This option is available in the Phoca Download Tree Module (Display Unaccessible Categories = No), so it displays for UserA:

Categories
- Parent
-- 001
-- 003

However, if UserA chooses 003 and the files in 003 are shown, he can use the UP arrow in the top right to go to the Parent category and that will show 001, 002 and 003. If he clicks 002 it will give the error message "You have no rights to access this category" (which is correct), but I don't want him to be able to see 002 at all. Effectively, I need the "Display Unaccessible Categories = No" option for the Component. :|

Please help me to accomplish this, because that would really make this component perfect for my needs.

Thanks,

Axel

Re: Hide Unaccessible Categories

Posted: 05 Mar 2016, 19:27
by Jan
Hi, in fact you cannot prevent from displaying the category for the user - the category has own unique page, so if e.g. user has the link to this category - he/she will be able to click on this page - of course it is protected so no files will be displayed, but you cannot prevent from "disappearance" of the link - the link must exist because of other users.

So the idea is:
- remove the up buttons from displaying
- or add the user right to them - so it will be only displayed in case the category can be access by the user - in category view - to dected which category ID is bundled with the up icon and such then check for the rights :idea:

Code: Select all

$rightDisplay	= 0;
		if (!empty($this->category[0])) {
			$rightDisplay = PhocaDownloadAccess::getUserRight('accessuserid', $this->category[0]->cataccessuserid, $this->category[0]->cataccess, $this->t['user']->getAuthorisedViewLevels(), $this->t['user']->get('id', 0), 0);
		}
		// - - - - - - - - - - - - - - - - - - - - - -
		if ($rightDisplay == 1) { ... then display the up arrow
Jan

Re: Hide Unaccessible Categories

Posted: 07 Mar 2016, 16:22
by ax_q3a
Hi Jan,

Thanks for your help. I have linked the UP-button to the general view (List Of Categories (Categories View)). That way, users only see their own accessible subcategories and they cannot go 1 step up (which would show them all subcategories), only back to the beginning. I won't even need the Folder Tree with this solution.

Thanks!

Re: Hide Unaccessible Categories

Posted: 08 Mar 2016, 20:55
by Jan
Ok