Comments (2)
Hey @IohannesArnold. Apologies for the slow response here, and for the issues you've encountered.
Is this a bug in oso or my failure to write a proper ruleset? If the latter, I think that the documentation could be clearer
It's kind of a bit of both.
It's currently a pretty big limitation/sharp edge of Polar that we'd like to remove. You're right that Polar is looking for an existential assertion, and currently the problem is the rule:
has_relation(parent: Group, "managing_group", child: Group) if
child.managed_by.id = parent.id;
Which creates a partially-constrained variable parent
which has the properties parent matches Group
and parent.id = 2
.
Which then goes through to the has_role
rule and ends up adding more conditions, which it can't handle.
To address it, you would need to write the rule as:
has_relation(parent: Group, "managing_group", child: Group) if
child.managed_by = parent;
which should work fine.
We'd like to improve this in future versions
from oso.
I'm running into the same issue, and the above solution by @samscott89 only works if both child.managed_by
and parent
are strictly identical. It's my understanding that at the moment, the Polar compares every property between the two dictionaries.
However, if one of the two dictionaries has a single property with a different value (let's say a metadata field with a timestamp, or anything else outside of the primary key), the two dictionaries won't be considered equal, and the assertion will fail.
This behaviour seems a bit limiting, considering there are many cases where you might have slightly different dictionaries (maybe one of them is a partial copy of the other, maybe it's been slightly altered before an update operation). Also, in most cases, you might not have a managed_by
dictionary property but rather a string one, like manager_id
, which you would want to compare to parent.id
. Does that mean this use case is not supported?
Isn't there a more foolproof way of explaining to Polar how it's supposed to consider that two dictionaries are equal?
from oso.
Related Issues (20)
- Drop support for Python 3.6 which is end-of-life
- Invalid state: Type `User` occurs more than once as the target of a relation HOT 2
- [Feature] Support ASP.NET Blazor Web Apps
- vscode extension not working
- Amazon Linux 2 support dropped due to glibc >= 2.28 requirement HOT 1
- Vulnerable dependency found - remove_dir_all HOT 1
- Syntax highlighting bug in Polar language server HOT 2
- Planning the next major version HOT 14
- How can I define Enum fields for register_class() HOT 3
- Getting all users who have a specific permission / list of permissions on a specified resource HOT 1
- ci failing on trunk
- [ask] rule match issue HOT 1
- Provide a VS Code web extension entrypoint HOT 4
- Using __dirname to locate polar_wasm_api_bg.wasm causes problems in AWS nodejs lambda
- Not installable on Python 3.12 HOT 4
- global roles
- Add support for `fmt.Stringer` implementations in Go SDK Oso methods, or propagate a warning message in instances where a type defined string is passed as the `action` argument
- Feature request: support for string interpolation or concatenation in polar
- linker error when building on alpine linux 3.19 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 oso.