User permisions for specific page and it's subpages

I need solution where user role can edit only “blog” part of page.
So I need define permissions for edit blog page and subpages (articles).

In docs there is part about page blueprint based permissions, but it’s look like there is no option for set specific role which can do something.

Is it possible with Kirby 3?


No, currently you cannot set role based permissions in blueprints. You could, however, set up different sets of blueprints based on user roles.

Thanks, it’s possible set all blueprint as read only?

If you set the options like this…

  changeSlug: false
  changeName: false
  update: false
  changeStatus: false
  changeTemplate: false
  delete: false
  changeTitle: false

…a user can’t do anything with the page anymore.

1 Like

This is not working for me:


if(($user = kirby()->user()) && $user->role()->name() == 'news') {
    $dir = __DIR__. '/blueprints/_news/_home.yml';
} else {
    $dir = __DIR__ . '/blueprints/home.yml';

Kirby::plugin('soma/permissions', [
    'blueprints' => [
        'home' => $dir

User with “news” role still see regular home.yml blueprint.

Do you still have a home.yml in /site/blueprints/pages? A regular blueprint will always override the ones defined in a plugin.

To avoid conflicts, I’d remove all standard blueprints and put them all into the plugin.

When I remove standard home blueprint, homepage load default blueprint.
When I remove default blueprint site white This page has no blueprint setup yet.
I don’t know if it’s problem with paths or?

Hm, you’re home.yml is not called home.yml for the news users but _home.yml, maybe that’s the problem.

No, I’m logged as admin, so $dir = __DIR__ . '/blueprints/home.yml'; should be working…

The its maybe the missing pages prefix::

'pages/home' => $dir

No :frowning: I try it with prefix, still This page has no blueprint setup yet

Hm :thinking: then I don’t know, it worked when I tested this with site.yml but I didn’t test other blueprints.

Ok, I just tested this and works perfectly for me.

I disabled the default home.yml.

Then in my plugin:


if(($user = kirby()->user()) && $user->role()->name() == 'client') {
    $dir = __DIR__. '/blueprints/client/home.yml';
} else {
    $dir = __DIR__ . '/blueprints/home.yml';

Kirby::plugin('texnixe/permissions', [
    'blueprints' => [
        'pages/home' => $dir

And the structure of my plugins folder:


My mistake :scream: 'page/home' => $dir instead 'pages/home' => $dir.

Thanks for patience :wink:

@texnixe Can you test your plugin within language variables? Thanks a lot!

The problem is within kirby() while Kirby is not initialized yet:

Can I get user role in different way?


The alternative would be to use a default folder setup based on user role when Kirby is initialized. It would be great is the blueprint extension would take a callback rather then just a plain array.

And how can I load different blueprints in this scenario please?

This option here allows you to define different blueprint folders based on user roles. It doesn’t work on an individual blueprint basis, though.

I currently have no other idea, since I don’t see a way to work around the problem with calling Kirby too early to get the user role.

Great news: The issue seems to have been fixed in the latest dev branch. In my test it worked.