Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If I select multiple roles (terms) as to who has access, it is being treated as an AND.
How can we support setting content for roles A, B, or C without requiring that every user has all 3 roles?
Comments
Comment #2
kevinquillen CreditAttribution: kevinquillen at Velir commentedFor example, I want to grant view access to 4 roles, but NOT require every viewer to have all 4 roles, just be in one of those roles. That does not seem to work.
Comment #3
hobbsgoblin CreditAttribution: hobbsgoblin commentedAgree. The ability to select AND/OR should be added or the default should be set to OR.
Comment #4
stijndmd CreditAttribution: stijndmd at 3SIGN commentedI didn't bother with the option between AND / OR.
Here's a small patch that grants access and breaks the loop as soon as we find a role that is required for node access.
Comment #5
Peter MajmeskuComment #6
Peter MajmeskuComment #8
Peter MajmeskuI have added this feature into release 8.x-1.28. See more details here: https://www.drupal.org/project/permissions_by_term/releases/8.x-1.28.
Please test release 8.x-1.28 and re-open this issue, if you have any objections.
Thanks again for the feature request and the discussion.
Comment #9
stijndmd CreditAttribution: stijndmd at 3SIGN commentedI have tried updating to 1.29 and it doesn't work.
Steps tot reproduce:
1) Create three user roles "One", "Two" and "Three"
2) Create a taxonomy "Permissions to view" with 3 terms "One", "Two" and "Three", linked to the corresponding roles
3) Create a content type with a term ref field to this new taxonomy
4) Create a node of the content type and for the term reference, choose two random options
1) With "Single Term Restriction" UNCHECKED
WHAT WE SEE: anonymous users have access
WHAT WE WANT: anon users should not have access, because they have none of the required roles
2) With "Single Term Restriction" CHECKED
WHAT WE SEE: user 1 doesn't have access anymore + anon users still have access
WHAT WE WANT: user 1 should always have access + anon users should not have access, because they have none of the required roles
Comment #10
Peter MajmeskuThanks for reporting. I have already started to work on this.
Comment #11
Peter Majmesku@stijndmd: I have fixed the access restriction logic in release 8.x-1.30. Afterwards I could not reproduce your issue anymore by the given scenario steps.
Please test and re-open this issue, if you have any further objections.
Comment #12
stijndmd CreditAttribution: stijndmd at 3SIGN commentedI just updated to the latest stable version (1.32) and the issue is fixed indeed.
Comment #13
mausolos CreditAttribution: mausolos commentedI don't think this is EXACTLY the same thing, but I wonder if solving mine would help with yours in some way (or vice-versa)?Never mind, I don't seem to have any idea what I'm talking about today. Disregard.