summaryrefslogtreecommitdiffstats
path: root/app/models/role.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-05-30 07:40:57 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-05-30 07:40:57 +0000
commit6659aad3ef651b714a66d648cef2f25e3fff8516 (patch)
tree4f820edcddb221573b29f91a05786eabff94dd7a /app/models/role.rb
parent5e28f0b1b6aaabb327d458213f14cf6e5b90ae8a (diff)
downloadredmine-6659aad3ef651b714a66d648cef2f25e3fff8516.tar.gz
redmine-6659aad3ef651b714a66d648cef2f25e3fff8516.zip
Adds a role setting that viewing all or own time entries (#8929).
git-svn-id: http://svn.redmine.org/redmine/trunk@14275 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/role.rb')
-rw-r--r--app/models/role.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/role.rb b/app/models/role.rb
index f1adc01b2..43f32b726 100644
--- a/app/models/role.rb
+++ b/app/models/role.rb
@@ -39,6 +39,11 @@ class Role < ActiveRecord::Base
['own', :label_issues_visibility_own]
]
+ TIME_ENTRIES_VISIBILITY_OPTIONS = [
+ ['all', :label_time_entries_visibility_all],
+ ['own', :label_time_entries_visibility_own]
+ ]
+
USERS_VISIBILITY_OPTIONS = [
['all', :label_users_visibility_all],
['members_of_visible_projects', :label_users_visibility_members_of_visible_projects]
@@ -75,6 +80,9 @@ class Role < ActiveRecord::Base
validates_inclusion_of :users_visibility,
:in => USERS_VISIBILITY_OPTIONS.collect(&:first),
:if => lambda {|role| role.respond_to?(:users_visibility) && role.users_visibility_changed?}
+ validates_inclusion_of :time_entries_visibility,
+ :in => TIME_ENTRIES_VISIBILITY_OPTIONS.collect(&:first),
+ :if => lambda {|role| role.respond_to?(:time_entries_visibility) && role.time_entries_visibility_changed?}
# Copies attributes from another role, arg can be an id or a Role
def copy_from(arg, options={})