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

Collection not loading for user with Custom Item Permission #8073

Closed
3 tasks done
stgonzales opened this issue Sep 16, 2021 · 5 comments
Closed
3 tasks done

Collection not loading for user with Custom Item Permission #8073

stgonzales opened this issue Sep 16, 2021 · 5 comments

Comments

@stgonzales
Copy link

Preflight Checklist

Describe the Bug

Similar issue(#7286). Only open another one according to @rijkvanzanten instructions.

After setting a custom Item Permission in a Role, users in that role can't see the collection content.
I have two collections (Site and Text), collection Text has a relational field Many to One with Site.
The collection Text also have relational fields with other collections.
Some users have permission to see specific items in the collection Text, so I use a custom Item Permission in the user Role to filter Text collection items with a specific site_ id:

{
    "site_id": {
        "_eq": "a994fc30-c0af-4b63-bd92-ea960eb72562"
    }
}

After that when the user tries to open the collection it keeps only loading.

image

And the message error Cannot read properties of undefined (reading 'related_collection') on the console:

image

To Reproduce

  1. Create two collections and create a Many to One relation on the second collection with the first.
  2. Create a new user and new Role with a custom read item permission on the second collection and full read permission on first collection.
  3. Login with the new user and try to open the collections.

These were the steps that I did before opening this issue.

What version of Directus are you using?

v9.0.0-rc.92

What version of Node.js are you using?

v14.17.0

What database are you using?

PostgreSQL 13.4 (Debian 13.4-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit

What browser are you using?

Chrome

What operating system are you using?

macOS

How are you deploying Directus?

running locally

@azrikahar
Copy link
Contributor

Hi, when you set the filter rule for that role, were the fields permissions set/checked? I was able to reproduce the error (albeit slightly different error, mine is (reading 'fields')), but once I ensure the fields are checked, it was resolved in my case.

When I follow the 2nd step in your reproduction step, the field permissions aren't selected after we set item permissions only. Here's what I meant:
RYeg4Ce2SE

@stgonzales
Copy link
Author

Hi @azrikahar,

were the fields permissions set/checked?

Yes, all the fields are checked

Screen.Recording.2021-09-22.at.10.59.32.mov

.

@azrikahar
Copy link
Contributor

@stgonzales thanks for the clear video! definitely helped to clear things up as I thought when you mentioned "full read permission" meant "Full Access" in my previous test.

Unfortunately, I am still unable to reproduce this on rc.92, with the same configurations you described on your issue & what is shown in your video (attached my video here, let me know if I missed anything). My current suspicion would be on the The collection Text also have relational fields with other collections. you described.

Would you mind trying out the reproduction steps you shared without any relational fields on your end? It'll be very helpful for us to narrow down on the actual root cause here 👍


4GpHDvmV9f.mp4

@joselcvarela
Copy link
Member

Maybe you can share a reproducible database dump @stgonzales I think it would be easier.

@rijkvanzanten
Copy link
Member

Thank you for taking the time to submit this! Unfortunately, our team was not been able to reproduce it based on the information provided. Therefore, we will close this ticket for now, but will happily re-open it if new details are provided that allow us to reliably replicate the problem.

As a reminder:

  • Provide as much detail as possible in the issue description
  • Video screen captures and clear steps are very helpful
  • A full SQL dump is the fastest way for us to test/resolve (can be sent privately)
  • Make sure you are on the latest version of Directus
  • Did you try turning it off and on again?

This is an automated response.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants