Fixed basic auth, reset current_user based on basic auth user.

This commit is contained in:
Martin Edenhofer 2012-04-19 14:32:12 +02:00
parent 7f75940c03
commit 4013450a5a

View file

@ -51,6 +51,10 @@ class ApplicationController < ActionController::Base
@_current_user ||= session[:user_id] &&
User.find_by_id( session[:user_id] )
end
def current_user_set(user)
@_current_user = user
set_user
end
def authentication_check
puts 'authentication_check'
@ -71,7 +75,12 @@ class ApplicationController < ActionController::Base
end
# 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
render(
@ -103,8 +112,8 @@ class ApplicationController < ActionController::Base
# Sets the current user into a named Thread location so that it can be accessed
# by models and observers
def set_user
puts 'set_user'
UserInfo.current_user_id = session[:user_id]
return if !current_user
UserInfo.current_user_id = current_user.id
end
def log_view (object)