Skip to content

Commit

Permalink
[api] use proper error message (not permitted to modify a package sha…
Browse files Browse the repository at this point in the history
…ll not say you are not allowed to delete it)
  • Loading branch information
adrianschroeter committed Apr 17, 2013
1 parent 9b6e78d commit 00d9c71
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/api/app/controllers/source_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,13 @@ def index_package
return
end
elsif not @http_user.can_modify_package?(tpkg)
render_error :status => 403, :errorcode => "delete_package_no_permission",
:message => "no permission to delete package #{tpkg.name} in project #{tpkg.project.name}"
if request.delete? or (request.post? and not read_commands.include? command)
render_error :status => 403, :errorcode => "delete_package_no_permission",
:message => "no permission to delete package #{tpkg.name} in project #{tpkg.project.name}"
return
end
render_error :status => 403, :errorcode => "cmd_execution_no_permission",
:message => "no permission to modify package #{tpkg.name} in project #{tpkg.project.name}"
return
end
end
Expand Down

0 comments on commit 00d9c71

Please sign in to comment.