Temporarily disable page edit


i want temporary disable page edit feature for several users/roles.

Maybe is it possible to set a temporary permission before a page is loaded
in panel?

or any oter ideas?


What do you mean by “temporarily”? Something based on date? Then you could use a condition in your roles code.


No. Not date. In my case a value of a hidden field.
There is a value if a page is in a audit process… then it should only be viewable
untill audit is done and the page is released/published.

It works if i put this into the role definition:

'panel.page.update' => function() {
  return $this->target()->page()->auditpending() === '0';

But at the end it doesn’t help much. I have to catch this with a hook… perform some kind of rollback due the new values are already written

Sadly there is no “before page update” hook.


// site/roles/editor.php
return [
  'name'        => 'Editor',
  'default'     => false,
  'permissions' => [
    '*'                 => true,
    'panel.page.update' => function() {
      if($this->target()->page()->audit()->bool()) {
        return false;
      } else {
        return true;

‘Rollback’ in the hook works… push save…boom…old content back.

  try {
  } catch (Exception $e) {echo $e->getMessage();}

What? I don’t see the connection to the above question…

i have to prevent editing of all fields except the “audit…changes accepted or not” fields so i can’t disable the complete form.
Within the hook i can now process the audit fields, set the content to old (overwrite all changes) and write the old content back.

A special save message would be nice… is there a way to alter the “smiley” message in the green “saved” box message top/right after hitting save?