diff options
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r-- | app/helpers/application_helper.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be79..0b22f4b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,10 @@ module ApplicationHelper + def current_agency + current_user.agencies.where(agent: current_agent).first + end + %w(observer editor maintainer leader).each do |role| + define_method :"current_user_#{role}?" do + current_agency.send(:"#{role}?") + end + end end |