diff options
author | 🙈 jacopo beschi 🙉 <intrip@gmail.com> | 2018-07-26 00:45:42 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2018-07-26 00:45:42 +0300 |
commit | 046796cc3a98068e99abed152145e76c4636959c (patch) | |
tree | ab7061a86e9e69b56c27835682542a5bc2423942 /lib/api/members.rb | |
parent | 7b6d3974d416bca12360327b147feefeeead01f6 (diff) |
Resolve "API endpoint that returns all members, including the inherited membership through ancestor group"
Diffstat (limited to 'lib/api/members.rb')
-rw-r--r-- | lib/api/members.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/api/members.rb b/lib/api/members.rb index 8b12986d09e..3d2220fed96 100644 --- a/lib/api/members.rb +++ b/lib/api/members.rb @@ -28,6 +28,23 @@ module API present members, with: Entities::Member end + desc 'Gets a list of group or project members viewable by the authenticated user, including those who gained membership through ancestor group.' do + success Entities::Member + end + params do + optional :query, type: String, desc: 'A query string to search for members' + use :pagination + end + get ":id/members/all" do + source = find_source(source_type, params[:id]) + + members = find_all_members(source_type, source) + members = members.includes(:user).references(:user).merge(User.search(params[:query])) if params[:query].present? + members = paginate(members) + + present members, with: Entities::Member + end + desc 'Gets a member of a group or project.' do success Entities::Member end |