Allowing interviewees to edit their own content via the panel

I wouldn’t create a new role per user, but one such role.

When the interview page is created (from a pages section within the user account set to max: 1), the user id of the user is stored in the interview page.

Interviewee.yml user role

title: Interviewee

permissions:
  # set permissions
sections:
  pages:
    type: pages
    template: interview
    parent: site.find('interviews')
    max: 1

In ther interview.yml blueprint, you set up the id field:

Title: Interview

fields:
  id: # id field that is auto-filled with id of user who creates page at page creation
    type: users
    disabled: true
    required: true
  question1:
    label: What are your favorite design tools?
    type: textarea

User id stored and disabled (email is shown but id stored):


The user role will only have access to the interview page (so in all other blueprints, the read option is set to false for this role.

The interview page gets a model where the isReadable() method is overridden, see here: https://getkirby.com/docs/cookbook/extensions/permission-tricks#override-the-isreadable-method-in-a-page-model

In this recipe, you will also find some other approaches.

1 Like