Module: Authorizable::ControllerMethods::ClassMethods
- Defined in:
- lib/authorizable.rb
Instance Method Summary (collapse)
-
- (Object) acts_as_authorizable(*args)
This mixin method will :
-
set the action skipping the logging part
-
define the method checking the permission depending of the action
-
set this method as a before_filter.
-
Instance Method Details
- (Object) acts_as_authorizable(*args)
This mixin method will :
-
set the action skipping the logging part
-
define the method checking the permission depending of the action
-
set this method as a before_filter
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/authorizable.rb', line 19 def (*args) = args. skip_before_filter :is_logged?, :only => [:skip_logging_actions] before_filter :permission_checking define_method :permission_checking do if [:actions_permissions_links][params[:action]] obj = params[:controller].split('/')[1].classify.constantize @current_object ||= ['new', 'create','validate'].include?(params[:action]) ? obj.new : obj.find(params[:id]) #no_permission_redirection unless @current_user && @current_object.send("accepts_#{hash[params[:action]]}_for?".to_sym, @current_user) unless @current_user && @current_object.([:actions_permissions_links][params[:action]], @current_user, current_container ? current_container.class.to_s.underscore : 'workspace') else # it is permissive end end include Authorizable::ControllerMethods::InstanceMethods end |