Module: C2::ControllerAdditions::ClassMethods
- Defined in:
- lib/c2/controller_additions.rb
Instance Method Summary collapse
- #authorize_c2_agent ⇒ Object
- #c2_clearance? ⇒ Boolean
- #c2_login_path ⇒ Object
- #c2_logout_path ⇒ Object
- #c2_profile_path ⇒ Object
- #current_c2_agent ⇒ Object
- #current_c2_agent_title ⇒ Object
Instance Method Details
#authorize_c2_agent ⇒ Object
21 22 23 |
# File 'lib/c2/controller_additions.rb', line 21 def raise C2::AccessDenied unless c2_clearance? end |
#c2_clearance? ⇒ Boolean
17 18 19 |
# File 'lib/c2/controller_additions.rb', line 17 def c2_clearance? current_c2_agent && current_c2_agent.admin? end |
#c2_login_path ⇒ Object
25 26 27 |
# File 'lib/c2/controller_additions.rb', line 25 def c2_login_path '/' end |
#c2_logout_path ⇒ Object
33 34 35 |
# File 'lib/c2/controller_additions.rb', line 33 def c2_logout_path '/' end |
#c2_profile_path ⇒ Object
29 30 31 |
# File 'lib/c2/controller_additions.rb', line 29 def c2_profile_path '/' end |
#current_c2_agent ⇒ Object
9 10 11 |
# File 'lib/c2/controller_additions.rb', line 9 def current_c2_agent @current_c2_agent ||= current_user end |
#current_c2_agent_title ⇒ Object
13 14 15 |
# File 'lib/c2/controller_additions.rb', line 13 def current_c2_agent_title @current_c2_agent_title ||= current_c2_agent.send(([:c2_title, :title, :name, :email].map(&:to_s) & current_c2_agent.methods).first) end |