Module: Platanus::Canned::ControllerExt::ClassMethods
- Defined in:
- lib/platanus/canned.rb
Instance Method Summary collapse
-
#canned_setup(_definition, _provider = nil, &pblock) ⇒ Object
Setups the controller user profile definitions and profile provider block (or proc).
-
#uncan_all ⇒ Object
Removes protection for all controller actions.
-
#uncanned(*_excluded) ⇒ Object
Removes protection for the especified controller actions.
Instance Method Details
#canned_setup(_definition, _provider = nil, &pblock) ⇒ Object
Setups the controller user profile definitions and profile provider block (or proc)
80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/platanus/canned.rb', line 80 def canned_setup(_definition, _provider=nil, &pblock) self.brk_definition = _definition self.brk_provider = _provider || pblock self.before_filter do # Before filter is an instance_eval? break if self.class.brk_excluded == :all break if !self.class.brk_excluded.nil? and self.class.brk_excluded.include? params[:action].to_sym tag = self.can?(params[:controller], params) tag ||= self.can?(params[:controller] + '#' + params[:action], params) raise AuthError unless tag self.brk_tag = tag end end |
#uncan_all ⇒ Object
Removes protection for all controller actions.
95 96 97 |
# File 'lib/platanus/canned.rb', line 95 def uncan_all() self.brk_excluded = :all end |
#uncanned(*_excluded) ⇒ Object
Removes protection for the especified controller actions.
100 101 102 103 |
# File 'lib/platanus/canned.rb', line 100 def uncanned(*_excluded) self.brk_excluded ||= [] self.brk_excluded.push(*_excluded) end |