Skip to content

Authorization System

Ryan Bigg edited this page Nov 12, 2011 · 17 revisions

Forem uses Ryan Bates' popular CanCan gem for defining a solid authorization API for the forum system.

To use Forem, you must have set the Forem.user_class setting in config/initializers/forem.rb (or any initializer file, the name doesn't matter) in your application. Once this is done, the Forem::DefaultPermissions module will be included into this class`.

This module defines default permissions for the users of your application, which consist solely of the ability to read forums at the moment. The methods that are defined on your user class are these:

can_read_forem_forums?

Default: true

Determines if the user can read any forums at all. If they cannot, they will not be able to access any forums.

can_read_forem_forum?(forum)

Default:: true

Determines if the user can read the specified forum. If they cannot, they are denied access to this forum when they attempt to visit it and it will not appear on any forum listing.

Clone this wiki locally