/**
  * delete all sieve data associated with account
  */
 public function delete()
 {
     try {
         $transactionId = Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
         $this->_rulesBackend->deleteByProperty($this->_accountId, 'account_id');
         $this->_vacationBackend->deleteByProperty($this->_accountId, 'account_id');
         Tinebase_TransactionManager::getInstance()->commitTransaction($transactionId);
     } catch (Exception $e) {
         Tinebase_TransactionManager::getInstance()->rollBack();
         throw Exception;
     }
 }
示例#2
0
 /**
  * set grants for custom field
  *
  * @param   string|Tinebase_Model_CustomField_Config $_customfieldId
  * @param   array $_grants list of grants to add
  * @param   string $_accountType
  * @param   int $_accountId
  * @return  void
  */
 public function setGrants($_customfieldId, $_grants = array(), $_accountType = NULL, $_accountId = NULL)
 {
     $cfId = $_customfieldId instanceof Tinebase_Model_CustomField_Config ? $_customfieldId->getId() : $_customfieldId;
     try {
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Setting grants for custom field ' . $cfId . ' -> ' . print_r($_grants, TRUE));
         }
         $transactionId = Tinebase_TransactionManager::getInstance()->startTransaction(Tinebase_Core::getDb());
         $this->_backendACL->deleteByProperty($cfId, 'customfield_id');
         foreach ($_grants as $grant) {
             if (in_array($grant, Tinebase_Model_CustomField_Grant::getAllGrants())) {
                 $newGrant = new Tinebase_Model_CustomField_Grant(array('customfield_id' => $cfId, 'account_type' => $_accountType !== NULL ? $_accountType : Tinebase_Acl_Rights::ACCOUNT_TYPE_ANYONE, 'account_id' => $_accountId !== NULL ? $_accountId : 0, 'account_grant' => $grant));
                 $this->_backendACL->create($newGrant);
             }
         }
         Tinebase_TransactionManager::getInstance()->commitTransaction($transactionId);
         $this->_clearCache();
     } catch (Exception $e) {
         Tinebase_TransactionManager::getInstance()->rollBack();
         throw new Tinebase_Exception_Backend($e->getMessage());
     }
 }
 /**
  * delete all record paths
  *
  * @param $record
  * @return int
  *
  * TODO add acl check?
  */
 public function deletePathsForRecord($record)
 {
     return $this->_backend->deleteByProperty($record->getId(), 'record_id');
 }
 /**
  * removes modlog entries for that application
  *
  * @param Tinebase_Model_Application $applicationName
  *
  * @return void
  */
 public function removeApplication(Tinebase_Model_Application $_application)
 {
     $this->_backend->deleteByProperty($_application->getId(), 'application_id');
 }