diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-11-11 13:08:52 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-11-11 13:08:52 +0000 |
commit | bdd3ccf8e52c69d2b6e16e7230a1b8f9a6c69e60 (patch) | |
tree | 1571b147765d42bccab602cdd9a79499829de612 /app/models/role.rb | |
parent | 140ca9532c1c12b7ff710c076c6985dce18500e4 (diff) | |
download | redmine-bdd3ccf8e52c69d2b6e16e7230a1b8f9a6c69e60.tar.gz redmine-bdd3ccf8e52c69d2b6e16e7230a1b8f9a6c69e60.zip |
Adds a role setting for controlling visibility of users: all or members of visible projects (#11724).
git-svn-id: http://svn.redmine.org/redmine/trunk@13584 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/role.rb')
-rw-r--r-- | app/models/role.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/role.rb b/app/models/role.rb index 31dbf75a1..c6a6b4979 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -39,6 +39,11 @@ class Role < ActiveRecord::Base ['own', :label_issues_visibility_own] ] + USERS_VISIBILITY_OPTIONS = [ + ['all', :label_users_visibility_all], + ['members_of_visible_projects', :label_users_visibility_members_of_visible_projects] + ] + scope :sorted, lambda { order(:builtin, :position) } scope :givable, lambda { order(:position).where(:builtin => 0) } scope :builtin, lambda { |*args| @@ -67,6 +72,9 @@ class Role < ActiveRecord::Base validates_inclusion_of :issues_visibility, :in => ISSUES_VISIBILITY_OPTIONS.collect(&:first), :if => lambda {|role| role.respond_to?(:issues_visibility)} + validates_inclusion_of :users_visibility, + :in => USERS_VISIBILITY_OPTIONS.collect(&:first), + :if => lambda {|role| role.respond_to?(:users_visibility)} # Copies attributes from another role, arg can be an id or a Role def copy_from(arg, options={}) |