Comments (4)
Actually, a good catch for situations like this.
We can provide a check on the Matcher level: if an Inquiry's attribute is callable or is an object (with some interface) then we can call it and obtain the value, otherwise we just grab the value itself.
The caching will be an opt-in on the inquiry-provider side and not baked into vakt anyway.
Meanwhile while this feature is not there you can create an Inquiry generator on your side that will calculate the Inquiry dynamically and use cached results if needed. The downside is that you'll need to calculate the attribute values for each Inquiry at least once - depending on the implementation and the use-case it can be reasonably performant.
Does it sound good to you?
from vakt.
Yes, RulesChecker
is what i actually aim for, not Inquiry
, a new(or updated) checker that allow inquiry's attributes be callable or object will be good enough.
Meanwhile while this feature is not there you can create an Inquiry generator on your side that will calculate the Inquiry dynamically and use cached results if needed. The downside is that you'll need to calculate the attribute values for each Inquiry at least once - depending on the implementation and the use-case it can be reasonably performant.
Not sure what a inquiry generator
like, and why you think it is a solution.
from vakt.
Yes, RulesChecker is what i actually aim for
That is correct. I meant exactly this.
Not sure what a inquiry generator like, and why you think it is a solution.
It's some sort of a function/class-method that takes some incoming parameters and returns an Inquiry object: let's say it takes Max username as input and returns an inquiry for Max as a subject and a is_friend_of_my_friends
boolean attribute (with a heavy computing done). So this inquiry has all the attributes computed and on the vakt's checker level all the policies will see the already computed value of is_friend_of_my_friends
.
On an inquiry-generator level you can leverage the caching or whatever in order not to calculate is_friend_of_my_friends
for the same user each time a new request is coming in.
from vakt.
Well, there heavy computed attributes maybe dynamic and requires re-eval every time, I am not meant cache them for later re-use.
If they are provide as a computed property, in the same round policies evaluation, they maybe hits multiple times, so cached_property
can prevent re-eval in the same round. (Not a business that vakt should mind)
from vakt.
Related Issues (20)
- Mongodb storage more selective filter query for `_create_filter` HOT 5
- Create caching mechanism for Storages HOT 2
- Usage example on README file doesn't work HOT 1
- Is role management supported? HOT 4
- really love vakt! And it becomes an issue.. HOT 3
- Support a `filter_by` option in Gaurd HOT 3
- MongoDB reverse regex issue resolved HOT 5
- use inquiries data in policies HOT 5
- Proposal for new features HOT 3
- GraphDB support HOT 1
- Rule based on foreign key relationship HOT 2
- Where to find stored policies? HOT 7
- Using Vakt with Pandas HOT 4
- Add Redis storage HOT 2
- Add FileStorage for JSON and YAML HOT 1
- Replace `conditions` with `rules`
- Possible high severity issue which exposes the Werkzeug debugger and allows the execution of arbitrary code HOT 1
- Broken readme link HOT 1
- How to use ResourceIn HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vakt.