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; }
/** * 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; }