Can we restrict an user to a specific locale ?

default discord avatar
6 months ago

Hello !

Scenario :

I have 2 users and 2 locales (EN, FR).

I have a Post collection with localized fields, but can I achieve to restrict user to edit only their attributed locale ?

-> The FR user could not edit the EN posts.

I thought about duplicate a post for each locale, add a locale field in users collection and in the post collection, and filter posts by the current user's locale field.

Any ideas about this ? Thanks in advance

  • default discord avatar
    6 months ago

    Not 100% but in the roles and access function you might be able to read locale and grant / deny access based on it

    So they can only read/write etc if the locale matches the collection

  • discord user avatar
    Payload Team
    6 months ago

    Hey @Britik yes you can access




    from the


    property when you set your access control.

    I would do something like this:

      access: {
        update: ({ req: { locale, language } }) => {
          if (locale === language) return true;
          return false;

    This compares the language you set in account options against the current locale, if they match you can update, otherwise you can read but not update.

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!


Connect with the Payload Community on Discord



Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.