Kirby

Hide/disable panel fields for different user roles

Similar questions have been asked for Kirby 2, but I haven’t found anything for Kirby 3.

Is it possible to hide/disable certain panel fields for different user roles?

Pseudo code:

fields:
  test:
    label: Only admins can edit me
    type: text
    permissions:
      - admin
1 Like

AFAIK this isn’t possible yet, but “better permissions” have been added to the to-do for 3.2 in the roadmap. Maybe this is something that will be implemented then?

I also think that this is not implemented. I wonder if there are some elegant workarounds?

If the Panel html exposes the user role, then I could use regular CSS to hide the content. (Not good for security, I know, but for the current simple use case, it could be a valid option.)

My current solution is rather hacky:
I have duplicated the blueprints folder, with some changes to the blueprints for editors/reviewers where certain fields is hidden. Then in the root index.php I check for the user role. If the user is editor or reviewer, then I change the path for the duplicated blueprint folder.

I works, but anytime a make some changes to the blueprints, I need to remember to adjust the duplicated blueprint folder also. :upside_down_face:

But the user role is not exposed anywhere as far as I know.