Module: Cms::Authentication::Controller::ClassMethods
- Defined in:
- lib/cms/authentication/controller.rb
Instance Method Summary collapse
-
#check_permissions(*perms) ⇒ Object
Determines if the current user has at least one of the following permissions.
Instance Method Details
#check_permissions(*perms) ⇒ Object
Determines if the current user has at least one of the following permissions. Sets up a before_action that enforces permissions.
Example: class MyCustomController < Cms::ApplicationController
:publish_content, :except => [:index]
end
44 45 46 47 48 49 |
# File 'lib/cms/authentication/controller.rb', line 44 def (*perms) opts = Hash === perms.last ? perms.pop : {} before_filter(opts) do |controller| raise Cms::Errors::AccessDenied unless controller.send(:current_user).able_to?(*perms) end end |