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.
Can you make the status code configurable? For example, one might use 402 instead of 403.
There was a problem hiding this comment.
this can be done inside/with errorhandler.
|
@lammel ping |
lammel
left a comment
There was a problem hiding this comment.
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/staticcheckin 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