Make visibility of containers and forums themselves configurable

Created on 20 March 2023, over 1 year ago
Updated 4 May 2024, about 2 months ago

Problem/Motivation

I want a forum for logged in users only.
I can successfully use permissions_by_term to hide the actual posts, but that's not enough, as external people won't set this correctly, it should be enforced.

I don't think it makes sense to be able to restrict whether posts can e.g. be created (with the permission create forum content) or edited, deleted, etc. separately from the actual permission to view the containing topics/forums/containers.

Steps to reproduce

Create a role "members"
Assign permissions for handling forum posts only for this role.
If a user with role "members" logs in, everything works as expected.
However, /forum and /forum/{id} are visible for anonymous users as well. They cannot actually read the posts, which is good, but then they should not be able to see containers/topics, either.

Proposed resolution

Chain the ability to view container/topics to the create forum content permission.
At leasts that's what I do now, with a custom module along the lines of https://drupal.stackexchange.com/questions/241880/override-specific-rout... (i.e. extend RouteSubscriberBase and use alterRoutes() to add my permission requirement).
Or use some other configuration option to let admins decide who can see containers/topics.

User interface changes

Probably add another configuration option or just add a help text that states users have to have write permissions to view containers and topics as well.

✨ Feature request
Status

Closed: duplicate

Version

2.0

Component

Code

Created by

πŸ‡¦πŸ‡ΉAustria tgoeg

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

Comments & Activities

  • Issue created by @tgoeg
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    Access to those routes is controlled via the 'access content' permission.

    I would support making it 'access forum content' or similar, but let's wait for the module to be removed from Core.

  • Status changed to Postponed over 1 year ago
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10
  • πŸ‡¦πŸ‡ΉAustria tgoeg

    Yeah, that sounds reasonable. I just resorted to the create forum content permission as I didn't find one only specifying a read permission.

  • πŸ‡¦πŸ‡ΊAustralia Mingsong πŸ‡¦πŸ‡Ί

    Thanks @Rowlands for clarifying that.

    I has a similar question about how to unpublish a forum/container?

    The steps I tried is:

    1. Login as an admin user who has the permission to manage forums.
    2. Go to the forum manage page. (/admin/structure/forum)
    3. Edit one of the forums. For example (/admin/structure/forum/edit/forum/5)
    4. In the edit page, unpublish this forum by untick the 'Publish' box.
    5. Save the edit page.
    6. Logout the admin user.
    7. Visit the forum landing page as an anonymous. (/forum)
    8. At this stage, the unpublished forum still visible to the public. (My site grants 'access content' permission to anonymous to allow public visiting published contents)
    9. Click the unpublished forum in that list.
    10. Now, I can access the unpublished forum as an anonymous.
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    Can you open a separate issue for that (against Drupal core, as forum is still part of core). I'm guessing that was overlooked when taxonomy terms got a published state.

  • πŸ‡¦πŸ‡ΊAustralia Mingsong πŸ‡¦πŸ‡Ί

    Thanks @Rowlands for prompt reply.

    Sure, I will try the Forum module from the core to double check if it behaviours in the same way.

    If so, I will raise this issue to core.

  • πŸ‡¦πŸ‡ΊAustralia Mingsong πŸ‡¦πŸ‡Ί
  • πŸ‡¦πŸ‡ΊAustralia Mingsong πŸ‡¦πŸ‡Ί

    Raised this issue to Drupal core.

    πŸ› Unpublished forum accessible to public Active

  • Status changed to Active about 2 months ago
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10
  • Status changed to Closed: duplicate about 2 months ago
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10
Production build 0.69.0 2024