Module: Lockdown::Controller::Merb::InstanceMethods
- Defined in:
- lib/lockdown/controller.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#access_denied(e) ⇒ Object
Can log Error => e if desired, I don’t desire to now.
- #authorized?(path) ⇒ Boolean
- #path_from_hash(hsh) ⇒ Object
- #sent_from_uri ⇒ Object
Class Method Details
.included(base) ⇒ Object
92 93 94 95 96 97 |
# File 'lib/lockdown/controller.rb', line 92 def self.included(base) base.class_eval do alias :send_to :redirect end base.send :include, Lockdown::Controller::Core end |
Instance Method Details
#access_denied(e) ⇒ Object
Can log Error => e if desired, I don’t desire to now. For now, just send home, but will probably make this configurable
114 115 116 |
# File 'lib/lockdown/controller.rb', line 114 def access_denied(e) send_to Lockdown::Session[:access_denied_path] end |
#authorized?(path) ⇒ Boolean
103 104 105 106 107 108 109 110 |
# File 'lib/lockdown/controller.rb', line 103 def (path) return true if current_user_is_admin? # See if path is known return true if path_allowed?(path) return false end |
#path_from_hash(hsh) ⇒ Object
118 119 120 121 122 |
# File 'lib/lockdown/controller.rb', line 118 def path_from_hash(hsh) return hsh if hsh.is_a?(String) hsh = hsh.to_hash if hsh.is_a?(Mash) hsh['controller'].to_s + "/" + hsh['action'].to_s end |
#sent_from_uri ⇒ Object
99 100 101 |
# File 'lib/lockdown/controller.rb', line 99 def sent_from_uri request.uri end |