I recently started using Content lock and noticed that users can release document locks in the /user/x/content_lock list. Same as someone noticed about the older Checkout module - http://drupal.org/node/553552

I am a newbie to PHP and drupal, so i dont know how this should be done properly, but I managed to workaround this by editing the content_lock.module at line 477:

$row[] = l(t('release lock'), "$url/$data->nid");

changing it to:

  global $user;
  if ($user->uid == $uid || user_access('administer checked out documents') )
  {
    $row[] = l(t('release lock'), "$url/$data->nid");}
  else {
    $row[] = 'N/A';
  }
    $rows[] = $row;
  }

If it is ment to work that way, maybe someone could make use of it. Would be nice if somebody could make a proper patch/commit to this issue.
Most logical would be - having a configuration option/additional permission to set whether users can release other users locks.

Comments

kestutisb’s picture

Sorry, the second code bit was pasted with two extra lines. Should read:

  global $user;
  if ($user->uid == $uid || user_access('administer checked out documents') )
  {
    $row[] = l(t('release lock'), "$url/$data->nid");}
  else {
    $row[] = 'N/A';
  }
eugenmayer’s picture

Status: Active » Fixed

Well it is just exactly the old code leftover here. I removed the old callback, as i already had written new ones but forgot about the overview page, which i never rewrote yet. I fixed both, the permissions issue and the UI issue, showing operations not permitted.

Thanks for reporting that one, will be included in 2.3

Status: Fixed » Closed (fixed)
Issue tags: -Content locking release unlock

Automatically closed -- issue fixed for 2 weeks with no activity.