summaryrefslogtreecommitdiff
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb18
1 files changed, 14 insertions, 4 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 2d49890..2aadf19 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -122,11 +122,21 @@ class ApplicationController < ActionController::Base
private
def current_user
- if session[:user_id] && User.where(:id => session[:user_id]).any?
- return User.where(:id => session[:user_id]).first
+ if session[:user_id] || GsParameter.get('SingleSignOnEnvUserNameKey').blank?
+ if session[:user_id] && User.where(:id => session[:user_id]).any?
+ return User.where(:id => session[:user_id]).first
+ else
+ session[:user_id] = nil
+ return nil
+ end
else
- session[:user_id] = nil
- return nil
+ if User.where(:user_name => request.env[GsParameter.get('SingleSignOnEnvUserNameKey')]).any?
+ auth_user = User.where(:user_name => request.env[GsParameter.get('SingleSignOnEnvUserNameKey')]).first
+ session[:user_id] = auth_user.id
+ return auth_user
+ else
+ return nil
+ end
end
end