keystone

Keystone js 6: How to add access control on id field of a list


I have a problem with adding an access control on an id field of a list, since id field is added automatically when file schema.prisma is added. I want to make an id field with the following access:

access: { read: ()=> true, update: ()=> false }

I tried to find some explanation in keystone 6 docs, but it seems like there's none. Hope somebody could help me.


Solution

  • What you're describing is effectively the only behaviour ID fields support. Specifically:

    For better or worse, these behaviours can't be overridden. ID fields are just special in this respect – they don't support standard field-level access control.