Esempio n. 1
0
 /**
  * Allows you to add an audit trail object and audit trail content associated with Kaltura object
  * 
  * @action add
  * @param KalturaAuditTrail $auditTrail
  * @return KalturaAuditTrail
  * @throws AuditTrailErrors::AUDIT_TRAIL_DISABLED
  */
 function addAction(KalturaAuditTrail $auditTrail)
 {
     $auditTrail->validatePropertyNotNull("auditObjectType");
     $auditTrail->validatePropertyNotNull("objectId");
     $auditTrail->validatePropertyNotNull("action");
     $auditTrail->validatePropertyMaxLength("description", 1000);
     $dbAuditTrail = $auditTrail->toInsertableObject();
     $dbAuditTrail->setPartnerId($this->getPartnerId());
     $dbAuditTrail->setStatus(AuditTrail::AUDIT_TRAIL_STATUS_READY);
     $dbAuditTrail->setContext(KalturaAuditTrailContext::CLIENT);
     $enabled = kAuditTrailManager::traceEnabled($this->getPartnerId(), $dbAuditTrail);
     if (!$enabled) {
         throw new KalturaAPIException(AuditTrailErrors::AUDIT_TRAIL_DISABLED, $this->getPartnerId(), $dbAuditTrail->getObjectType(), $dbAuditTrail->getAction());
     }
     $created = $dbAuditTrail->save();
     if (!$created) {
         return null;
     }
     $auditTrail = new KalturaAuditTrail();
     $auditTrail->fromObject($dbAuditTrail, $this->getResponseProfile());
     return $auditTrail;
 }
Esempio n. 2
0
 public function save(PropelPDO $con = null)
 {
     if (!kAuditTrailManager::traceEnabled($this->getPartnerId(), $this)) {
         KalturaLog::debug("No audit created object type [{$this->object_type}] action [{$this->action}]");
         return 0;
     }
     if (is_null($this->getKuserId())) {
         $this->setPuserId(kCurrentContext::$uid);
     }
     if (is_null($this->getClientTag())) {
         $this->setClientTag(kCurrentContext::$client_lang);
     }
     $this->setRequestId($this->getUniqueRequestId());
     $this->setMasterPartnerId(kCurrentContext::$master_partner_id);
     $this->setKs(kCurrentContext::$ks);
     $this->setIpAddress(kCurrentContext::$user_ip);
     $this->setServerName(kCurrentContext::$host);
     $this->setEntryPoint(kCurrentContext::getEntryPoint());
     $this->setUserAgent(requestUtils::getRemoteUserAgent());
     return parent::save($con);
 }
Esempio n. 3
0
 public function save(PropelPDO $con = null)
 {
     if (!kAuditTrailManager::traceEnabled($this->getPartnerId(), $this)) {
         return 0;
     }
     if (is_null($this->getKuserId())) {
         $this->setPuserId(kCurrentContext::$uid);
         if (kCurrentContext::$uid == '') {
             $this->setPuserId(kCurrentContext::$ks_uid);
         }
     }
     if (is_null($this->getClientTag())) {
         $this->setClientTag(kCurrentContext::$client_lang);
     }
     $this->setRequestId(new UniqueId());
     $this->setMasterPartnerId(kCurrentContext::$master_partner_id);
     $this->setKs(kCurrentContext::$ks);
     $this->setIpAddress(kCurrentContext::$user_ip);
     $this->setServerName(kCurrentContext::$host);
     $this->setEntryPoint(kCurrentContext::getEntryPoint());
     $this->setUserAgent(requestUtils::getRemoteUserAgent());
     return parent::save($con);
 }