Assigning a User's Draft Versions to a Different User

By means of the following procedure, takeAllEditedVersions, you can assign all draft versions that are being edited by a particular user to a different user.

# Code of the takeAllEditedVersions procedure

proc takeAllEditedVersions {curEditor newEditor} {
  set count 0
  foreach o [obj list] {
    if {[obj withId $o get isEdited] && ([obj withId $o editedContent get editor] eq $curEditor)} {
      sudo $newEditor obj withId $o take
      puts "$o ([obj withId $o]) taken"
      incr count
    }
  }
  puts "$count files taken"
}

Requirements:

The future editor, newEditor needs to have the file-specific permission permissionWrite for all the files to be assigned to him or her. As an alternative, the future user can be a superuser. Because of the sudo command used in the procedure, the user executing it must be a superuser.