summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorJose Ivan Vargas <jvargas@gitlab.com>2016-12-23 16:29:00 -0600
committerJose Ivan Vargas <jvargas@gitlab.com>2017-01-03 10:52:14 -0600
commitad58dec2e1564e9c2d23dd32e5da8b12eeba965d (patch)
tree2d0877f1244b492a57c780aabd425b2a253ed4d9 /app/finders
parentdef6c43da15a38e1211cf733442efe01824e5150 (diff)
downloadgitlab-ce-ad58dec2e1564e9c2d23dd32e5da8b12eeba965d.tar.gz
Added groups to members section, added a members finder
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/members_finder.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/finders/members_finder.rb b/app/finders/members_finder.rb
new file mode 100644
index 00000000000..b476b0bc184
--- /dev/null
+++ b/app/finders/members_finder.rb
@@ -0,0 +1,13 @@
+class MembersFinder < Projects::ApplicationController
+ def initialize(project_members, group)
+ @project_members = project_members
+ @group = group
+ end
+
+ def execute
+ non_null_user_ids = @project_members.where.not(user_id: nil).select(:user_id)
+ group_members = @group.group_members.where.not(user_id: non_null_user_ids)
+ group_members = group_members.non_invite unless can?(current_user, :admin_group, @group)
+ group_members
+ end
+end