Automatic page locking/unlocking | Community
Skip to main content
blockosmith
October 16, 2015
Solved

Automatic page locking/unlocking

  • October 16, 2015
  • 1 reply
  • 643 views

I have a requirement to automatically lock and unlock pages when an author opens and closes a page respectively (in order to avoid two authors editing the same page simulatenously). I was trying to leverage the currentPage.lock() and .unlock() methods - the .lock() method is easy enough to execute on page load, but I have no good means of triggering .unlock() when the page closes since currentPage isn't in the scope of jspDestroy(). Am I going about this the wrong way, or is there an easy way in CQ5.6 to trigger the unlock when the page is closed?

Thanks in advance.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

For this use case -- the event can only be tracked at the page level. So you could use a jquery event and send a callback through Sling to execute your lock command. Hope this helps you. 

1 reply

smacdonald2008
smacdonald2008Accepted solution
Level 10
October 16, 2015

For this use case -- the event can only be tracked at the page level. So you could use a jquery event and send a callback through Sling to execute your lock command. Hope this helps you.