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

How to prevent a role from creating a file at the File Library root? #21873

Closed
nicksergeant opened this issue Mar 15, 2024 · 2 comments
Closed

Comments

@nicksergeant
Copy link

nicksergeant commented Mar 15, 2024

Potential bug?

We have a number of clients in our Directus instance and each one has their own file library folder directly under the root file library folder. We want to prevent them from uploading files into the actual file library root since they will not be able to view anything outside of their folder.

The file permission we are trying to use is:

    {
      action: 'create',
      validation: {
        folder: {
          _nnull: true,
        },
      },
    },

image

@hanneskuettner
Copy link
Contributor

hanneskuettner commented Apr 22, 2024

The problem here is that the folder field is not transmitted on item creation and is therefore undefined and not null.
I opened a separate issue #22278 that aims to deal with the problem of detecting unsubmitted fields.

For your situation a valid workaround seems to be to set the field preset to

{
    "folder": null
}

and then use the _nnull filter.

@hanneskuettner hanneskuettner closed this as not planned Won't fix, can't repro, duplicate, stale Apr 22, 2024
@nicksergeant
Copy link
Author

@hanneskuettner awesome! Thanks so much for the workaround here - that does indeed work 👍.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants