aboutsummaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorhellekin <hellekin@cepheide.org>2020-10-09 10:31:10 +0200
committerhellekin <hellekin@cepheide.org>2020-10-09 10:31:10 +0200
commitef9ff49462c3fdf10d0cdcbb6304715769485835 (patch)
treee4981e12866c1c30d07c75c83a65feb324459ec4 /app/controllers
parentd242fb5bbc423876f4c192b5f133619a2d4f0113 (diff)
downloadincommon-map-ef9ff49462c3fdf10d0cdcbb6304715769485835.tar.gz
Add permissions
- `current_agent` is now a full instance of Agent - provide helpers to verify current user roles
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/application_controller.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 4e71ff8..14f50bf 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -7,8 +7,10 @@ class ApplicationController < ActionController::Base
protected
+ include ApplicationHelper
+
def current_agent
- @current_agent = session[:current_agent] || current_user.presence&.agents&.first&.name || 'IN COMMON'
+ @current_agent = Agent.find_by(name: session[:current_agent] || current_user.presence&.agents&.first&.name || 'incommon')
end
helper_method :current_agent