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.

Only allow changes to certain fields when in base language

default discord avatar
kvist__last year
1

Is it possible to only allow changes if locale is equal X?



I have some fields that is not localized, I want them to only be editable when on a specific locale.



It's some checkboxes regarding SEO - see image 🙂

  • discord user avatar
    dribbens
    last year

    You could write a

    beforeValidate

    hook that does your own access control of sorts by looking at the

    req.locale

    and the

    req.user

    to throw a 403. The issue with doing this is that you have no feedback for the user that they won't be able to do this. The normal

    access

    control built into Payload informs the UI on what the user can do to prevent this UX problem.



    We do have a feature planned for locale based

    access

    control so the answer might just be to hang tight :/

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.