summaryrefslogtreecommitdiffstats
path: root/app/models/user.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-11-11 13:08:52 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-11-11 13:08:52 +0000
commitbdd3ccf8e52c69d2b6e16e7230a1b8f9a6c69e60 (patch)
tree1571b147765d42bccab602cdd9a79499829de612 /app/models/user.rb
parent140ca9532c1c12b7ff710c076c6985dce18500e4 (diff)
downloadredmine-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/user.rb')
-rw-r--r--app/models/user.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index a0a703700..b5bb6ae1e 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -148,6 +148,7 @@ class User < Principal
@notified_projects_ids = nil
@notified_projects_ids_changed = false
@builtin_role = nil
+ @visible_project_ids = nil
base_reload(*args)
end
@@ -528,6 +529,11 @@ class User < Principal
@projects_by_role = hash
end
+ # Returns the ids of visible projects
+ def visible_project_ids
+ @visible_project_ids ||= Project.visible(self).pluck(:id)
+ end
+
# Returns true if user is arg or belongs to arg
def is_or_belongs_to?(arg)
if arg.is_a?(User)