blob: 5299f547d60356f0fb330f6757c363a75a2aa7c3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# SPDX-FileCopyrightText: 2020 IN COMMON Collective <collective@incommon.cc>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
class ApplicationController < ActionController::Base
require 'sso'
before_action :current_user
protected
include ApplicationHelper
def current_agent
@current_agent = Agent.find_by(name: session[:current_agent] || current_user.presence&.agents&.first&.name || 'incommon')
end
helper_method :current_agent
def current_user
@current_user ||= User.find_by(external_id: session[:current_user]) if session[:current_user].present?
end
helper_method :current_user
end
|