예제 #1
0
 function check_entity($oEntity)
 {
     if (is_a($oEntity, 'Document')) {
         if ($oEntity->getImmutable()) {
             return PEAR::raiseError(_kt('Document cannot be checked out as it is immutable'));
         }
         // Check that the document isn't already checked out
         if ($oEntity->getIsCheckedOut()) {
             $checkedOutUser = $oEntity->getCheckedOutUserID();
             $sUserId = $_SESSION['userID'];
             if ($checkedOutUser != $sUserId) {
                 $oCheckedOutUser = User::get($checkedOutUser);
                 return PEAR::raiseError($oEntity->getName() . ': ' . _kt('Document has already been checked out by ') . $oCheckedOutUser->getName());
             }
         }
         // Check that the checkout action isn't restricted for the document
         if (!KTWorkflowUtil::actionEnabledForDocument($oEntity, 'ktcore.actions.document.checkout')) {
             return PEAR::raiseError($oEntity->getName() . ': ' . _kt('Checkout is restricted by the workflow state.'));
         }
     } else {
         if (!is_a($oEntity, 'Folder')) {
             return PEAR::raiseError(_kt('Document cannot be checked out'));
         }
     }
     //we need to do an extra folder permission check in case of a shortcut
     if (is_a($oEntity, 'Folder') && $oEntity->isSymbolicLink()) {
         if (!KTPermissionUtil::userHasPermissionOnItem($this->oUser, $this->_sPermission, $oEntity->getLinkedFolder())) {
             return PEAR::raiseError(_kt('You do not have the required permissions'));
         }
     }
     return parent::check_entity($oEntity);
 }
예제 #2
0
 function check_entity($oEntity)
 {
     if (!is_a($oEntity, 'Folder')) {
         return false;
     }
     return parent::check_entity($oEntity);
 }