diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-11-15 14:19:49 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-11-15 14:19:49 +0000 |
commit | 875728b1184d4524bf96a6de47b329eba7645446 (patch) | |
tree | 9dddb459c3f43bbbd49102ab132cc8ccec999cab /lib | |
parent | 77e3fab89f633b70a0f805cce94d09304ad893e2 (diff) | |
parent | 27ad882693a1848b17c3841fec72f21a3b9428ee (diff) | |
download | gitlab-ce-875728b1184d4524bf96a6de47b329eba7645446.tar.gz |
Merge branch 'feature/admin_project_transfer' of /home/git/repositories/gitlab/gitlabhq
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/api.rb | 1 | ||||
-rw-r--r-- | lib/api/entities.rb | 4 | ||||
-rw-r--r-- | lib/api/namespaces.rb | 23 |
3 files changed, 28 insertions, 0 deletions
diff --git a/lib/api/api.rb b/lib/api/api.rb index 45efcc8cd47..283f7642f67 100644 --- a/lib/api/api.rb +++ b/lib/api/api.rb @@ -40,5 +40,6 @@ module API mount ProjectHooks mount Services mount Files + mount Namespaces end end diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 429083d75be..2bdcbdc8c7f 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -136,5 +136,9 @@ module API expose :target_id, :target_type, :author_id expose :data, :target_title end + + class Namespace < Grape::Entity + expose :id, :path, :kind + end end end diff --git a/lib/api/namespaces.rb b/lib/api/namespaces.rb new file mode 100644 index 00000000000..3a9ab66957e --- /dev/null +++ b/lib/api/namespaces.rb @@ -0,0 +1,23 @@ +module API + # namespaces API + class Namespaces < Grape::API + before { + authenticate! + authenticated_as_admin! + } + + resource :namespaces do + # Get a namespaces list + # + # Example Request: + # GET /namespaces + get do + @namespaces = Namespace.scoped + @namespaces = @namespaces.search(params[:search]) if params[:search].present? + @namespaces = paginate @namespaces + + present @namespaces, with: Entities::Namespace + end + end + end +end |