Fields inside block is editable even if you set `access.create and access.update` as false

default discord avatar
yhn5790
4 months ago
6

1. This happens only for fields inside blocks.


2. If you add the same field inside tab or top level of the document it behaves as expected



P.S: These are payload components

  • default discord avatar
    imcorfitz
    4 months ago

    I agree - this doesn't behave as one would expect. In your case, would it work if you set

    admin.readOnly: true


    Alternatively if you want to hide the fields for certain users, but leave available for admins, you could use

    admin.condition

    :


    condition: (_data, _sib, { user }) => user?.role === "admin",
    Screenshot_2023-05-29_at_08.09.00.png
    Screenshot_2023-05-29_at_08.09.10.png
  • default discord avatar
    yhn5790
    4 months ago

    Yes,

    readOnly

    works as expected



    This works. Would prefer it to a disabled field else will go with this approach. Thanks 🙌



    Raising this as a bug 🙂



    https://github.com/payloadcms/payload/issues/2724
Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

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