Commit 0759dd45 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Namespaces API for admin users

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 77e3fab8
...@@ -40,5 +40,6 @@ module API ...@@ -40,5 +40,6 @@ module API
mount ProjectHooks mount ProjectHooks
mount Services mount Services
mount Files mount Files
mount Namespaces
end end
end end
...@@ -136,5 +136,9 @@ module API ...@@ -136,5 +136,9 @@ module API
expose :target_id, :target_type, :author_id expose :target_id, :target_type, :author_id
expose :data, :target_title expose :data, :target_title
end end
class Namespace < Grape::Entity
expose :id, :path, :kind
end
end end
end end
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment