To be honest, I’m kind of confused. I know user permissions were planned for 2.2, but now I’m not sure if I’ll be able to achieve what I want to achieve in the upcoming version. I’m faced with the following situation:
I have a pretty complex site structure. I want to be able to create an user (role), which is allowed to access the panel, but only edit specific pages (or specific subfolders). I don’t really care whether he can view the other pages in the panel, it’s just about restricting permission to edit (or save).
I hope that makes sense. Is there any way to achieve that in Kirby (2.2)?
Yes, permissions were planned for 2.2, but I don’t think permissions will make it into the upcoming release, so there will be not out-of-the box solution yet.
We were planning permissions to be part of 2.2.
While basic permission handling has made it to the core, including it into the panel still takes time. We have been around with a few attempts but ultimately they didn’t feel right. 2.2 completely restructures/decrufts the panel, we don’t want to clog it again with just any implementation of permissions. Instead we want to find one that is neat, sustainable, and robust for the future of Kirby. Especially regarding the question of permissions per blueprint, we haven’t found a good way yet. But we will keep working on that, so user permissions for the panel will eventually made it into a release
Kirby 2.3 contains some preparation code, but permissions itself have not yet been implemented. Permissions are high priority for us at the moment and we are working on it right now actually. However we can’t promise when it will be done. As written above, it needs time to make it robust and stable.
Please note that the API you are referring to ($user->hasPermission()) will likely be changed with the new implementation.
Waiting for some kirby upgrades, I added some logic to config.php:
//Kirby non ha ancora implementato le permission, per cui le tabello qui
c::set('hnt.roles.edit.admin',true);
c::set('hnt.roles.edit.editor_a',true);
c::set('hnt.roles.edit.editor_b',true);
c::set('hnt.roles.edit.unactive',false);