Fixed basic auth, reset current_user based on basic auth user.
This commit is contained in:
parent
7f75940c03
commit
4013450a5a
1 changed files with 14 additions and 5 deletions
|
@ -51,6 +51,10 @@ class ApplicationController < ActionController::Base
|
||||||
@_current_user ||= session[:user_id] &&
|
@_current_user ||= session[:user_id] &&
|
||||||
User.find_by_id( session[:user_id] )
|
User.find_by_id( session[:user_id] )
|
||||||
end
|
end
|
||||||
|
def current_user_set(user)
|
||||||
|
@_current_user = user
|
||||||
|
set_user
|
||||||
|
end
|
||||||
|
|
||||||
def authentication_check
|
def authentication_check
|
||||||
puts 'authentication_check'
|
puts 'authentication_check'
|
||||||
|
@ -71,7 +75,12 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
# return auth ok
|
# return auth ok
|
||||||
return true if message == ''
|
if message == ''
|
||||||
|
|
||||||
|
# set basic auth user to current user
|
||||||
|
current_user_set(userdata)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
# return auth not ok
|
# return auth not ok
|
||||||
render(
|
render(
|
||||||
|
@ -103,8 +112,8 @@ class ApplicationController < ActionController::Base
|
||||||
# Sets the current user into a named Thread location so that it can be accessed
|
# Sets the current user into a named Thread location so that it can be accessed
|
||||||
# by models and observers
|
# by models and observers
|
||||||
def set_user
|
def set_user
|
||||||
puts 'set_user'
|
return if !current_user
|
||||||
UserInfo.current_user_id = session[:user_id]
|
UserInfo.current_user_id = current_user.id
|
||||||
end
|
end
|
||||||
|
|
||||||
def log_view (object)
|
def log_view (object)
|
||||||
|
|
Loading…
Reference in a new issue