Hello,

This module is hugely useful and we're very grateful for it, but would it be possible to turn off the enforcement of locks for users' own content please?

If I'm editing a node and doing some debugging, I often try to hit F5 to refresh the page; big mistake - I'm redirected away from the node edit screen and have to check my own document back in.

I've popped a suggested solution together by adding in a new permission - "bypass own locks" - and adjusted the checking mechanism:

--- checkout.module	2009-12-12 18:57:11.220688279 +0000
+++ checkout_alexh_20091212.module	2009-12-12 18:57:29.500592593 +0000
@@ -10,7 +10,7 @@
  * Implementation of hook_perm().
  */
 function checkout_perm() {
-  return array('check out documents', 'keep documents checked out', 'administer checked out documents');
+  return array('bypass own locks','check out documents', 'keep documents checked out', 'administer checked out documents');
 }
 
 /**
@@ -283,10 +283,10 @@ function checkout_node($nid, $uid) {
   if ($lock = checkout_fetch_lock($nid)) {
     // Node is already locked.
 
-    // Deny editing this node even if the node is locked by the same user.
-    // The only exception to this rule is when the user had previously acquired
-    // a persistent lock.
-    if ($lock->uid != $uid || !$lock->persistent) {
+    // Deny editing this node even if the node is locked by the same user. The only
+    // exception to this rule is when the user had previously acquired a persistent
+    // lock, or if the administrator has allowed users to bypass their own locks.
+    if (!($lock->uid == $uid && ($lock->persistent || user_access('bypass own locks')))) {
       $message = checkout_lock_owner($lock);
 
       if ($lock->uid == $uid) {

I hope this is useful for someone else as well, but if not, thanks for reading anyway =o)

Al - alex at greyhead.co.uk

CommentFileSizeAuthor
checkout_alexh_20091212.patch1.22 KBalexgreyhead