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

Add support for passing the model programmatically #3

Merged
merged 6 commits into from
Jan 9, 2021
Merged

Add support for passing the model programmatically #3

merged 6 commits into from
Jan 9, 2021

Conversation

kibertoad
Copy link
Contributor

@kibertoad kibertoad commented Jan 9, 2021

fixes #2

(this seems not to work, fixing now)

@codecov-io
Copy link

codecov-io commented Jan 9, 2021

Codecov Report

Merging #3 (f002cfc) into master (4ed0ad1) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master        #3   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines           14        14           
=========================================
  Hits            14        14           
Impacted Files Coverage Δ
plugin.js 100.00% <100.00%> (ø)

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 4ed0ad1...f002cfc. Read the comment docs.

@kibertoad
Copy link
Contributor Author

@simoneb Do you think it makes sense to narrow down possible type for enforcerParam? casbin types are not very helpful here, they define params as any[]

@kibertoad kibertoad marked this pull request as draft January 9, 2021 18:26
@kibertoad kibertoad marked this pull request as ready for review January 9, 2021 18:34
@kibertoad
Copy link
Contributor Author

Having thought about it more, semver major approach seems more elegant and less complex.

Copy link
Member

@simoneb simoneb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. this will require a major semver bump as modelPath is replaced by model. the change makes sense to me anyway, modelPath was misleading

test/casbin.test.js Outdated Show resolved Hide resolved
@simoneb
Copy link
Member

simoneb commented Jan 9, 2021

@simoneb Do you think it makes sense to narrow down possible type for enforcerParam? casbin types are not very helpful here, they define params as any[]

yeah they're defined like that because there's quite a bit of logic that they apply to the arguments provided to newEnforcer, see https://github.com/casbin/node-casbin/blob/master/src/enforcer.ts#L356.

nevertheless, I like the slightly more typed way we do it here, which gives some guidance about how to do it while still keeping lots of the flexibility

@kibertoad
Copy link
Contributor Author

@simoneb Should I do the version bump or you'll do that during the release process?

@simoneb
Copy link
Member

simoneb commented Jan 9, 2021

@simoneb Should I do the version bump or you'll do that during the release process?

I'll bump before release, thanks

@simoneb simoneb merged commit 63e48a5 into nearform:master Jan 9, 2021
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.

Expose programmatic way of loading a model
3 participants