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
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
Hey
@309065921547468811yes you can access
locale
and
language
from the
req
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.
Star
Discord
online
Get dedicated engineering support directly from the Payload team.