Kirby Create Permission Issue

I was having issues with the new Kirby 3 create function but got that resolved only to find that if I am not logged into Kirby the create will not work and presents a “You are not allowed to create” warning.

Original issue: $page->create Kirby 3 change

The code:

Page::create([
  'parent' => page('careers/application/'),
  'slug' => $_id,
  'template' => 'application',
  'draft' => 0,
  'content' => $_POST
]);

Would I use $filepermissions or $pagepermissions for this?

You have to authenticate or impersonate: https://getkirby.com/docs/guide/users/permissions#authenticate-or-impersonate

1 Like

Thanks, I was on the right track there the part with the visitor permissions threw me off. Can create() be controlled through the blueprint for the page?

https://getkirby.com/docs/guide/users/permissions#visitors

It’s working fine with the impersonate either way. Thanks!

Yes, you can set

options:
  create: false

Or

options:
  create:
    editor: false

You can also set these permissions in your user blueprints, but then they apply to all pages. Note that blueprint settings also apply when you do something programmatically.