Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

access restriction on relationship field

default discord avatar
Rarcif2 years ago
1

I have set up isAdmin and isAdminField permissions which works fine. However, I would like to set up categories so that it is only possible to select pre-existing categories, disallowing to create new categories if not admin. So if the role is editor (e.g. not admin), then only selecting existing categories in the category relationship field should be possible.



I have already tried with:



access: {


create: access.isAdminFieldLevel,


update: access.isAdminFieldLevel,


},



but the problem is that with this restriction the entire field becomes un-editable, so selecting existing categories wont work. Any suggestions on how to solve this?



Found the solution: I have to move the access control directly to the category collection and set the access so that admin is the only one that can write changes.

    Star on GitHub

    Star

    Chat on Discord

    Discord

    online

    Can't find what you're looking for?

    Get dedicated engineering support directly from the Payload team.