Record Locking
Created 5 years ago by ryanthompson

I have need to push one more feature into 3.5 and want to get some feedback.

The idea is to prevent 2 users from editing a record at the same time through the control panel. So if I am editing a page and someone else on my team logs in and goes to edit the same page they will get a notice that I am editing it and saving will be prohibited until I leave / release.

My thoughts are a JS script attached to the forms UI polls a lock table every (for example) 10 seconds. If no lock exists is creates one and touches the timestamp subsequently. The lock will use.. I guess the URL or maybe stream ID/entry ID as well as the logged in user ID.

As user B my poll would NOT create cause a lock file for the record exists and I don't own it - so I am disabled from saving / UI tells me so. I text user A and tell em to get lost and they leave the page in which case my next poll sees that the lock hasn't been updated in say.. 15 seconds and replaces the lock owner with my user ID instead. We can later build in a release link or something as well.

Thoughts?

ryanthompson  —  5 years ago Best Answer

Aaaand this is done! Wicked cool too.

ryanthompson  —  5 years ago

This would be a built in and default feature - you could opt out though with something like disabling it in options or with a simple property.

william  —  5 years ago

Finally! Yes go! Just do it!

dwains  —  5 years ago

Yes like the idea, only indeed keep in mind I sometimes open edit page in new tab and then have 5 tabs open. And a other team member then wants to edit a page he first needs to ask me to close page. Maybe make a js feature which reconize the activity on a page and then also gives me a warning that I have page open for 5 minutes and done nothing the lock is released and a other person had edited the page in mean time.

ryanthompson  —  5 years ago Best Answer

Aaaand this is done! Wicked cool too.