I'm building a module which (at some point) will have to set forum permissions, so I was thinking of using forum_access which is perfect for this task.

Since I'm not so experienced to Drupal's access/permissions conventions as the people that created forum_access I was wondering if someone could give me a hint as to:

  • Which functions (from forum_access) should I use to add read/write access to a forum?
  • How do I check if a role has access to a forum?
  • How do I remove access to a forum?

I'd appreciate any help :)

Comments

salvis’s picture

The forum_access_access() function checks access. However, there's no API for adding/removing access. This is done in _forum_access_form_submit(), where the form values are evaluated and applied.

It might make sense to provide an API for this — I'll review a patch if you provide one. Keep in mind that the operation may be a costly one, if we need to update a forum with many nodes. Presently, all records for all roles and all nodes in the given forum are purged and re-set from scratch. This may need to be a batch operation, so all roles need to be processed in one swoop.

dillix’s picture

Issue summary: View changes
Status: Active » Closed (outdated)