Ejemplo n.º 1
0
 public static function fromDbArray($arr, KalturaDetachedResponseProfile $responseProfile = null)
 {
     $newArr = new KalturaCategoryUserArray();
     foreach ($arr as $obj) {
         $nObj = new KalturaCategoryUser();
         $nObj->fromObject($obj, $responseProfile);
         $newArr[] = $nObj;
     }
     return $newArr;
 }
 public static function fromDbArray($arr)
 {
     $newArr = new KalturaCategoryUserArray();
     foreach ($arr as $obj) {
         $nObj = new KalturaCategoryUser();
         $nObj->fromObject($obj);
         $newArr[] = $nObj;
     }
     return $newArr;
 }
Ejemplo n.º 3
0
 /**
  * reject CategoryUser
  * 
  * @action deactivate
  * @param int $categoryId
  * @param string $userId
  * @return KalturaCategoryUser
  */
 function deactivateAction($categoryId, $userId)
 {
     $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
     $kuser = kuserPeer::getKuserByPartnerAndUid($partnerId, $userId);
     if (!$kuser) {
         throw new KalturaAPIException(KalturaErrors::INVALID_USER_ID, $userId);
     }
     $dbCategoryKuser = categoryKuserPeer::retrieveByCategoryIdAndKuserId($categoryId, $kuser->getId());
     if (!$dbCategoryKuser) {
         throw new KalturaAPIException(KalturaErrors::INVALID_CATEGORY_USER_ID, $categoryId, $userId);
     }
     $currentKuserCategoryKuser = categoryKuserPeer::retrievePermittedKuserInCategory($dbCategoryKuser->getCategoryId(), kCurrentContext::getCurrentKsKuserId());
     if (kEntitlementUtils::getEntitlementEnforcement() && (!$currentKuserCategoryKuser || $currentKuserCategoryKuser->getPermissionLevel() != CategoryKuserPermissionLevel::MANAGER && kCurrentContext::$ks_uid != $userId)) {
         throw new KalturaAPIException(KalturaErrors::CANNOT_UPDATE_CATEGORY_USER);
     }
     $dbCategoryKuser->setStatus(CategoryKuserStatus::NOT_ACTIVE);
     $dbCategoryKuser->save();
     $categoryUser = new KalturaCategoryUser();
     $categoryUser->fromObject($dbCategoryKuser, $this->getResponseProfile());
     return $categoryUser;
 }
Ejemplo n.º 4
0
 /**
  * Update CategoryUser by id
  * 
  * @param int $categoryId 
  * @param string $userId 
  * @param KalturaCategoryUser $categoryUser 
  * @param bool $override - to override manual changes
  * @return KalturaCategoryUser
  */
 function update($categoryId, $userId, KalturaCategoryUser $categoryUser, $override = false)
 {
     $kparams = array();
     $this->client->addParam($kparams, "categoryId", $categoryId);
     $this->client->addParam($kparams, "userId", $userId);
     $this->client->addParam($kparams, "categoryUser", $categoryUser->toParams());
     $this->client->addParam($kparams, "override", $override);
     $this->client->queueServiceActionCall("categoryuser", "update", $kparams);
     if ($this->client->isMultiRequest()) {
         return $this->client->getMultiRequestResult();
     }
     $resultObject = $this->client->doQueue();
     $this->client->throwExceptionIfError($resultObject);
     $this->client->validateObjectType($resultObject, "KalturaCategoryUser");
     return $resultObject;
 }