class Ckeditor::Hooks::CanCanAuthorization
responds to each of the public methods here.
You can create another adapter for different authorization behavior, just be certain it
This adapter is for the CanCanCan authorization library.
def authorize(action, model_object = nil)
action as a symbol (:create, :destroy, etc.). The second argument is the actual model
when the authorization fails. The first argument is the name of the controller
This method is called in every controller action and should raise an exception
def authorize(action, model_object = nil) if action @controller.instance_variable_set(:@_authorized, true) @controller.current_ability.authorize!(action.to_sym, model_object) end end
def authorized?(action, model_object = nil)
This takes the same arguments as +authorize+. The difference is that this will
has access to perform the action on a given model. It should return true when authorized.
This method is called primarily from the view to determine whether the given user
def authorized?(action, model_object = nil) @controller.current_ability.can?(action.to_sym, model_object) if action end
def initialize(controller, ability = ::Ability)
def initialize(controller, ability = ::Ability) @controller = controller @controller.instance_variable_set '@ability', ability @controller.extend ControllerExtension @controller.current_ability.authorize! :access, :ckeditor end