Sorry, we don't support your browser.  Install a modern browser

Introduce user permissions for blocks and layouts#245


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 big decisive changes the users can now make still belong to the category of ‘field or subfield level’ permissions which are not possible in Kirby - of if they should perhaps belong to a more important category of user permissions similar to changeTemplate?

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.

7 months ago

It seems like you don’t need blocks then and that’s completely fine. Blocks are not some monumental shift in kirby philosofy it’s just that some clients require exact opposite what you are talking about and want to change the whole pages. It’s also worth noting you don’t have to use blocks for whole page. You can have multiple layout fields on one page in panel and let them just change small parts.

I am not sure what feature you are proposing. Do you want to have permissions so some users cant add/rearange blocks and just can fill in the content of blocks?

7 months ago

Thank for your answer. I see your argument - blocks are just an additional choice, on a take-or-leave basis. They do not change the basics of how pages in kirby can or should be constructed. So if the client likes the additional possibilities, fine, but blocks are not, by any means, necessary for or integral to kirby.

I also understand that, for some clients, it is great to be able to change the order and even type of blocks, to their liking. It really is great, actually, that they can do this now - and I appreciate that I can give this freedom to those who want it.

However, there are other clients who do not wish to have these possibilities. Who like the feeling that the panel is ‘safe’ and they cannot, by accident, delete or change an element.

Of course, I could simply, as you suggest, build these pages without blocks. And that would be fine.

But then: Why should kirby limit itself, in this way?

Why should it make blocks an either-or-decision: Either you use blocks with the first kind of clients who like freedom - or else you cannot use them at all?

So what I would like to propose is to give developers the additional and optional choice to introduce the same limitations for blocks which already govern non-block elements in kirby. Recognizing that with new possibilities come new responsibilities.

This means for me: Regardless of whether I am using only one block on a page or building the whole site using blocks - in both cases, it would be great to have the option to introduce limitations on what users can do with them.

Practically, that could mean, exactly as you say, introducing permissions so users can fill in the content but are not able to add or change or rearrange blocks.

6 months ago