-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Increase role http error and test quality (#222)
* check action against policy on access check This updates access check requests to ensure the requested action exists in the policy for the provided resource beforce executing the request to spicedb and failing for this error. Knowing this we can return a relevant error (ErrInvalidAction) which we can now handle and return a 400 Bad Request status code instead of the previous 500 Internal Server Error status code we were returning due to the spicedb error we were receiving before. Signed-off-by: Mike Mason <[email protected]> * handle context canceled request 500 errors Context Canceled errors from http requests should not produce 500 errors as those are client requests. This change adds an error middleware which can capture the canceled context error and return a 422 status instead. Signed-off-by: Mike Mason <[email protected]> * validate create/update role actions requests This validates create/update role action requests before submitting the request to spicedb and handles the errors gracefully by returning 400 errors instead of generic 500 errors to the client. Signed-off-by: Mike Mason <[email protected]> * handle role http errors better and add http tests This handles role http endpoint errors better by better handling the errors returned and setting the response status codes. Additionally this adds testing to the http api so we may test these http status codes to ensure they are working as we expect. Signed-off-by: Mike Mason <[email protected]> * fix and add tests for role assignment endpoints This adds http tests and fixes the http status codes for the role assignment and unassignment endpoints to resolve 500 errors occurring when provided role ids were didn't exist. Signed-off-by: Mike Mason <[email protected]> --------- Signed-off-by: Mike Mason <[email protected]>
- Loading branch information
Showing
16 changed files
with
1,847 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.