-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
casbin: add EnforceHandler to allow custom callback to handle enforcing. #66
Conversation
Codecov Report
@@ Coverage Diff @@
## master #66 +/- ##
==========================================
+ Coverage 55.41% 56.76% +1.35%
==========================================
Files 8 8
Lines 462 643 +181
==========================================
+ Hits 256 365 +109
- Misses 186 256 +70
- Partials 20 22 +2
Continue to review full report at Codecov.
|
819f0ac
to
d222dcd
Compare
@lammel could you review |
return config.ErrorHandler(c, err, http.StatusInternalServerError) | ||
} | ||
if !pass { | ||
return config.ErrorHandler(c, errors.New("enforce did not pass"), http.StatusForbidden) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make the status code configurable? For example, one might use 402 instead of 403.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be done inside/with errorhandler.
@lammel ping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
The generic workflow-changes might be better handled in a separate commit. But thats just cosmetic.
LGTM :) |
Should be ok now. Tagged a new release - 0.12.0. |
casbin:
CI:
honnef.co/go/tools/cmd/staticcheck
in CI flow causes dependency problems with older Go versions with we also support.This should be enought to handle cases for: #58, #61 and #65