コード例 #1
1
 /**
  * @action getCsvUrl
  * @param int $id
  * @param int $reportPartnerId
  * @return string
  */
 function getCsvUrlAction($id, $reportPartnerId)
 {
     $dbReport = ReportPeer::retrieveByPK($id);
     if (is_null($dbReport)) {
         throw new KalturaAPIException(KalturaErrors::REPORT_NOT_FOUND, $id);
     }
     $dbPartner = PartnerPeer::retrieveByPK($reportPartnerId);
     if (is_null($dbPartner)) {
         throw new KalturaAPIException(KalturaErrors::INVALID_PARTNER_ID, $reportPartnerId);
     }
     // allow creating urls for reports that are associated with partner 0 and the report owner
     if ($dbReport->getPartnerId() !== 0 && $dbReport->getPartnerId() !== $reportPartnerId) {
         throw new KalturaAPIException(KalturaErrors::REPORT_NOT_PUBLIC, $id);
     }
     $ks = new ks();
     $ks->valid_until = time() + 2 * 365 * 24 * 60 * 60;
     // 2 years
     $ks->type = ks::TYPE_KS;
     $ks->partner_id = $reportPartnerId;
     $ks->master_partner_id = null;
     $ks->partner_pattern = $reportPartnerId;
     $ks->error = 0;
     $ks->rand = microtime(true);
     $ks->user = '';
     $ks->privileges = 'setrole:REPORT_VIEWER_ROLE';
     $ks->additional_data = null;
     $ks_str = $ks->toSecureString();
     $paramsArray = $this->getParametersAction($id);
     $paramsStrArray = array();
     foreach ($paramsArray as $param) {
         $paramsStrArray[] = $param->value . '={' . $param->value . '}';
     }
     $url = "http://" . kConf::get("www_host") . "/api_v3/index.php/service/report/action/getCsvFromStringParams/id/{$id}/ks/" . $ks_str . "/params/" . implode(';', $paramsStrArray);
     return $url;
 }
コード例 #2
0
ファイル: kSessionUtils.class.php プロジェクト: AdiTal/server
 public static function createKSessionNoValidations($partner_id, $puser_id, &$ks_str, $desired_expiry_in_seconds = 86400, $admin = false, $partner_key = "", $privileges = "")
 {
     $ks_max_expiry_in_seconds = myPartnerUtils::getExpiry($partner_id);
     if ($ks_max_expiry_in_seconds && $ks_max_expiry_in_seconds < $desired_expiry_in_seconds) {
         $desired_expiry_in_seconds = $ks_max_expiry_in_seconds;
     }
     $ks = new ks();
     $ks->valid_until = kApiCache::getTime() + $desired_expiry_in_seconds;
     // store in milliseconds to make comparison easier at validation time
     //			$ks->type = $admin ? ks::TYPE_KAS : ks::TYPE_KS;
     if ($admin == false) {
         $ks->type = ks::TYPE_KS;
     } else {
         $ks->type = $admin;
     }
     // if the admin > 1 - use it rather than automatially setting it to be 2
     $ks->partner_id = $partner_id;
     $ks->partner_pattern = $partner_id;
     $ks->error = 0;
     $ks->rand = microtime(true);
     $ks->user = $puser_id;
     $ks->privileges = $privileges;
     $ks_str = $ks->toSecureString();
     return 0;
 }
コード例 #3
0
 public static function createKSessionNoValidations($partner_id, $puser_id, &$ks_str, $desired_expiry_in_seconds = 86400, $admin = false, $partner_key = "", $privileges = "")
 {
     // 2009-10-20 - don't limit the expiry of the ks !
     /*		
     		// TODO - verify the partner allows such sessions (basically allows external widgets)
     		$ks_max_expiry_in_seconds =  myPartnerUtils::getExpiry ( $partner_id );
     
     		if ( $ks_max_expiry_in_seconds < $desired_expiry_in_seconds )
     			$desired_expiry_in_seconds = 	$ks_max_expiry_in_seconds;
     */
     $ks = new ks();
     $ks->valid_until = time() + $desired_expiry_in_seconds;
     // store in milliseconds to make comparison easier at validation time
     //			$ks->type = $admin ? ks::TYPE_KAS : ks::TYPE_KS;
     if ($admin == false) {
         $ks->type = ks::TYPE_KS;
     } else {
         $ks->type = $admin;
     }
     // if the admin > 1 - use it rather than automatially setting it to be 2
     $ks->partner_id = $partner_id;
     $ks->partner_pattern = $partner_id;
     $ks->error = 0;
     $ks->rand = microtime(true);
     $ks->user = $puser_id;
     $ks->privileges = $privileges;
     $ks_str = $ks->toSecureString();
     return 0;
 }
コード例 #4
0
ファイル: kFlowHelper.php プロジェクト: GElkayam/server
 public static function createBulkUploadLogUrl(BatchJob $dbBatchJob)
 {
     $ks = new ks();
     $ks->valid_until = time() + 86400;
     $ks->type = ks::TYPE_KS;
     $ks->partner_id = $dbBatchJob->getPartnerId();
     $ks->master_partner_id = null;
     $ks->partner_pattern = $dbBatchJob->getPartnerId();
     $ks->error = 0;
     $ks->rand = microtime(true);
     $ks->user = '';
     $ks->privileges = 'setrole:BULK_LOG_VIEWER';
     $ks->additional_data = null;
     $ks_str = $ks->toSecureString();
     $logFileUrl = kConf::get("apphome_url") . "/api_v3/service/bulkUpload/action/serveLog/id/{$dbBatchJob->getId()}/ks/" . $ks_str;
     return $logFileUrl;
 }