2

We have custom permission setup where we have certain admins that are only allowed to edit specific entries. This is done by modifying the entries sources:

Event::on(
    Entry::class,
    Element::EVENT_REGISTER_SOURCES,
    [$this, 'modifyEntrySources']
);

And by hooking into cp.users.edit:

Craft::$app->getView()->hook(
    'cp.users.edit',
    function ($context) {
      if (!$this->canEdit($context['entry'])) {
        throw new ForbiddenHttpException('You do not have permission to edit this entry!');
      }
    }
);

This works great except for the modal editing, because the cp.users.edit does not cover the modal. I believe the modal is driven by isEditable on the entry but I am unsure how to hook into that.

Any advice would be greatly appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.