Skip to content

Commit

Permalink
fix(wolf-rbac): Return 403 error code when the user does not have per…
Browse files Browse the repository at this point in the history
…mission. (apache#7497)
  • Loading branch information
iGeeky authored and Liu-Junlin committed Nov 4, 2022
1 parent c935d55 commit c804949
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apisix/plugins/wolf-rbac.lua
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ function _M.rewrite(conf, ctx)
core.log.error(" check_url_permission(",
core.json.delay_encode(perm_item),
") failed, res: ",core.json.delay_encode(res))
return 401, fail_response("Invalid user permission",
return 403, fail_response("Invalid user permission",
{ username = username, nickname = nickname }
)
end
Expand Down
6 changes: 3 additions & 3 deletions t/plugin/wolf-rbac.t
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ done
for _, data in ipairs(data) do
local code, body = t(data.url, ngx.HTTP_PUT, data.data)
ngx.say(code..body)
ngx.say(body)
end
}
}
--- response_body eval
"201passed\n" x 3
"passed\n" x 3
Expand Down Expand Up @@ -342,7 +342,7 @@ x-rbac-token: V1#invalid-appid#rbac-token
=== TEST 16: verify: failed
--- request
GET /hello1
--- error_code: 401
--- error_code: 403
--- more_headers
x-rbac-token: V1#wolf-rbac-app#wolf-rbac-token
--- response_body
Expand Down

0 comments on commit c804949

Please sign in to comment.