-
Notifications
You must be signed in to change notification settings - Fork 40
How to: Integrate with CanCan
CanCan is a gem used to authorize resources in Rails. BigbluebuttonRails doesn't use CanCan internally yet, but you can still use CanCan to authorize the resources added by BigbluebuttonRails in your application, without having to reimplement the actions in these controllers.
To set up authorization with CanCan, first learn How to: Inherit controllers. Inheriting controllers you will be able to add (before-)filters to these controllers and authorize all the actions in BigbluebuttonRails.
Example:
class CustomBigbluebuttonRoomsController < Bigbluebutton::RoomsController
load_and_authorize_resource :find_by => :param, :class => "BigbluebuttonRoom"
...
end
class CustomBigbluebuttonRecordingsController < Bigbluebutton::RecordingsController
load_and_authorize_resource :find_by => :recordid, :class => "BigbluebuttonRecording"
...
end
You can use this strategy for any of the controllers in BigbluebuttonRails. To see the controllers available just check the folder app/controllers/bigbluebutton
.
It is always recommended that you implement your own views over the ones provided by BigbluebuttonRails (see How to: Generators). Once you've done it, you can safely use CanCan's view helpers (e.g. can?
) in these views.
Mconf-Web is the most complete implementation of an application that uses this gem (that we know of), so you can always use it as an example. The version of Mconf-Web curerntly in the branch branch-v2
uses CanCan and it is well integrated with BigbluebuttonRails.