#Cross entity permission refrence

1 messages · Page 1 of 1 (latest)

mild flicker
#

Hey there looking at the model now

#

Are you trying to achieve that;

  • in order to be owner of the page at least you need to be the viewer of the page?
potent star
#

viewer of space.

mild flicker
#

Bu it’s a prerequisite right?

potent star
#

yes

#

may be my though process is wrong, let me phrase the question differently. If I have the above schema, and If I save data for page with owner as user (and I don't have space relations with page inserted yet), The system allows it. What if I don't want that to happen. Something like I always want a page to be part of a space and should not exist independently?

mild flicker
#

Hey @potent star ,

Actually since Permify is default denny system and since you’re creating the pages under spaces in the workflow and schema only thing you need to do is add

  • create_page permission under the space and state you at least need to be a viewer.

But also you can do this explicitly adding
@space#viewer @space#editor relation types to the owner relation like you did.

What’s the problem with your current schema are you having issues on your tests?

potent star
#

in the playground I have added only one entry (nothing related to space or anything)

entity Type: page
Entity ID: 1
Relation: owner
Subject Type: user
Subject ID: 1

now if I run this

- name: Document Access Verification
  description: >-
    Verify owner of the document.
  checks:
    - entity: page:1
      subject: user:1
      assertions:
        owner: false

It says user:1 owner page:1, Expected: false, Actual: true. But I was expecting it to be false since there is no space exists.