diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-03-03 15:01:10 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-03-03 15:01:10 +0000 |
commit | f9aae510d9d917eda1ad3970f7989fb7d4e74f2c (patch) | |
tree | 5ee7214758a2820e5f171db369b3455704e60219 /lib | |
parent | 433ec4d8da9d6c3b45660892a15e88a1719e7599 (diff) | |
parent | 6357635686fafb2fc9af5090c1edabfe25649085 (diff) | |
download | gitlab-ce-f9aae510d9d917eda1ad3970f7989fb7d4e74f2c.tar.gz |
Merge branch '28865-filter-by-authorized-projects-in-v4' into 'master'
Add filter param for user's authorized projects in V4
Closes #28865
See merge request !9674
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/helpers.rb | 4 | ||||
-rw-r--r-- | lib/api/projects.rb | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 4600abc7dc7..9c41146f1e3 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -252,6 +252,10 @@ module API # project helpers def filter_projects(projects) + if params[:membership] + projects = projects.merge(current_user.authorized_projects) + end + if params[:owned] projects = projects.merge(current_user.owned_projects) end diff --git a/lib/api/projects.rb b/lib/api/projects.rb index f302496c12b..63a4cdd5954 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -46,9 +46,10 @@ module API optional :archived, type: Boolean, default: false, desc: 'Limit by archived status' optional :visibility, type: String, values: Gitlab::VisibilityLevel.string_values, desc: 'Limit by visibility' - optional :search, type: String, desc: 'Return list of authorized projects matching the search criteria' + optional :search, type: String, desc: 'Return list of projects matching the search criteria' optional :owned, type: Boolean, default: false, desc: 'Limit by owned by authenticated user' optional :starred, type: Boolean, default: false, desc: 'Limit by starred status' + optional :membership, type: Boolean, default: false, desc: 'Limit by projects that the current user is a member of' end params :statistics_params do |