Module: Defcon
- Defined in:
- lib/defcon.rb,
lib/defcon/engine.rb,
lib/defcon/version.rb,
app/models/defcon/admin_user.rb,
app/helpers/defcon/sessions_helper.rb,
app/helpers/defcon/application_helper.rb,
app/controllers/defcon/sessions_controller.rb,
app/controllers/defcon/application_controller.rb
Defined Under Namespace
Modules: ApplicationHelper, SessionsHelper
Classes: AdminUser, ApplicationController, Engine, SessionsController
Constant Summary
collapse
- VERSION =
"1.2.7"
Class Method Summary
collapse
Class Method Details
.authenticate_admin_user!(session) ⇒ Object
5
6
7
8
9
10
11
|
# File 'lib/defcon.rb', line 5
def self.authenticate_admin_user!(session)
if !::Defcon.logged_in?(session)
return false
else
return true
end
end
|
.current_admin_user(session) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/defcon.rb', line 13
def self.current_admin_user(session)
if ::Defcon.logged_in?(session)
id = session[:admin_id]
admin = ::Defcon::AdminUser.find_by_id(id)
if admin.nil?
session[:admin_id] = nil
session[:admin_username] = nil
return nil
else
return admin
end
else
return nil
end
end
|
.logged_in?(session) ⇒ Boolean
29
30
31
32
33
34
35
|
# File 'lib/defcon.rb', line 29
def self.logged_in?(session)
if session[:admin_id].nil?
return false
else
return true
end
end
|