ok didn’t get that! It works perfectly then, thank you.
I confirm that it works.
ok didn’t get that! It works perfectly then, thank you.
I confirm that it works.
I run XAMPP Version: 7.2.15, PHP/7.2.15, on Win10 64Bit as my development system.
What I have done to test:
\index.php
to:<?php
require __DIR__ . '/kirby/bootstrap.php';
$kirby = new Kirby();
$user = $kirby->user();
if ($user && $user->role() == 'editor') {
$kirby = new Kirby([
'roots' => [
'blueprints' => __DIR__ . '/site/blueprints/bp_role_editor',
],
]);
};
echo $kirby->render();
\site\blueprints\bp_role_editor
and then a new directory \site\blueprints\bp_role_editor\users
.\site\blueprints\bp_role_editor\site.yml
that looks like:title: Website for Editor role
### site\blueprints\bp_role_editor\site.yml
columns:
- width: 1/3
sections:
parts:
headline: Pages for Editor role
type: pages
templates:
- notes # only this template-type is shown for this role at this menu level
create: false # avoid new pages at this menu level
delete: false
- width: 2/3
fields:
infofield:
type: info
label: Info for Editor role
text: |
This is the panel start page for the role "editor".
\site\blueprints\bp_role_editor\users\editor.yml
that looks like:title: Editor with Editor role
description: The Editor uses the panel to edit only the notes page and note pages as well as his own user fields.
permissions: # for this role, may be you want to make changes here!!!
access:
users: false
settings: false
site:
update: false
pages:
delete: false
user:
changeRole: false
changeName: false
delete: false
sections: # user fields for this role itself
meta:
type: fields
headline: User data
fields:
phone:
label: Phone [bp_role_editor\users\editor]
type: text
width: 1/2
mobile:
label: mobile Phone
type: text
width: 1/2
\site\blueprints\bp_role_editor\pages
and then I copied the file \site\blueprints\pages\notes.yml
to \site\blueprints\bp_role_editor\pages\notes.yml
and the file \site\blueprints\pages\note.yml
to \site\blueprints\bp_role_editor\pages\note.yml
.\site\blueprints\bp_role_editor\sections
and then I copied the file\site\blueprints\sections\notes.yml
to \site\blueprints\bp_role_editor\sections\notes.yml
.\site\blueprints\bp_role_editor\users\editor.yml
to \site\blueprints\users\editor.yml
.\site\blueprints\users\editor.yml
. So only in the file copy I deleted every text bp_role_editor\
.editor
as my test user.editor
and his permissions.Notes:
Good luck!
So that nobody gets confused: The solution described by @anon77445132 is basically the same that originated from @gillesvauvarin and described here: Custom blueprint for different roles
So just to be shure, regarding the title of this topic, if there is a role that I want to not be allowed to see the site panel but only the about page for example, there is no way for me to make them go to about page on login ?
Maybe using the user.login.after hook that @texnixe wrote about ?
Please see: User blueprint | Kirby CMS
I just found hook user.login:after and did this in the config:
'hooks' => [
'user.login:after' => function ( Kirby\Cms\User $user ) {
$page = $user->pageToModify();
if ($page->isNotEmpty()) {
$slug = $page->slug();
go("/panel/pages/$slug");
}
}
],
Thanks @texnixe