Skip to content

Commit ae3cdcc

Browse files
sdelanodanielsdeleo
authored andcommitted
raise forbidden instead of unauth when appropriate
1 parent bdbf0e0 commit ae3cdcc

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎chef-server-api/app/controllers/application.rb‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,23 @@ def is_admin
5656
if @auth_user.admin
5757
true
5858
else
59-
raise Unauthorized, "You are not allowed to take this action."
59+
raise Forbidden, "You are not allowed to take this action."
6060
end
6161
end
6262

6363
def is_admin_or_validator
6464
if @auth_user.admin || @auth_user.name == Chef::Config[:validation_client_name]
6565
true
6666
else
67-
raise Unauthorized, "You are not allowed to take this action."
67+
raise Forbidden, "You are not allowed to take this action."
6868
end
6969
end
7070

7171
def admin_or_requesting_node
7272
if @auth_user.admin || @auth_user.name == params[:id]
7373
true
7474
else
75-
raise Unauthorized, "You are not the correct node (auth_user name: #{@auth_user.name}, params[:id]: #{params[:id]}), or are not an API administrator (admin: #{@auth_user.admin})."
75+
raise Forbidden, "You are not the correct node (auth_user name: #{@auth_user.name}, params[:id]: #{params[:id]}), or are not an API administrator (admin: #{@auth_user.admin})."
7676
end
7777
end
7878

0 commit comments

Comments
 (0)