Hello,
I try to play with “permissions” in Kirby 2.4.0 to build a custom panel for one of my custom role.
I have created a “Speaker” custom role and a “Proposals” page and template.
I want the “Speaker” connected to be able to create/edit/delete their own “Proposal” by creating some “Proposal” subpages in the panel and to be able to edit their own user information, nothing more.
So I would like to give “Speaker” minimum permissions:
- Edit (update) their own user informations only
- Edit (delete/update/create) their own proposals (subpages) only (other subpages proposals belong to other “speaker” user and must be hidden)
And I not only want to disable other panel information, I want to completely hide other UI panel features to “Speaker” role.
Things to hide (not only disable) to “Speaker”:
- “Sites options” item menu in the top burger menu > done!
- Other users row in the “Users” page > ?
- Other “Proposals” subpages (those which belong to other “Speaker”) > ?
- Other pages than “Proposal” page in the pages widget > ?
- Possibility to “Add” new pages > ?
- Possibility to “Edit” the “Proposals” page (but not “Proposal” subpages) > ?
This is what I have tried until now:
kirby/site/roles/speaker.php
return [
'name' => 'Speaker',
'default' => true,
'permissions' => [
// All
'*' => true,
// Options
'panel.access.options' => false,
// Widgets
'panel.widget.site' => false,
'panel.widget.pages' => true,
// Page
// ???? don't know how to do!
// User
'panel.user.delete' => false,
'panel.user.create' => false,
'panel.user.update' => function() { return $this->user()->is( $this->target()->user() ); }
// Still view other users raw information :-/
]
];
I would be very thanksfull to have some help to achieve this.
Thx