Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario de la Ossa <mariodelaossa@gmail.com>2018-04-26 22:53:13 +0300
committerMario de la Ossa <mariodelaossa@gmail.com>2018-05-04 20:33:09 +0300
commit5c2078838bb9de710f9025513c4b6ec664bba313 (patch)
tree338656dae97b6c6687e6794b583b0ae431aa5e2f /app/models/ability.rb
parente71351d4f463715fccd80ddbcb4dade67e80f34b (diff)
Backport of 4084-epics-username-autocomplete
Diffstat (limited to 'app/models/ability.rb')
-rw-r--r--app/models/ability.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/ability.rb b/app/models/ability.rb
index 618d4af4272..bb600eaccba 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -10,6 +10,14 @@ class Ability
end
end
+ # Given a list of users and a group this method returns the users that can
+ # read the given group.
+ def users_that_can_read_group(users, group)
+ DeclarativePolicy.subject_scope do
+ users.select { |u| allowed?(u, :read_group, group) }
+ end
+ end
+
# Given a list of users and a snippet this method returns the users that can
# read the given snippet.
def users_that_can_read_personal_snippet(users, snippet)