Skip to content

Make the casbin middleware enforcer config customizable#58

Closed
rolandjitsu wants to merge 1 commit intolabstack:masterfrom
transcelestial:master
Closed

Make the casbin middleware enforcer config customizable#58
rolandjitsu wants to merge 1 commit intolabstack:masterfrom
transcelestial:master

Conversation

@rolandjitsu
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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