Commit 149ccd5d authored by Christian Simon's avatar Christian Simon

Fix groups api: differ between users and admin

parent fc0c6928
......@@ -33,7 +33,7 @@ module Gitlab
end
class Group < Grape::Entity
expose :id, :name, :path, :name, :owner_id, :type
expose :id, :name, :path, :owner_id
end
class GroupDetail < Grape::Entity
......
......@@ -9,9 +9,12 @@ module Gitlab
# Example Request:
# GET /groups
get do
if current_user.admin
@groups = paginate Group
else
@groups = paginate current_user.groups
end
present @groups, with: Entities::Group
end
# Create group. Available only for admin
......@@ -42,9 +45,12 @@ module Gitlab
# GET /groups/:id
get ":id" do
@group = Group.find(params[:id])
if current_user.admin or current_user.groups.include? @group
present @group, with: Entities::GroupDetail
else
not_found!
end
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