Class: ClWiki::ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- ClWiki::ApplicationController
show all
- Defined in:
- app/controllers/cl_wiki/application_controller.rb
Instance Method Summary
collapse
Instance Method Details
#authorized ⇒ Object
24
25
26
|
# File 'app/controllers/cl_wiki/application_controller.rb', line 24
def authorized
redirect_to login_url unless logged_in?
end
|
#current_owner ⇒ Object
16
17
18
|
# File 'app/controllers/cl_wiki/application_controller.rb', line 16
def current_owner
current_user || ClWiki::PublicUser.new
end
|
#current_user ⇒ Object
10
11
12
13
14
|
# File 'app/controllers/cl_wiki/application_controller.rb', line 10
def current_user
User.find(session[:username])&.tap do |user|
user.cached_encryption_key = Base64.decode64(session[:encryption_key])
end
end
|
#initialize_index ⇒ Object
28
29
30
|
# File 'app/controllers/cl_wiki/application_controller.rb', line 28
def initialize_index
ClWiki::MemoryIndexer.instance(page_owner: current_owner)
end
|
#logged_in? ⇒ Boolean
20
21
22
|
# File 'app/controllers/cl_wiki/application_controller.rb', line 20
def logged_in?
!current_user.nil?
end
|