Skip to content

Commit

Permalink
Use ApplicationPolicy#can_admin?
Browse files Browse the repository at this point in the history
Per comments on #996, use ApplicationPolicy#can_admin? rather than
duplicating it in NavBarPolicy#is_admin?
  • Loading branch information
Bob Mazanec committed Nov 30, 2021
1 parent 6ba76fa commit e139258
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions app/policies/nav_bar_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,8 @@ def visible_buttons
visible = Set.new
visible << (user ? 'Logout' : 'Login')
visible << 'Sign Up' unless user
visible << 'Feedback' if is_admin?(user)
visible.merge %w[Glossary Contributions] if system_settings.peer_to_peer?
visible.merge %w[Contributions Matches Admin] if can_admin?
visible.merge %w[Contributions Feedback Matches Admin] if can_admin?
visible.to_a
end

private

def is_admin?(user)
user && (user.admin_role? || user.sys_admin_role?)
end
end

0 comments on commit e139258

Please sign in to comment.