diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/time_entry.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/time_entry.rb b/app/models/time_entry.rb index cfca47639..103d5ae62 100644 --- a/app/models/time_entry.rb +++ b/app/models/time_entry.rb @@ -126,4 +126,14 @@ class TimeEntry < ActiveRecord::Base def editable_by?(usr) (usr == user && usr.allowed_to?(:edit_own_time_entries, project)) || usr.allowed_to?(:edit_time_entries, project) end + + # Returns the custom_field_values that can be edited by the given user + def editable_custom_field_values(user=nil) + visible_custom_field_values + end + + # Returns the custom fields that can be edited by the given user + def editable_custom_fields(user=nil) + editable_custom_field_values(user).map(&:custom_field).uniq + end end |