ACL Item menù 3.8

Moderators: mandville, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
fabioweb90
Joomla! Apprentice
Joomla! Apprentice
Posts: 29
Joined: Tue Feb 09, 2016 11:02 am

ACL Item menù 3.8

Post by fabioweb90 » Thu Jan 25, 2018 6:31 pm

Hello, as you can see in my screenshot i have 2 item menù called "Infiorescenze" https://ibb.co/npc1PG

"Infiorescenze" under "Collezionismo "must have this condition
1) Visible for "Guest" and "Registered" Joomla User Group
2) Hidden for "Rivenditore" User Group

"Infiorescenze" under "Offerte" must be visible only for "Rivenditore" User Group

Now settings are correct but if i'm logged in as "Rivenditore" User Group "Infiorescenze" under "Collezionismo" is displayed.. How can be hidden?

https://ibb.co/fUqzBw
https://ibb.co/cOtajG

Thanks for help

destrecht
Joomla! Apprentice
Joomla! Apprentice
Posts: 11
Joined: Thu Sep 06, 2012 2:23 am

Re: ACL Item menù 3.8

Post by destrecht » Thu Mar 08, 2018 2:32 pm

Someone please answer this. I'm having the same issue.

User avatar
rcarey
Joomla! Explorer
Joomla! Explorer
Posts: 471
Joined: Sat Apr 25, 2009 9:20 pm
Location: Minnesota (USA)
Contact:

Re: ACL Item menù 3.8

Post by rcarey » Sat Mar 24, 2018 6:37 pm

You have bumped into an issue that can be challenging and is worthy of discussion. I’ll explain the issue as I see it, then I’ll share a couple of solutions.

The challenge is “exclusivity” between groups: a user can (or must) belong to Group A or Group B but never both at the same time. Joomla’s ACL has no mechanism for enforcing this. It is a known challenge in role-based ACL systems, not just for Joomla.

The implementation shown on the second screen shot has group Registered as the parent of group Rivenditore. In this case, a member of Rivenditore is (indirectly) also a member of Registered. So there is no exclusivity between the two groups.

To accomplish what you want (using access lists on the menu item), you need a user group that is exclusive to Rivenditore and have some group assignment enforcing that a member of one cannot be a member of the other. If your subscription extension can enforce this, then that approach seems to be the way to go. If not, you may need some custom extension to handle this.

Assuming neither of those options work for you, I do know of a poor-man’s solution:
[a] Inspect the menu item that you want to hide to members of Rivenditore usergroup. The <li> tag should have a class such as "item-152". Note that class name.
Somewhere in the code (a plugin or a override a template that always appears on the page), assess if the user belongs to usergroup Rivenditore, and if so, invoke this code:

Code: Select all

JFactory::getDocument()->addStyleDeclaration('li.item-152{display:none;}');
I prefer to do this with a plugin and assign the plugin to the Access List item that includes only those users who should not see that menu item. The plugin will run only for users included in the Access List, and when the plugin runs, it uses a CSS rule to hide the menu item. Note: the menu item is still written to the HTML code, but the CSS instructs the browser not to display it.

As proof of concept, I have quickly developed such a plugin, and one where you can specify one or more menu items through the plugin’s parameter. I am sharing this plugin freely with you: http://icueproject.com/downloads/hidemenuitems
Randy Carey -- as of 2023 I'm mostly retired in web development, but still engaged with a few Joomla projects through
Careytech Studios http://careytech.com custom development for tailored or value-added web solutions

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30924
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: ACL Item menù 3.8

Post by Per Yngve Berg » Sat Mar 24, 2018 7:48 pm

Your problem is that Rivenditore inherits Registered as it's a sub-group.
What you can do is create a new group under Registered as a sibling of Rivenditore.
Move all users out of Registered and into the new group. Put the new group in the access level instead of registered.

You can set in the options of user manager that new user is made a member of the new group instead of Registered.


Locked

Return to “Access Control List (ACL) in Joomla! 3.x”