Hey everyone!
I’m currently working on a user permission system for a magazine, which has three relevant user roles: author, editor and lead editor.
I would like to limit the user permissions of the editors, that they can only create authors and not editors or lead editors. Something like this:
'hooks' => [
'user.create:before' => function ($input) {
if ($this->user()->role() == 'editor') {
if ($input->role() !== 'author') {
throw new Exception('Sorry! Du kannst nur Autor*innen erstellen.');
}
}
},
So I tried it with the user.create:before hook, but whenever I want to use or inspect the $input variable inside of the hook with dump(), var_dump() or print_r() I get the following error message:
e.g.: dump($input)
Is there something obvious I’m not aware of or do I have to do it in a different way?
Kirby Version: 3.3.5
PHP: 7.4.1
Thanks in advance!