summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Lee Yu <hleeyu@gmail.com>2018-10-26 14:02:20 +0800
committerHeinrich Lee Yu <hleeyu@gmail.com>2018-11-19 23:59:54 +0800
commit2ec2a906b552d5f4a486130b88a39a4a14e7b28f (patch)
tree83e3041d67bd267edd0a68677bad3752bf4d4fc5 /lib
parent08ddb655ef461c57355eeb83edf10988decb2ced (diff)
downloadgitlab-ce-2ec2a906b552d5f4a486130b88a39a4a14e7b28f.tar.gz
Add group projects API options for including shared and subgroups
Diffstat (limited to 'lib')
-rw-r--r--lib/api/groups.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/api/groups.rb b/lib/api/groups.rb
index 64b998ab455..12227c886b2 100644
--- a/lib/api/groups.rb
+++ b/lib/api/groups.rb
@@ -60,7 +60,17 @@ module API
def find_group_projects(params)
group = find_group!(params[:id])
- projects = GroupProjectsFinder.new(group: group, current_user: current_user, params: project_finder_params).execute
+ options = {
+ only_owned: !params[:include_shared],
+ include_subgroups: params[:include_subgroups]
+ }
+
+ projects = GroupProjectsFinder.new(
+ group: group,
+ current_user: current_user,
+ params: project_finder_params,
+ options: options
+ ).execute
projects = projects.with_issues_available_for_user(current_user) if params[:with_issues_enabled]
projects = projects.with_merge_requests_enabled if params[:with_merge_requests_enabled]
projects = reorder_projects(projects)
@@ -201,6 +211,8 @@ module API
optional :starred, type: Boolean, default: false, desc: 'Limit by starred status'
optional :with_issues_enabled, type: Boolean, default: false, desc: 'Limit by enabled issues feature'
optional :with_merge_requests_enabled, type: Boolean, default: false, desc: 'Limit by enabled merge requests feature'
+ optional :include_subgroups, type: Boolean, default: false, desc: 'Includes projects in subgroups of this group'
+ optional :include_shared, type: Boolean, default: true, desc: 'Include projects shared to this group'
use :pagination
use :with_custom_attributes