Merge "Return 403 instead of 401 when policies reject" into milestone-proposed

This commit is contained in:
Jenkins 2012-01-26 07:27:26 +00:00 committed by Gerrit Code Review
commit facd8951f7
3 changed files with 3 additions and 3 deletions

View File

@ -573,7 +573,7 @@ class ResourceExceptionHandler(object):
if isinstance(ex_value, exception.NotAuthorized):
msg = unicode(ex_value)
raise Fault(webob.exc.HTTPUnauthorized(explanation=msg))
raise Fault(webob.exc.HTTPForbidden(explanation=msg))
elif isinstance(ex_value, TypeError):
LOG.exception(ex_value)
raise Fault(webob.exc.HTTPBadRequest())

View File

@ -174,7 +174,7 @@ class SimpleTenantUsageTest(test.TestCase):
try:
res = req.get_response(fakes.wsgi_app(
fake_auth_context=self.alt_user_context))
self.assertEqual(res.status_int, 401)
self.assertEqual(res.status_int, 403)
finally:
policy.reset()

View File

@ -204,7 +204,7 @@ class ResourceTest(test.TestCase):
req = webob.Request.blank('/tests')
app = fakes.TestRouter(Controller())
response = req.get_response(app)
self.assertEqual(response.status_int, 401)
self.assertEqual(response.status_int, 403)
def test_dispatch(self):
class Controller(object):