summaryrefslogtreecommitdiffstats
path: root/app/models/role.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/role.rb')
-rw-r--r--app/models/role.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/role.rb b/app/models/role.rb
index 89538aa4d..86fe73070 100644
--- a/app/models/role.rb
+++ b/app/models/role.rb
@@ -222,6 +222,13 @@ class Role < ActiveRecord::Base
permissions_all_trackers[permission.to_s].to_s != '0'
end
+ # Returns true if permission is given for the tracker
+ # (explicitly or for all trackers)
+ def permissions_tracker?(permission, tracker)
+ permissions_all_trackers?(permission) ||
+ permissions_tracker_ids?(permission, tracker.try(:id))
+ end
+
# Sets the trackers that are allowed for a permission.
# tracker_ids can be an array of tracker ids or :all for
# no restrictions.