Module: C2::ControllerAdditions::ClassMethods

Defined in:
lib/c2/controller_additions.rb

Instance Method Summary collapse

Instance Method Details

#authorize_c2_agentObject

Raises:



21
22
23
# File 'lib/c2/controller_additions.rb', line 21

def authorize_c2_agent
  raise C2::AccessDenied unless c2_clearance?
end

#c2_clearance?Boolean

Returns:

  • (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_pathObject



25
26
27
# File 'lib/c2/controller_additions.rb', line 25

def 
  '/'
end

#c2_logout_pathObject



33
34
35
# File 'lib/c2/controller_additions.rb', line 33

def c2_logout_path
  '/'
end

#c2_profile_pathObject



29
30
31
# File 'lib/c2/controller_additions.rb', line 29

def c2_profile_path
  '/'
end

#current_c2_agentObject



9
10
11
# File 'lib/c2/controller_additions.rb', line 9

def current_c2_agent
  @current_c2_agent ||= current_user
end

#current_c2_agent_titleObject



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