How to change user permissions concerning blocks and layouts

Maybe I am overlooking something in the docs - I have built the backend using the new blocks in the panel which was an amazing experience.

Now I would like to hand over the site to my client - and keep them from changing block and layout settings, as well as from deleting or changing the current kinds of blocks and layouts (they should still be able to change the blocks’ contents, of course).

My question is: How can I limit user permissions concerning blocks and layouts, based on roles? I am thankful for every idea.

Kirby has no way of setting permissions on the field or subfield level.

You could probably disable the settings fields in layouts and blocks by overriding the fields inside the blocks with custom blueprints and limit the number of blocks to the current number so that no new blocks can be added (unless others are removed).

As far as I know, there are no settings that would prevent changing a block type (but you could try and hide the buttons via custom Panel CSS).

Many thanks for the quick answer!

I’ll probably go for the CSS solution, then, and limit the number of blocks.

I hope it’s ok to add some optional thoughts in more depth:

I wonder if this interesting new situation - blocks and layout - should not also merit consequences for the way Kirby is treating permissions.

As yet, in websites where I am not using blocks and layouts, Kirby is a CMS where I as the developer very strongly pre-structure the panel (and therefore the possible contents of the page) through the use of blueprints.

Simply put, I decide which of the contents of the page are at all editable for the users, in the panel. And normally, users can change neither the properties of the elements (e.g. textarea) I am giving them nor their order. This applies even to users with admin permissions.

In fact, on a site without blocks, the only way they can somehow effect a change to the elements of a page and their order is by changing the template of the page, as a whole. And this can be handled by simply not giving them the user permissions necessary (i.e. changeTemplate: false). The permissions here are not on the field or subfield level, so Kirby allows me to do this.

However, with blocks and layouts, the situation is changed. Blocks allow users to change the whole structure the page. Of course, users still cannot edit the block’s code. Yet they can easily swap one block for another and change their order and layout on the page.

In a way, I see, of course, that this is the whole point of blocks. It is what is so great about them.

However, I wonder, if these kinds of changes the users can now make really still merit the label ‘field or subfield level’.

In my view, it is one of the big strengths of Kirby, that I can build a custom panel where users can only do what they are supposed to do - and are never confronted with unnecessary menus or options. This is actually what many of my clients like about Kirby. And, for me, it would be really great to be able to do this, to keep things simple in the panel, even when I decide for some reason to use blocks.

I am sorry for the long answer. I know there is no easy solution for this and appreciate very much the great work you are doing here!

1 Like

It’s totally ok, however, our feedback channel would be the better place to post this.

Thanks for the good suggestion :slightly_smiling_face: