Even with the various forum access modules out there, there's no simple way to just disable forums completely for anonymous users. They still at least see the presence of forums, or see that there are no forums they have access to.

This patch addresses that by introducing a new permission, "access forums", that applies to the /forums path instead of the generic "access content". It has no other changes.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dries’s picture

I'm worried that this patch might cause confusion, and that it is somewhat misleading. People will expect their forum topics to be protected too. At the same time, I recognize that we need a permission like this. Maybe we should call it 'access forum listing' instead? It might be slightly better, yet far from optimal.

webchick’s picture

I personally would be more in favour of getting a full-fledged CRUD access system for forums ala forum access module, or else a consistent set of 'access FOO node type' permissions in core, since we already have CUD for those. :)

Crell’s picture

FileSize
935 bytes

Full CRUD for all node types would be great, but I'm just thinking small here at the moment. :-) Also, this isn't CRUD on forum nodes but on the forum listing page itself, which is specific to forum module. It's orthogonal to node CRUD permissions. Right now there is simply no good way to have forums that exist only for authenticated users. This gives us a way. I very much do not have time to give forum module a full overhaul, so I'm just tossing in an incremental improvement.

Here's a reroll with the permission name Dries said he prefers. No other changes.

majortom’s picture

I posted this in WebChix critical features section, however, it seems relevant here as well.

I think that much finer grain permissions are very important.

Viewing:
Allow a user to see a list of forum groups.
Allow a user to see a list of forums within a group.
Allow a user to see the topic headings in a forum.
Allow a user to see a particular thread (this is optional but would be nice).
Allow access to specific items within a post or thread (e.g. poster user name, poster IP address, poster IP address country,
poster's online/offline status).

Posting/Reporting:
Allow a user to post a new topic.
Allow a user to post a reply to an existing topic.
Allow a user to include a picture in a post.
Allow a user to append a file to a post (may be the same as above).
Allow a user to include a link in post.
Allow a user to edit the topic in a post of his own.
Allow a user to edit his own post.
Allow a user to report a post.

Moderated posting:
All of the above options, but require that they be moderated before finally appearing.

Moderator/Administrator:
Allow a moderator to create a new forum group.
Allow a moderator to create a new forum.
Allow a moderator to create a new sub-forum.
Allow a moderator to merge threads.
Allow a moderator to move or delete threads.
Allow a moderator to edit/delete specific posts.
Allow a moderator to edit thread topics.
Allow a moderator to approve a submitted post.
Allow a moderator to approve an edited post.
Allow a moderator to approve a topic change.

Here is an example.

Forums:

Administration:
Hardware:
Network:
Software:
Security:

Home Theatre:
News:
Expert Help:
HD Projectors:
LCD:
DLP:
Topic: My new DLP projector rocks!
Member Deals:

Adult:
Reviews:
Discussions:

So for example:

Only system administrators can see a list of the Administration forum group.
All system administrators can view posts in Hardware, Software and Network Forums.
Hardware administrators can post in their own forum.
Only security administrators can view posts in their forum.

Only users over 18 can even see that the Adult forum group exists.
Only registered users that have specifically requested it, may be able to see posts in either the Adult: Reviews or Discussion forums.

Only moderators may post in Home Theatre: News:
Any one may create a topic in Home Theatre: Expert support: but only those in the expert group can post replies.

Anonymous users may read posts in the all Home Theatre forums except Home Theatre: Member Deals: where they can see topics only (none of the actual posts).

The others are, I hope self explanatory. :-)

/carmi

catch’s picture

Status: Needs review » Needs work

This still applies (with fuzz). However since this permission is empty by default, so when upgrading existing sites it could leave to some unexpected behaviour. Could do with an upgrade path to enable the permission by default.

Also I noticed if you remove "access content" from anonymous users, but leave "access forum listing" enabled- they can see the forum listing anyway - almost the reverse of what this patch was designed to prevent. Currently removing "access content" blocks the forum listing - so I think any upgrade path should ideally enable the forum listing only for roles which already have "access content", or there should be some kind of dependency between the two permissions.

This seems like a sensible usability fix, so maybe could be snuck into D6 if the upgrade path isn't too hard (although it's beyond me).

Wim Leers’s picture

I think most people expect this kind of functionality to be available automatically when they install a forum. This would increase the "Drupal core satisfaction rate".

+1

catch’s picture

