Index: checkout.module
===================================================================
--- checkout.module	(revision 1569)
+++ checkout.module	(working copy)
@@ -47,11 +47,6 @@
       'access' => $admin_access,
       'weight' => 5,
       'type' => MENU_LOCAL_TASK);
-    $items[] = array('path' => 'admin/content/node/checkout/release',
-      'title' => t('Check-in content'),
-      'callback' => 'checkout_admin_release',
-      'access' => $admin_access,
-      'type' => MENU_CALLBACK);
   }
   else {
     if (arg(0) == 'user' && is_numeric(arg(1)) && $user->uid == arg(1)) {
@@ -69,6 +64,14 @@
         'callback arguments' => array(arg(1)),
         'access' => $user_access,
         'type' => MENU_CALLBACK);
+      }
+    if (stristr($_GET['q'], "admin/content/node/checkout/release")) {       
+      $items[] = array('path' => 'admin/content/node/checkout/release/'.arg(5),
+        'title' => t('Check-in content'),
+        'callback' => 'checkout_admin_release',
+        'callback arguments' => array(arg(5)), 
+        'access' => checkout_release_access(arg(5)),
+        'type' => MENU_CALLBACK);
     }
   }
 
@@ -235,7 +238,7 @@
   $date = format_date($info->timestamp, 'medium');
   $message = t('This document is locked for editing by !name since @date.', array('!name' => $username, '@date' => $date));
 
-  if (user_access('administer checked out documents')) {
+  if (checkout_release_access($info->nid)) {
     $uri = url("admin/content/node/checkout/release/$info->nid", 'destination='. substr(request_uri(),1));    // p.lindstrom - remove leading / from request_uri
     $message .= '<br />'. t('Click <a href="!uri">here</a> to check back in now. <strong>WARNING:</strong> Any unsaved changes in another window will be overwritten.', array('!uri' => $uri));
   }
@@ -358,3 +361,16 @@
   drupal_goto("user/$uid/checkout");
 }
 
+function checkout_release_access($nid) {
+  global $user;
+  
+  // if they have admin access let them release
+  if (user_access('administer checked out documents')) return 1;
+  
+  // but if they are the user who checked out the document, let them release regardless of "checkout admin" rights
+  $checkout_uid  = db_result(db_query("SELECT uid FROM {checkout} WHERE nid = %d", $nid));
+  if ($user->uid == $checkout_uid) return 1;
+  
+  return 0;
+}
+  
