Can i manage access control over the Block field?

default discord avatar
12 months ago

Is possible to manage access control over the each block field?

Eg: I have an admin user and a customer, but admin can see 5 block type fields, and customers only 2

  • discord user avatar
    Payload Team
    12 months ago

    Currently you cannot apply access control to blocks themselves - however you can restrict access for the fields within the block. If you just need to restrict customers from reading certain data, this could be enough for you. Or there might be something more suitable depending on your specific usage - if you want to share more details on your setup here we can discuss.

  • default discord avatar
    11 months ago

    Hello Jess, thanks for the answare!! I really apreciate your work together with the other members of Payload Team, you are incredible!!!

    i tried to restrict the block field based on my access control rules, but I needed the field to have the same name, to avoid a large variation of data... anyway, I wasn't successful, my solution was to copy the field of blocks from the payload's official code and apply my rules there, that way, my configuration for blocks it is like:

    { type: "blocks", name: "fieldName", labels: {...}, admin: { components: { Field: createBlock({ condition: (args) => myConditionFunction(args) }) } }, }

    i really intresting to make a pull request to transform this functionality native


  • default discord avatar
    last month

    @math536 what is this


    you created? I have a similar issues and this looks like the best approach so far... option B would be something like this
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.