Skip to content
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

Make the casbin middleware enforcer config customizable #58

Closed
wants to merge 1 commit into from

Conversation

rolandjitsu
Copy link
Contributor

Use the casbin.IEnforcer interface to allow different enforcers to be passed to the casbin middleware config.

So now we can do:

ce, _ := casbin.NewSyncedEnforcer("auth_model.conf", "auth_policy.csv")
h := Middleware(ce)(func(c echo.Context) error {
	return c.String(http.StatusOK, "test")
})

@codecov
Copy link

codecov bot commented Jul 8, 2021

Codecov Report

Merging #58 (d4923d3) into master (b7e53bc) will increase coverage by 0.28%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #58      +/-   ##
==========================================
+ Coverage   55.77%   56.06%   +0.28%     
==========================================
  Files           8        8              
  Lines         459      462       +3     
==========================================
+ Hits          256      259       +3     
  Misses        183      183              
  Partials       20       20              
Impacted Files Coverage Δ
casbin/casbin.go 86.20% <100.00%> (+1.59%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b7e53bc...d4923d3. Read the comment docs.

@aldas
Copy link
Contributor

aldas commented Dec 7, 2021

Closing in favor of #66

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants