User blueprints and panel permissions

I just played around a bit, and registering blueprints conditionally in a plugin based on user role also works:

<?php
if(($user = kirby()->user()) && $user->role() == 'client') {
    $dir = __DIR__. '/blueprints/client/site.yml';
} else {
    $dir = __DIR__ . '/blueprints/site.yml';
}
Kirby::plugin('my/plugin', [
    'blueprints' => [
        'site' => $dir
    ]
]);

But note that blueprints with the same name in the regular blueprints folder do override these settings.

3 Likes