Comments (6)
from drf-access-policy.
@rsinger86 Any help would be greatly appreciated. I thought that the issue could be happening because of a user error but here is my current config and the error still appears:
class GenericObjectPermission(AccessPolicy):
# ? Used for actual operations
statements = [
{
"action":["*"],
"principal":"authenticated",
"effect":"allow",
"condition":"is_adminoffice"
},
{
"action":["*"],
"principal":"authenticated",
"effect":"allow",
"condition":"is_sysadmin"
},
def is_sysadmin(self, request, view, action) -> bool:
return True
def is_adminoffice(self, request, view, action) -> bool:
return True
The request normally works but sometimes it will fail. This only happens in browser (I have been unable to reproduce it with curl)
from drf-access-policy.
I'm leaning toward a 1.0 release with a breaking change that delineates the following:
- method conditions that contain complex boolean expressions and are evaluated with pyparsing
- simple method conditions that reference a single method
I made a mistake in not doing this from the start (see #55). I'm thinking the best way to handle would be to have a separate expression_condition
key. With this update, your statements would avoid pyparsing.
from drf-access-policy.
@rsinger86 Thank you for your response and for this project! It has really helped ease the development of my product.
How can I go about avoiding this issue (Im planning on opening up my project to beta and this is kinda the last blocker)? I've seen this happen with both simple method conditions as well as a basic complex expression e.g. (is_adminoffice or is_sysadmin)
so I'm not really sure how to stop/avoid it. I can also downgrade to 0.8.6 if this error does not occur there.
Thank you again for your help.
from drf-access-policy.
@HonakerM the 1.0 release should make this work for you
from drf-access-policy.
@rsinger86 just checked and it works perfectly!! Will let you know if I encounter the error again. Thank you again for all your work.
from drf-access-policy.
Related Issues (20)
- Can I write all policies in one json file? HOT 1
- Support dynamic response message and code HOT 4
- ModuleNotFoundError: No module named 'pyparsing'
- Version 0.8.5 breaks conditions with `*` as params HOT 1
- Default value "effect": "allow"
- Introduction of support for condition expressions is a breaking change on existing condition strings HOT 2
- `view.get_object()` raises AssertionError inside condition method HOT 1
- Reusable conditions not working
- Why "principal: authenticated" is "not anonymous" instead of "is authenticated"? HOT 1
- [Question] Dealing with unnecessary repetition of DB hits... HOT 1
- [BUG] <lambda>() missing 1 required positional argument: 'token' HOT 3
- Support db statements
- How to implement field based access as mentioned in the docs? HOT 1
- Include additional information in permission denied response HOT 1
- Order of inheritance of AccessViewSetMixin in Viewset matters? HOT 1
- Enforce access policy through PrimaryKeyRelatedField HOT 3
- FieldAccessMixin with read_only=True serializer requires request attribute HOT 2
- Documentation webpage doesn't work HOT 1
- Documentation bug: reusable conditions method should not use "self". HOT 1
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 drf-access-policy.