summaryrefslogtreecommitdiff
path: root/lib/api/groups.rb
diff options
context:
space:
mode:
authorMarkus Koller <markus-koller@gmx.ch>2016-11-29 20:21:39 +0100
committerMarkus Koller <markus-koller@gmx.ch>2016-12-21 16:36:53 +0100
commitd5c49779125f70c49ff8b160355d4999d27091ee (patch)
treec8f5f402156e6d842de7d34a08360a7a96dfbeeb /lib/api/groups.rb
parentd05dd81b99b897bcf41bfa4055d1f42bb9669af9 (diff)
downloadgitlab-ce-d5c49779125f70c49ff8b160355d4999d27091ee.tar.gz
Consistently use current_user in API entities
Diffstat (limited to 'lib/api/groups.rb')
-rw-r--r--lib/api/groups.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/api/groups.rb b/lib/api/groups.rb
index 9b9d3df7435..a9ae2977dc5 100644
--- a/lib/api/groups.rb
+++ b/lib/api/groups.rb
@@ -38,7 +38,7 @@ module API
groups = groups.where.not(id: params[:skip_groups]) if params[:skip_groups].present?
groups = groups.reorder(params[:order_by] => params[:sort])
- present paginate(groups), with: Entities::Group
+ present paginate(groups), with: Entities::Group, current_user: current_user
end
desc 'Get list of owned groups for authenticated user' do
@@ -49,7 +49,7 @@ module API
end
get '/owned' do
groups = current_user.owned_groups
- present paginate(groups), with: Entities::Group, user: current_user
+ present paginate(groups), with: Entities::Group, current_user: current_user
end
desc 'Create a group. Available only for users who can create groups.' do
@@ -66,7 +66,7 @@ module API
group = ::Groups::CreateService.new(current_user, declared_params(include_missing: false)).execute
if group.persisted?
- present group, with: Entities::Group
+ present group, with: Entities::Group, current_user: current_user
else
render_api_error!("Failed to save group #{group.errors.messages}", 400)
end
@@ -92,7 +92,7 @@ module API
authorize! :admin_group, group
if ::Groups::UpdateService.new(group, current_user, declared_params(include_missing: false)).execute
- present group, with: Entities::GroupDetail
+ present group, with: Entities::GroupDetail, current_user: current_user
else
render_validation_error!(group)
end
@@ -103,7 +103,7 @@ module API
end
get ":id" do
group = find_group!(params[:id])
- present group, with: Entities::GroupDetail
+ present group, with: Entities::GroupDetail, current_user: current_user
end
desc 'Remove a group.'
@@ -134,7 +134,7 @@ module API
projects = GroupProjectsFinder.new(group).execute(current_user)
projects = filter_projects(projects)
entity = params[:simple] ? Entities::BasicProjectDetails : Entities::Project
- present paginate(projects), with: entity, user: current_user
+ present paginate(projects), with: entity, current_user: current_user
end
desc 'Transfer a project to the group namespace. Available only for admin.' do
@@ -150,7 +150,7 @@ module API
result = ::Projects::TransferService.new(project, current_user).execute(group)
if result
- present group, with: Entities::GroupDetail
+ present group, with: Entities::GroupDetail, current_user: current_user
else
render_api_error!("Failed to transfer project #{project.errors.messages}", 400)
end