diff options
author | Stan Hu <stanhu@gmail.com> | 2015-05-25 16:51:37 -0400 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-05-28 11:39:12 -0700 |
commit | 67992b9be6fc19ef4cc06de48995d1ee9617049a (patch) | |
tree | ccd191c5d27b5c9597daa4ca2e6ae1fb655ad823 /lib/api/namespaces.rb | |
parent | 06250eef2e12ed509b88f3770ae6d3fa4614b74d (diff) | |
download | gitlab-ce-67992b9be6fc19ef4cc06de48995d1ee9617049a.tar.gz |
Make namespace API available to all users
Closes https://github.com/gitlabhq/gitlabhq/issues/9328
Diffstat (limited to 'lib/api/namespaces.rb')
-rw-r--r-- | lib/api/namespaces.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/api/namespaces.rb b/lib/api/namespaces.rb index b90ed6af5fb..50d3729449e 100644 --- a/lib/api/namespaces.rb +++ b/lib/api/namespaces.rb @@ -1,10 +1,7 @@ module API # namespaces API class Namespaces < Grape::API - before do - authenticate! - authenticated_as_admin! - end + before { authenticate! } resource :namespaces do # Get a namespaces list @@ -12,7 +9,11 @@ module API # Example Request: # GET /namespaces get do - @namespaces = Namespace.all + @namespaces = if current_user.admin + Namespace.all + else + current_user.namespaces + end @namespaces = @namespaces.search(params[:search]) if params[:search].present? @namespaces = paginate @namespaces |