A privileges Quandary

Post

Posted
Rating:
#7053 (In Topic #1920)
TQ
Avatar
Standard member
TQ is in the usergroup ‘Well-settled’

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

hamfiles.co.uk
Online now: No Back to the top

Post

Posted
Rating:
#7056
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
The best approach would be to write a cns_implicit_usergroups hook. Here's an example of one…
https://gitlab.com/composr-foundation/composr/-/blob/master/sources_custom/hooks/systems/cns_implicit_usergroups/under18s.php

It puts people in a particular usergroup based on some kind of conditional check. "B AND C" would be the logic in your case.


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Online now: No Back to the top

Post

Posted
Rating:
#7093
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
Here we go, I implemented an example as a new v10 addon…

https://gitlab.com/composr-foundation/composr/-/blob/master/sources_custom/hooks/systems/cns_implicit_usergroups/usergroup_intersection.php

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)


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Online now: No Back to the top

Post

Posted
Rating:
#7094
Avatar
Site director
Chris Graham is in the usergroup ‘Administrators’
I suppose I should explain what an implicit usergroup hook is briefly.

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.


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Follow me on Minds (where I am most active). Support me on Patreon

Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Online now: No Back to the top
1 guest and 0 members have just viewed this.

Statistics

Back to Top