Subpage builder cannot build when children have changeStatus: false

¿Can I create and publish a page via subpage builder, while preventing it to be un-published in the future by users?

I am using the subpage builder as is. And when it attempts to run, I get an error:

Status: "error", message: "The status for this page cannot be changed", code: 403, exception: "Kirby\Exception\PermissionException", key: "error.page.changeStatus.permission", ...

This seems to come from the fact that some subpages have changeStatus: false.

I would expect to be able to create AND publish the pages via subpage-builder, but keep their status locked against future status changes.

The use case is, for example, a fair with several editions. When a page ‘edition’ is created the whole structure of subpages is created with it. These subpages are categories such as, say ‘Exhibitions’ which should never be invisibilized (or deleted), unlike the items below them, say ‘Exhibition’.

This is the blueprint with the builder I am using:

title: Edición

options:
  changeTitle: true
  changeStatus: true

subpage_builder:
  - title: Acerca de
    uid: acerca-de
    template: acerca-de
    num: 1
  - title: Sedes
    uid: sedes
    num: 2
    template: sedes
  - title: Artistas
    uid: artistas
    num: 3
    template: artistas
  - title: Comisiones
    uid: comisiones
    num: 4
    template: comisiones
  - title: Exposiciones
    uid: exposiciones
    num: 5
    template: exposiciones
  - title: Programa público
    uid: programa-publico
    num: 6
    template: programa-publico
  - title: Programa pedagógico
    uid: programa-pedagogico
    num: 7
    template: programa-pedagogico
  - title: Información de viaje
    uid: informacion-de-viaje
    num: 8
    template: informacion-de-viaje
  - title: Aliados
    uid: aliados
    num: 9
    template: aliados

Thank you

A solution seeems to be pairing fine-grained permissions on the blueprints whose status I need the pagebuilder to change, the likes of:

...
options:
  changeStatus:
    *: false
    admin: true
...

…and then impersonating the admin user or the kirby user in the pagebuilder plugin:

<?php

function buildPageTree($page) {

    $kirby = kirby();
    $kirby->impersonate('kirby');
    ...

Thanks

Wow, I’m impressed, self-service support :heart_eyes:

1 Like

This is kind of wierd for few reasons.

1.

impersonate('kirby') means 'Admin' user in panel

Not sure why it’s not impersonate(‘admin’). I assume its because this way i can also create ‘admin’ user and be specific about it so the ‘kirby’ user is always there but has ‘admin’ permissions.

2.

If i am “superuser” - i should have no limits. From docs about impersonate()
'kirby' (impersonates the allmighty user with full permissions)
But this seems to be not true. If i do changeStatus: false
then even the “kirby” is not allowed to change the status

  changeStatus:
    *: false
    admin: true

with this it works but now i am forced to start using roles. I often use just the default “admin” user and i use permisions as safety against things that would lead to site breaking (like deleting homepage or whatever).

I understand that this way i could protect myself against third party plugins or something? But it feels wierd if you want to just generate something using code one would think there would be way to force it and bypass all permisions.
Thats what superuser means in linux world.