Path-based policies

Created on 23 August 2023, 10 months ago

Problem/Motivation

This module is extremely powerful, but seems restricted to implementing policies based on content field values (or time). Often I have heard site owners ask for the ability to control access for "sections" of the site, which often could be easily mapped to path patterns.

Proposed resolution

Allow for rule patterns that can be applied using path patterns, similar to how block visibility is specified.

A bonus would be the ability to have patterns that specify exclusions, similar to what the Block Exclude Pages → module provides

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇨🇦Canada mandclu

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mandclu
  • 🇺🇸United States partdigital

    Hi @madclu, thanks for the suggestion!

    Access based on path alias hadn’t even occurred to me! I’ll add it to our list of ideas and spend some time investigating it. If you have any more thoughts about it I’d love to hear it!

    In the meantime, for anyone who may be reading this, you can achieve something similar to this using this workaround.

    1. Add a Section vocabulary
    2. Add a Section taxonomy term entity reference field to a node
    3. Add a Section taxonomy term entity reference field to a user
    4. Install the pathauto module and add this pattern: [node:field_section]/[node:title]
    5. Add the Section taxonomy terms to users and content
    6. Create a new Access policy called “Sections”
    7. Choose Group as the access policy type
    8. Add the access rule: Field match: Section - Compare taxonomy terms between the content item and current user”
    9. Go to Manage permissions and choose the roles who should be able to view content with this policy.
    10. Edit each node and assign the "Section" access policy.
Production build 0.69.0 2024