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

Wrong error message thrown when the base relation used in the from contains a rewrite #244

Open
rhamzeh opened this issue Apr 22, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@rhamzeh
Copy link
Member

rhamzeh commented Apr 22, 2024

Discussed in https://github.com/orgs/openfga/discussions/297

Originally posted by Chedi April 14, 2024


While trying to model some nested relation, I noticed that accessing any parent level except the one just above the current level gives me an error. For example

model
  schema 1.1

type user

type system
  relations
    define admin: [user]
    define staff: [user] or admin

type organization
  relations
    define system: [system]
  
type resource
  relations
    define system      : system from organization   
    define organization: [organization]
    
    define can_delete: staff from system

The error being

`can_delete` is an impossible relation for `resource` (no entrypoint)

The error message is incorrect, it should be:

`system` relation used inside from allows only direct relation.

The referenced base relation used after the from system in staff from system MUST be a directly assignable relation that has no rewrites and does not allow direct assignment of <type>:* and <type>#<relation>, so it MUST be of the form:

define system: [<type>, <type2>, etc..]

And this validation should take precedence over no entry point (also in this case, there is an entry point)

@rhamzeh rhamzeh transferred this issue from openfga/community Apr 22, 2024
@rhamzeh rhamzeh added the bug Something isn't working label Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant