Jump to content

Page lock behaviour with regard to copying.


Kiwi Chris
 Share

Recommended Posts

I have a role that has page edit, view, and clone permissions on a specific template.

If a page using the template is locked by a user in a role with lock/unlock permissions on the template , the only button alongside it in the page tree is view, for users who don't have lock/unlock permissions.

If however, I also give the role page-lock permission on the template, they then get additional buttons, edit, copy, and unlock.

I don't actually want to give this role unlock permissions, but I do want the copy (clone) button to display alongside the page in the page tree.

Elsewhere, I've discussed how I've worked out how to create a hook to unlock the copy, but I want to keep the original page so a user without lock permissions can't unlock from the page tree it to make changes.

Question: What method should I hook into to intercept any attempt to change the lock status?

Link to comment
Share on other sites

  • 3 years later...

@ryan this is a bit of an old thread, but I never came up with a solution. Any suggestions?

I tried a hook in ready.php but it doesn't seem to do anything. Not sure if I'm hooking the right event?

/**
 * Prevent clients from unlocking BOMS as they need to have 'unlock' permission in order to be able to use 'copy' permission.
 */
$wire->addHookAfter('Pages::statusChangeReady', function ($event) {
		$currentPage = $event->arguments('page');
		$user = wire('user');
		if ($currentPage->template == 'bom' && $currentPage->isLocked() && $user->hasRole('client')) {
				$this->exit();
		}
});

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...