diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-12-30 11:30:56 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-12-30 11:46:47 +0200 |
commit | 2660e83c97c46b7303a71b1110c693fbfbc9662c (patch) | |
tree | 27a39e3ef6cf679a215fb296ddeb952b22d714b7 /lib/api/groups.rb | |
parent | da9d8279046c7f5f1dfb0972c0c8ac676cfc8b2c (diff) | |
download | gitlab-ce-2660e83c97c46b7303a71b1110c693fbfbc9662c.tar.gz |
Add group filtering by name for API
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'lib/api/groups.rb')
-rw-r--r-- | lib/api/groups.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/api/groups.rb b/lib/api/groups.rb index f0ab6938b1c..a2d915a7eca 100644 --- a/lib/api/groups.rb +++ b/lib/api/groups.rb @@ -25,11 +25,14 @@ module API # Example Request: # GET /groups get do - if current_user.admin - @groups = paginate Group - else - @groups = paginate current_user.groups - end + @groups = if current_user.admin + Group.all + else + current_user.groups + end + + @groups = @groups.search(params[:search]) if params[:search].present? + @groups = paginate @groups present @groups, with: Entities::Group end |