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

fix: make ecforceEx return a result which include is request allow and explain #308

Merged
merged 1 commit into from
Oct 23, 2022

Conversation

imp2002
Copy link
Member

@imp2002 imp2002 commented Oct 22, 2022

Fix: #304

Fix: #305

How get explain?

e = new Enforcer("examples/rbac_model.conf", "examples/rbac_policy.csv", true);

EnforceResult enforceResult = e.enforceEx(sub, obj, act);
// or
EnforceResult enforceResult = e.enforceExWithMatcher(matcher, sub, obj, act);

enforceResult.getExplain();

And it does not affect previous instructions and code, when you don't need a explain.

boolean result = e.enforce(sub, obj, act);

request allow` and `explain`

Signed-off-by: imp2002 <imp07@qq.com>
@casbin-bot
Copy link
Member

@tangyang9464 please review

@codecov-commenter
Copy link

Codecov Report

Merging #308 (6d14a79) into master (c61f3e4) will decrease coverage by 0.15%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##           master     #308      +/-   ##
==========================================
- Coverage   69.56%   69.41%   -0.16%     
==========================================
  Files          47       48       +1     
  Lines        2185     2197      +12     
  Branches      407      407              
==========================================
+ Hits         1520     1525       +5     
- Misses        550      556       +6     
- Partials      115      116       +1     
Impacted Files Coverage Δ
...n/java/org/casbin/jcasbin/main/SyncedEnforcer.java 67.42% <ø> (ø)
...in/java/org/casbin/jcasbin/main/EnforceResult.java 46.15% <46.15%> (ø)
...ain/java/org/casbin/jcasbin/main/CoreEnforcer.java 78.01% <100.00%> (-0.44%) ⬇️
src/main/java/org/casbin/jcasbin/util/Util.java 59.37% <0.00%> (+1.04%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@hsluoyz hsluoyz merged commit 783030c into casbin:master Oct 23, 2022
@github-actions
Copy link

🎉 This PR is included in version 1.31.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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