/**
  * Delete access control profile by id
  * 
  * @action delete
  * @param int $id
  * 
  * @throws KalturaErrors::ACCESS_CONTROL_ID_NOT_FOUND
  * @throws KalturaErrors::CANNOT_DELETE_DEFAULT_ACCESS_CONTROL
  */
 function deleteAction($id)
 {
     $dbAccessControl = accessControlPeer::retrieveByPK($id);
     if (!$dbAccessControl) {
         throw new KalturaAPIException(KalturaErrors::ACCESS_CONTROL_ID_NOT_FOUND, $id);
     }
     if ($dbAccessControl->getIsDefault()) {
         throw new KalturaAPIException(KalturaErrors::CANNOT_DELETE_DEFAULT_ACCESS_CONTROL);
     }
     $c = new Criteria();
     $c->add(entryPeer::ACCESS_CONTROL_ID, $dbAccessControl->getId());
     // move entries to the default access control
     $entryCount = entryPeer::doCount($c);
     if ($entryCount > 0) {
         entryPeer::updateAccessControl($this->getPartnerId(), $id, $this->getPartner()->getDefaultAccessControlId());
     }
     $dbAccessControl->setDeletedAt(time());
     $dbAccessControl->save();
 }
예제 #2
0
 public function validateObjectsExist(entry $sourceObject = null)
 {
     $this->validateConversionProfile($sourceObject);
     if (!is_null($this->accessControlId)) {
         $accessControlProfile = accessControlPeer::retrieveByPK($this->accessControlId);
         if (!$accessControlProfile) {
             throw new KalturaAPIException(KalturaErrors::ACCESS_CONTROL_ID_NOT_FOUND, $this->accessControlId);
         }
     }
 }
예제 #3
0
 /**
  * Throws an error if trying to set invalid Access Control Profile
  * 
  * @param KalturaBaseEntry $entry
  */
 protected function validateAccessControlId(KalturaBaseEntry $entry)
 {
     if ($entry->accessControlId !== null) {
         $this->applyPartnerFilterForClass('accessControl');
         $accessControl = accessControlPeer::retrieveByPK($entry->accessControlId);
         if (!$accessControl) {
             throw new KalturaAPIException(KalturaErrors::ACCESS_CONTROL_ID_NOT_FOUND, $entry->accessControlId);
         }
     }
 }
예제 #4
0
파일: entry.php 프로젝트: wzur/server
 public function getaccessControl(PropelPDO $con = null)
 {
     if (!$this->getParentEntryId()) {
         return accessControlPeer::retrieveByPK($this->access_control_id, $con);
     }
     $parentEntry = $this->getParentEntry();
     if ($parentEntry) {
         return $parentEntry->getaccessControl($con);
     }
     return null;
 }
예제 #5
0
파일: Partner.php 프로젝트: panigh/server
 /**
  * @return AccessControl
  */
 public function getApiAccessControl()
 {
     $id = $this->getApiAccessControlId();
     if ($id) {
         return accessControlPeer::retrieveByPK($id);
     } else {
         return null;
     }
 }
예제 #6
0
 /**
  * Delete Access Control Profile by id
  * 
  * @action delete
  * @param int $id
  */
 function deleteAction($id)
 {
     $dbAccessControl = accessControlPeer::retrieveByPK($id);
     if (!$dbAccessControl) {
         throw new KalturaAPIException(KalturaErrors::ACCESS_CONTROL_ID_NOT_FOUND, $id);
     }
     if ($dbAccessControl->getIsDefault()) {
         throw new KalturaAPIException(KalturaErrors::CANNOT_DELETE_DEFAULT_ACCESS_CONTROL);
     }
     $dbAccessControl->setDeletedAt(time());
     try {
         $dbAccessControl->save();
     } catch (kCoreException $e) {
         $code = $e->getCode();
         switch ($code) {
             case kCoreException::EXCEEDED_MAX_ENTRIES_PER_ACCESS_CONTROL_UPDATE_LIMIT:
                 throw new KalturaAPIException(KalturaErrors::EXCEEDED_ENTRIES_PER_ACCESS_CONTROL_FOR_UPDATE, $id);
             case kCoreException::NO_DEFAULT_ACCESS_CONTROL:
                 throw new KalturaAPIException(KalturaErrors::CANNOT_TRANSFER_ENTRIES_TO_ANOTHER_ACCESS_CONTROL_OBJECT);
             default:
                 throw $e;
         }
     }
 }