aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
authorhellekin <hellekin@cepheide.org>2020-10-06 04:26:25 +0200
committerhellekin <hellekin@cepheide.org>2020-10-06 04:26:25 +0200
commit56a16be5fb51d8f6a8b04e9e7094aa7c57fb8547 (patch)
tree83280700beda03eaa0786cdd8c94c93a1533f18b /app/controllers/application_controller.rb
parent09ac92747bfbda80a54e44b22576d29d9dfc63c3 (diff)
downloadincommon-map-56a16be5fb51d8f6a8b04e9e7094aa7c57fb8547.tar.gz
First pass at something visible
This is a first version of the application, to go beyond simple authentication.
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index c34b9f9..4e71ff8 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -7,6 +7,11 @@ class ApplicationController < ActionController::Base
protected
+ def current_agent
+ @current_agent = session[:current_agent] || current_user.presence&.agents&.first&.name || 'IN COMMON'
+ end
+ helper_method :current_agent
+
def current_user
@current_user ||= User.find_by(external_id: session[:current_user]) if session[:current_user].present?
end