Assigned: Crell » catch
FileSize
2.24 KB

OK this patch re-rolls against head, and adds "view forum listing" as a default permission in system.install to keep current behaviour for anonymous and authenticated users without any extra configuration.

Leaving as CNW for an upgrade path, I'm hoping to have this a bit later on today.

catch’s picture

ack here's one with unix line endings.

catch’s picture

Title: Separate permission for forums » New permission "access forum listing"
Status: Needs work » Needs review
FileSize
2.89 KB

OK got to this quicker than I thought. Untested as yet, but could do with reviews on the system update which is the only bit likely to be controversial I think.

What this should mean is that for both new and upgraded drupal installs, there's absolutely no change from current behaviour, but admins can then change the permission if they want to. This will save lots of "where's my forum gone" support requests I think.

JirkaRybka’s picture

The cloned code for system_update_6035() still uses $renamed_permission variable name, which is not the case, and should be changed to something more fitting IMO. Perhaps $updated_permission or the like?

moshe weitzman’s picture

I have to agree with Dries that this will cause confusion. What most people want (i think) is private forums, and this doesn't do that. Anons will get these nodes in search results and so on.

In Drupal6, it is trivially easy to use hook_menu_alter() to change the access callback for these pages. I suggest that a Contrib module do that, and leave this out of core.

catch’s picture

Status: Needs review » Needs work

JirkaRybka, good point. Given Moshe's comments I'll leave this for discussion rather than re-roll though. If consensus is to not have this in, then we should put "forum access in core" as the title and set to active for D7 imo.

Pancho’s picture

Version: 6.x-dev » 7.x-dev
Status: Needs work » Active

Two months later what catch proposed is all we can do: bump it to D7...

catch’s picture

Assigned: catch » Unassigned

unassigning myself - we should see how node_access runs in D7 and work on forum_access (either the module itself or at least the concept) in core instead.

lordzik’s picture

Hello,
i see that i've duplicated this here ( http://drupal.org/node/298510 ). Please consider this:

--- modules/node/node.module.old 2008-08-22 13:35:47.000000000 +0200
+++ modules/node/node.module 2008-08-22 13:36:51.000000000 +0200
@@ -2754,6 +2754,10 @@ function node_access($op, $node = NULL)
return FALSE;
}

+ if ($op == 'view' && $node->type == 'forum' && !user_access('access forum listing')) {
+ return FALSE;
+ }
+
if (user_access('administer nodes')) {
return TRUE;
}

Without this, anyone can view forum topics simply by guessing node/xxx number.

lilou’s picture

Status: Active » Needs work

@ lordzik : your patch in #298510: Forum access privilege no longer applies.

Wim Leers’s picture

Status: Needs work » Closed (fixed)

Cleaning up the issue queue.

Crell’s picture

Status: Closed (fixed) » Needs work

This is still an open issue as it has not been resolved but needs to be.

webchick’s picture

Version: 7.x-dev » 8.x-dev

I agree with Moshe and Dries, et al. This new permission only makes sense if bundled with actual forum access controls, and that won't happen in D7.

Bumping to 8.x.

majortom’s picture

Just curious if there are any further plans for forum access controls in Drupal 8?

Jeff Burnz’s picture

I am building an R&D site for the Snowman initiative and my site needs forums to be private, but I can't do this in core, so subscribing :)

yoroy’s picture

Issue tags: +permissions, +Snowman

tagging

alexweber’s picture

This looks like it duplicates #878530: Permission for Forum access, assign access based on role.

I've submitted a patch for the latter issue.

alexweber’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, forum_listing_perm_update.patch, failed testing.

sun’s picture

Issue tags: +Platform Initiative
thehong’s picture

Status: Needs work » Needs review
FileSize
1.33 KB

Status: Needs review » Needs work
Issue tags: -permissions, -Snowman, -Platform Initiative

The last submitted patch, 8-132211--form-listing-permission.diff, failed testing.

thehong’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 8-132211--form-listing-permission.diff, failed testing.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Issue summary: View changes
Status: Needs work » Postponed

Forum is approved for removal. See #1898812: [policy] Deprecate forum module for removal in Drupal 11

This is now Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.

It will be moved to the contributed extension once the Drupal 11 branch is open.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Project: Drupal core » Forum
Version: 11.x-dev » 1.0.1
Component: forum.module » Code
Status: Postponed » Needs work