A privileges Quandary
Posted
#6269
(In Topic #1354)
How to require duel group membership
Hi Guys,I use groups to set access levels for downloads. I have an unusual situation where I need to allow access to specific download only to members in both of 2 groups. Let me try to explain;
Group A - All members
Group B - A privileged group of specific members that don't necessarily have access to group C
Group C - A privileged group of specific members that may or may not have access to group B
Groups B & C have their own Zones where group B members cannot access group C and visa versa.
In Zone B there is a menu item leading to downloads for members of group C which is not accessible to group B members unless they have group C membership as well. This works as expected.
Zone C also has the same type of menu item which requires the group C members to also have group B membership in order to display the menu content. Again, this works as expected.
Here's the rub, if a group C member navigates directly to the files of group C but does not have group B membership, they still get access.
If I've not explained that very well try this; I have downloadable content that I want only members of both groups (B & C) to gain access and I can't think of a way of doing it. (Access = B AND C NOT B XOR C)
If I still haven't explained it well enough and you're up for the challenge, please let me know.
Thanks for reading this.
TQ
Posted
sources_custom/hooks/systems/cns_implicit_usergroups/under18s.php · v11 · Composr ecosystem / Composr · GitLab
It puts people in a particular usergroup based on some kind of conditional check. "B AND C" would be the logic in your case.
Posted
sources_custom/hooks/systems/cns_implicit_usergroups/usergroup_intersection.php · v11 · Composr ecosystem / Composr · GitLab
To work the numbers on line 28 and 33 would need customising.
I made it support any number of intersections, with 3 in this file. But it could be 2, or even 40.
(I realise v10 is an unresolved issue for you at the moment)
Posted
It puts members into a usergroup DYNAMICALLY.
That is, when Composr checks to see what usergroups a member is in, or what members are in a usergroup, it checks these hooks on-the-fly.
1 guest and 0 members have recently viewed this.
