ACL Item menù 3.8

Moderators: mandville, PhilD, General Support Moderators

fabioweb90
Joomla! Apprentice
Joomla! Apprentice
Posts: 28
Joined: Tue Feb 09, 2016 11:02 am

ACL Item menù 3.8

Postby 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: 9
Joined: Thu Sep 06, 2012 2:23 am

Re: ACL Item menù 3.8

Postby 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: 469
Joined: Sat Apr 25, 2009 9:20 pm
Location: Minnesota (USA)
Contact:

Re: ACL Item menù 3.8

Postby 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.
[b] 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, the iCue Project http://iCueProject.com : developing an intelligent approach to improving the CMS user experience,
Careytech Studios http://careytech.com custom development for tailored or value-added web solutions

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

Re: ACL Item menù 3.8

Postby 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.


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

Who is online

Users browsing this forum: No registered users and 1 guest