当前位置: 首页>>代码示例>>PHP>>正文


PHP kuserPeer::createKuserForPartner方法代码示例

本文整理汇总了PHP中kuserPeer::createKuserForPartner方法的典型用法代码示例。如果您正苦于以下问题:PHP kuserPeer::createKuserForPartner方法的具体用法?PHP kuserPeer::createKuserForPartner怎么用?PHP kuserPeer::createKuserForPartner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kuserPeer的用法示例。


在下文中一共展示了kuserPeer::createKuserForPartner方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setDefaultCriteriaFilter

 public static function setDefaultCriteriaFilter()
 {
     if (self::$s_criteria_filter == null) {
         self::$s_criteria_filter = new criteriaFilter();
     }
     $c = KalturaCriteria::create(CuePointPeer::OM_CLASS);
     $c->addAnd(CuePointPeer::STATUS, CuePointStatus::DELETED, Criteria::NOT_EQUAL);
     if (self::$userContentOnly) {
         $puserId = kCurrentContext::$ks_uid;
         $partnerId = kCurrentContext::$ks_partner_id;
         if ($puserId && $partnerId) {
             $kuser = kuserPeer::getKuserByPartnerAndUid($partnerId, $puserId);
             if (!$kuser) {
                 $kuser = kuserPeer::createKuserForPartner($partnerId, $puserId);
             }
             // Temporarily change user filter to (user==kuser OR cuepoint of type THUMB/CODE). Long term fix will be accomplished
             // by adding a public property on the cuepoint object and checking (user==kuser OR is public)
             //$c->addAnd(CuePointPeer::KUSER_ID, $kuser->getId());
             $criterionUserOrPublic = $c->getNewCriterion(CuePointPeer::KUSER_ID, $kuser->getId());
             $criterionUserOrPublic->addOr($c->getNewCriterion(self::IS_PUBLIC, true, Criteria::EQUAL));
             $criterionUserOrPublic->addTag(KalturaCriterion::TAG_USER_SESSION);
             $criterionUserOrPublic->addOr($c->getNewCriterion(CuePointPeer::TYPE, array(ThumbCuePointPlugin::getCuePointTypeCoreValue(ThumbCuePointType::THUMB), CodeCuePointPlugin::getCuePointTypeCoreValue(CodeCuePointType::CODE), AdCuePointPlugin::getCuePointTypeCoreValue(AdCuePointType::AD)), Criteria::IN));
             $c->addAnd($criterionUserOrPublic);
         }
     }
     self::$s_criteria_filter->setFilter($c);
 }
开发者ID:panigh,项目名称:server,代码行数:27,代码来源:CuePointPeer.php

示例2: setPuserId

 /**
  * @param string $v puser id
  * @param bool $isAdmin
  * @return CuePoint
  */
 public function setPuserId($puserId)
 {
     if (!$this->getPartnerId()) {
         throw new Exception("Partner id must be set in order to load puser [{$puserId}]");
     }
     $kuser = kuserPeer::getKuserByPartnerAndUid($this->getPartnerId(), $puserId, true);
     if (!$kuser) {
         $kuser = kuserPeer::createKuserForPartner($this->getPartnerId(), $puserId);
     }
     $this->setKuserId($kuser->getId());
 }
开发者ID:kubrickfr,项目名称:server,代码行数:16,代码来源:CuePoint.php

示例3: setPuserId

 /**
  * Set the puser id and the kuser id
  * If the kuser doesn't exist it will be created
  * @param string $puserId
  */
 public function setPuserId($puserId)
 {
     if (!$this->getPartnerId()) {
         throw new Exception("Partner id must be set in order to load puser [{$puserId}]");
     }
     $this->puserId = $puserId;
     $kuser = kuserPeer::getKuserByPartnerAndUid($this->getPartnerId(), $puserId, true);
     if (!$kuser) {
         $isAdmin = kCurrentContext::$is_admin_session;
         $kuser = kuserPeer::createKuserForPartner($this->getPartnerId(), $puserId, $isAdmin);
     }
     $this->setKuserId($kuser->getId());
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:18,代码来源:ShortLink.php

示例4: setDefaultCriteriaFilterByKuser

 public static function setDefaultCriteriaFilterByKuser()
 {
     if (self::$s_criteria_filter == null) {
         self::$s_criteria_filter = new criteriaFilter();
     }
     $c = self::$s_criteria_filter->getFilter();
     if (!$c) {
         $c = new Criteria();
     }
     $puserId = kCurrentContext::$ks_uid;
     $partnerId = kCurrentContext::$ks_partner_id;
     if ($puserId && $partnerId) {
         $kuser = kuserPeer::getKuserByPartnerAndUid($partnerId, $puserId);
         if (!$kuser) {
             $kuser = kuserPeer::createKuserForPartner($partnerId, $puserId);
         }
         $c->addAnd(CuePointPeer::KUSER_ID, $kuser->getId());
     }
     self::$s_criteria_filter->setFilter($c);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:20,代码来源:CuePointPeer.php

示例5: addAction

 /**
  * Allows you to add a metadata object and metadata content associated with Kaltura object
  * 
  * @action add
  * @param int $metadataProfileId
  * @param KalturaMetadataObjectType $objectType
  * @param string $objectId
  * @param string $xmlData XML metadata
  * @return KalturaMetadata
  * @throws MetadataErrors::METADATA_PROFILE_NOT_FOUND
  * @throws MetadataErrors::INCOMPATIBLE_METADATA_PROFILE_OBJECT_TYPE
  * @throws MetadataErrors::METADATA_ALREADY_EXISTS
  * @throws MetadataErrors::INVALID_METADATA_DATA
  */
 function addAction($metadataProfileId, $objectType, $objectId, $xmlData)
 {
     $metadataProfile = MetadataProfilePeer::retrieveByPK($metadataProfileId);
     if (!$metadataProfile) {
         throw new KalturaAPIException(MetadataErrors::METADATA_PROFILE_NOT_FOUND, $metadataProfileId);
     }
     if ($metadataProfile->getObjectType() != kPluginableEnumsManager::apiToCore('MetadataObjectType', $objectType)) {
         throw new KalturaAPIException(MetadataErrors::INCOMPATIBLE_METADATA_PROFILE_OBJECT_TYPE, $metadataProfile->getObjectType(), $objectType);
     }
     if ($objectType == KalturaMetadataObjectType::USER) {
         $kuser = kuserPeer::createKuserForPartner($this->getPartnerId(), $objectId);
         if ($kuser) {
             $objectId = $kuser->getId();
         }
     }
     $objectType = kPluginableEnumsManager::apiToCore('MetadataObjectType', $objectType);
     $check = MetadataPeer::retrieveByObject($metadataProfileId, $objectType, $objectId);
     if ($check) {
         throw new KalturaAPIException(MetadataErrors::METADATA_ALREADY_EXISTS, $check->getId());
     }
     // if a metadata xslt is defined on the metadata profile - transform the given metadata
     $xmlDataTransformed = $this->transformMetadata($metadataProfileId, $xmlData);
     if ($xmlDataTransformed) {
         $xmlData = $xmlDataTransformed;
     }
     $errorMessage = '';
     if (!kMetadataManager::validateMetadata($metadataProfileId, $xmlData, $errorMessage)) {
         throw new KalturaAPIException(MetadataErrors::INVALID_METADATA_DATA, $errorMessage);
     }
     $dbMetadata = $this->addMetadata($metadataProfileId, $objectType, $objectId);
     $key = $dbMetadata->getSyncKey(Metadata::FILE_SYNC_METADATA_DATA);
     kFileSyncUtils::file_put_contents($key, $xmlData);
     $this->deleteOldVersions($dbMetadata);
     kEventsManager::raiseEvent(new kObjectDataChangedEvent($dbMetadata));
     $metadata = new KalturaMetadata();
     $metadata->fromObject($dbMetadata, $this->getResponseProfile());
     return $metadata;
 }
开发者ID:DBezemer,项目名称:server,代码行数:52,代码来源:MetadataService.php

示例6: getKuser

 /**
  * Returns Kuser (New kuser will be created if it doesn't exists) 
  *
  * @return kuser
  */
 public function getKuser()
 {
     if (!$this->kuser) {
         // if no ks, puser id will be null
         if ($this->ks) {
             $puserId = $this->ks->user;
         } else {
             $puserId = null;
         }
         $kuser = kuserPeer::createKuserForPartner($this->getPartnerId(), $puserId);
         if ($kuser->getStatus() !== KalturaUserStatus::ACTIVE) {
             throw new KalturaAPIException(KalturaErrors::INVALID_USER_ID);
         }
         $this->kuser = $kuser;
     }
     return $this->kuser;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:22,代码来源:KalturaBaseService.php

示例7: copyEntry

 public static function copyEntry(entry $entry, Partner $toPartner = null, $dontCopyUsers = false)
 {
     KalturaLog::log("copyEntry - Copying entry [" . $entry->getId() . "] to partner [" . $toPartner->getId() . "]");
     $newEntry = $entry->copy();
     $newEntry->setIntId(null);
     if ($toPartner instanceof Partner) {
         $newEntry->setPartnerId($toPartner->getId());
         $newEntry->setSubpId($toPartner->getId() * 100);
         $newEntry->setAccessControlId($toPartner->getDefaultAccessControlId());
         $flavorParamsStr = $entry->getFlavorParamsIds();
         $flavorParams = explode(',', $flavorParamsStr);
         $newFlavorParams = array();
         foreach ($flavorParams as $flavorParamsId) {
             $newFlavorParamsId = kObjectCopyHandler::getMappedId('flavorParams', $flavorParamsId);
             if (is_null($newFlavorParamsId)) {
                 $newFlavorParamsId = $flavorParamsId;
             }
             $newFlavorParams[] = $newFlavorParamsId;
         }
         $newEntry->setFlavorParamsIds(implode(',', $newFlavorParams));
     }
     $newKuser = null;
     if (!$dontCopyUsers) {
         // copy the kuser (if the same puser id exists its kuser will be used)
         kuserPeer::setUseCriteriaFilter(false);
         $kuser = $entry->getKuser();
         $newKuser = kuserPeer::createKuserForPartner($newEntry->getPartnerId(), $kuser->getPuserId());
         $newEntry->setKuserId($newKuser->getId());
         kuserPeer::setUseCriteriaFilter(true);
     }
     // copy the kshow
     kshowPeer::setUseCriteriaFilter(false);
     $kshow = $entry->getKshow();
     if ($kshow) {
         $newKshow = $kshow->copy();
         $newKshow->setIntId(null);
         $newKshow->setPartnerId($toPartner->getId());
         $newKshow->setSubpId($toPartner->getId() * 100);
         if ($newKuser) {
             $newKshow->setProducerId($newKuser->getId());
         }
         $newKshow->save();
         $newEntry->setKshowId($newKshow->getId());
     }
     kshowPeer::setUseCriteriaFilter(true);
     // reset the statistics
     myEntryUtils::resetEntryStatistics($newEntry);
     // set the new partner id into the default category criteria filter
     $defaultCategoryFilter = categoryPeer::getCriteriaFilter()->getFilter();
     $oldPartnerId = $defaultCategoryFilter->get(categoryPeer::PARTNER_ID);
     $defaultCategoryFilter->remove(categoryPeer::PARTNER_ID);
     $defaultCategoryFilter->addAnd(categoryPeer::PARTNER_ID, $newEntry->getPartnerId());
     // save the entry
     $newEntry->save();
     // restore the original partner id in the default category criteria filter
     $defaultCategoryFilter->remove(categoryPeer::PARTNER_ID);
     $defaultCategoryFilter->addAnd(categoryPeer::PARTNER_ID, $oldPartnerId);
     KalturaLog::log("copyEntry - New entry [" . $newEntry->getId() . "] was created");
     // for any type that does not require assets:
     $shouldCopyDataForNonClip = $entry->getType() != entryType::MEDIA_CLIP;
     $shouldCopyDataForClip = false;
     // only images get their data copied
     if ($entry->getType() == entryType::MEDIA_CLIP) {
         if ($entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_VIDEO && $entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_AUDIO) {
             $shouldCopyDataForClip = true;
         }
     }
     if ($shouldCopyDataForNonClip || $shouldCopyDataForClip) {
         // copy the data
         $from = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
         // replaced__getDataPath
         $to = $newEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
         // replaced__getDataPath
         KalturaLog::log("copyEntriesByType - copying entry data [" . $from . "] to [" . $to . "]");
         kFileSyncUtils::softCopy($from, $to);
     }
     $ismFrom = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
     if (kFileSyncUtils::fileSync_exists($ismFrom)) {
         $ismTo = $newEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISM);
         KalturaLog::log("copying entry ism [" . $ismFrom . "] to [" . $ismTo . "]");
         kFileSyncUtils::softCopy($ismFrom, $ismTo);
     }
     $ismcFrom = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISMC);
     if (kFileSyncUtils::fileSync_exists($ismcFrom)) {
         $ismcTo = $newEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_ISMC);
         KalturaLog::log("copying entry ism [" . $ismcFrom . "] to [" . $ismcTo . "]");
         kFileSyncUtils::softCopy($ismcFrom, $ismcTo);
     }
     $from = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
     // replaced__getThumbnailPath
     $considerCopyThumb = true;
     // if entry is image - data is thumbnail, and it was copied
     if ($entry->getMediaType() == entry::ENTRY_MEDIA_TYPE_IMAGE) {
         $considerCopyThumb = false;
     }
     // if entry is not clip, and there is no file in both DCs - nothing to copy
     if ($entry->getType() != entryType::MEDIA_CLIP && !kFileSyncUtils::file_exists($from, true)) {
         $considerCopyThumb = false;
     }
     if ($considerCopyThumb) {
//.........这里部分代码省略.........
开发者ID:richhl,项目名称:kalturaCE,代码行数:101,代码来源:myEntryUtils.class.php

示例8: isValid

 public function isValid($partner_id, $puser_id, $type = false)
 {
     if (!$this->valid_string) {
         return self::INVALID_STR;
     }
     if (!$this->matchPartner($partner_id)) {
         return self::INVALID_PARTNER;
     }
     if (!$this->matchUser($puser_id)) {
         return self::INVALID_USER;
     }
     if ($type !== false) {
         // do not check ks type
         if (!$this->type == $type) {
             return self::INVALID_TYPE;
         }
     }
     if ($this->expired()) {
         return self::EXPIRED;
     }
     $allowedIPRestriction = $this->isSetIPRestriction();
     if ($allowedIPRestriction && $allowedIPRestriction != kCurrentContext::$user_ip) {
         KalturaLog::err("ipRestriction: EXCEEDED_RESTRICTED_IP");
         return self::EXCEEDED_RESTRICTED_IP;
     }
     if ($this->original_str && $partner_id != Partner::BATCH_PARTNER_ID && !$this->isWidgetSession() && $this->isKSInvalidated() !== false) {
         $criteria = new Criteria();
         $criteria->add(invalidSessionPeer::KS, $this->getHash());
         $dbKs = invalidSessionPeer::doSelectOne($criteria);
         if ($dbKs) {
             $currentActionLimit = $dbKs->getActionsLimit();
             if (is_null($currentActionLimit)) {
                 return self::LOGOUT;
             } elseif ($currentActionLimit <= 0) {
                 return self::EXCEEDED_ACTIONS_LIMIT;
             }
             $dbKs->setActionsLimit($currentActionLimit - 1);
             $dbKs->save();
         } else {
             $limit = $this->isSetLimitAction();
             if ($limit) {
                 invalidSessionPeer::actionsLimitKs($this, $limit - 1);
             }
         }
     }
     // creates the kuser
     if (PermissionPeer::isValidForPartner(PermissionName::FEATURE_END_USER_REPORTS, $partner_id)) {
         $kuser = kuserPeer::createKuserForPartner($partner_id, $puser_id);
         if (!$puser_id) {
             $kuser->setScreenName('Unknown');
             $kuser->save();
         }
     }
     return self::OK;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:55,代码来源:kSessionUtils.class.php

示例9: validateCategory

 /**
  * validate category fields
  * 1. category that inherit memebers cannot set values to inherited fields.
  * 2. validate the owner id exists as kuser
  * 
  * @param category $sourceObject
  */
 private function validateCategory(category $sourceObject = null)
 {
     if ($this->privacyContext != null && kEntitlementUtils::getEntitlementEnforcement()) {
         throw new KalturaAPIException(KalturaErrors::CANNOT_UPDATE_CATEGORY_PRIVACY_CONTEXT);
     }
     if (!$this->privacyContext && (!$sourceObject || !$sourceObject->getPrivacyContexts())) {
         $isInheritedPrivacyContext = true;
         if ($this->parentId != null) {
             $parentCategory = categoryPeer::retrieveByPK($this->parentId);
             if (!$parentCategory) {
                 throw new KalturaAPIException(KalturaErrors::CATEGORY_NOT_FOUND, $this->parentId);
             }
             if ($parentCategory->getPrivacyContexts() == '') {
                 $isInheritedPrivacyContext = false;
             }
         } else {
             $isInheritedPrivacyContext = false;
         }
         if (!$isInheritedPrivacyContext) {
             if ($this->appearInList != KalturaAppearInListType::PARTNER_ONLY && !$this->isNull('appearInList')) {
                 throw new KalturaAPIException(KalturaErrors::CANNOT_SET_APPEAR_IN_LIST_FIELD_WITH_NO_PRIVACY_CONTEXT);
             }
             if ($this->inheritanceType != KalturaInheritanceType::MANUAL && !$this->isNull('inheritanceType')) {
                 throw new KalturaAPIException(KalturaErrors::CANNOT_SET_INHERITANCE_TYPE_FIELD_WITH_NO_PRIVACY_CONTEXT);
             }
             if ($this->privacy != KalturaPrivacyType::ALL && !$this->isNull('privacy')) {
                 throw new KalturaAPIException(KalturaErrors::CANNOT_SET_PRIVACY_FIELD_WITH_NO_PRIVACY_CONTEXT);
             }
             if (!$this->isNull('owner')) {
                 throw new KalturaAPIException(KalturaErrors::CANNOT_SET_OWNER_FIELD_WITH_NO_PRIVACY_CONTEXT);
             }
             if ($this->userJoinPolicy != KalturaUserJoinPolicyType::NOT_ALLOWED && !$this->isNull('userJoinPolicy')) {
                 throw new KalturaAPIException(KalturaErrors::CANNOT_SET_USER_JOIN_POLICY_FIELD_WITH_NO_PRIVACY_CONTEXT);
             }
             if ($this->contributionPolicy != KalturaContributionPolicyType::ALL && !$this->isNull('contributionPolicy')) {
                 throw new KalturaAPIException(KalturaErrors::CANNOT_SET_CONTIRUBUTION_POLICY_FIELD_WITH_NO_PRIVACY_CONTEXT);
             }
             if ($this->defaultPermissionLevel != KalturaCategoryUserPermissionLevel::MEMBER && !$this->isNull('defaultPermissionLevel')) {
                 throw new KalturaAPIException(KalturaErrors::CANNOT_SET_DEFAULT_PERMISSION_LEVEL_FIELD_WITH_NO_PRIVACY_CONTEXT);
             }
         }
     }
     if ($this->inheritanceType != KalturaInheritanceType::MANUAL && $this->inheritanceType != null || $this->inheritanceType == null && $sourceObject && $sourceObject->getInheritanceType() != KalturaInheritanceType::MANUAL) {
         if ($this->owner != null) {
             if (!$sourceObject) {
                 throw new KalturaAPIException(KalturaErrors::CANNOT_SET_OWNER_WHEN_CATEGORY_INHERIT_MEMBERS);
             } elseif ($this->owner != $sourceObject->getKuserId()) {
                 throw new KalturaAPIException(KalturaErrors::CANNOT_SET_OWNER_WHEN_CATEGORY_INHERIT_MEMBERS);
             }
         }
         if ($this->userJoinPolicy != null) {
             if (!$sourceObject) {
                 throw new KalturaAPIException(KalturaErrors::CANNOT_SET_USER_JOIN_POLICY_WHEN_CATEGORY_INHERIT_MEMBERS);
             } elseif ($this->userJoinPolicy != $sourceObject->getUserJoinPolicy()) {
                 throw new KalturaAPIException(KalturaErrors::CANNOT_SET_USER_JOIN_POLICY_WHEN_CATEGORY_INHERIT_MEMBERS);
             }
         }
         if ($this->defaultPermissionLevel != null) {
             if (!$sourceObject) {
                 throw new KalturaAPIException(KalturaErrors::CANNOT_SET_DEFAULT_PERMISSION_LEVEL_WHEN_CATEGORY_INHERIT_MEMBERS);
             } elseif ($this->defaultPermissionLevel != $sourceObject->getDefaultPermissionLevel()) {
                 throw new KalturaAPIException(KalturaErrors::CANNOT_SET_DEFAULT_PERMISSION_LEVEL_WHEN_CATEGORY_INHERIT_MEMBERS);
             }
         }
     }
     if (!is_null($sourceObject)) {
         $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
         $partner = PartnerPeer::retrieveByPK($partnerId);
         if (!$partner || $partner->getFeaturesStatusByType(IndexObjectType::LOCK_CATEGORY)) {
             throw new KalturaAPIException(KalturaErrors::CATEGORIES_LOCKED);
         }
     }
     if ($this->owner && $this->owner != '' && !$this->owner instanceof KalturaNullField) {
         if (!preg_match(kuser::PUSER_ID_REGEXP, $this->owner)) {
             throw new KalturaAPIException(KalturaErrors::CANNOT_SET_OWNER_FIELD_WITH_USER_ID, $this->owner);
         }
         $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
         kuserPeer::createKuserForPartner($partnerId, $this->owner);
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:87,代码来源:KalturaCategory.php

示例10: validateCategory

 /**
  * validate category fields
  * 1. category that inherit memebers canno set values to inherited fields.
  * 2. validate the owner id exists as kuser
  * 
  * @param category $sourceObject
  */
 private function validateCategory(category $sourceObject = null)
 {
     if ($this->privacyContext != null && kEntitlementUtils::getEntitlementEnforcement()) {
         throw new KalturaAPIException(KalturaErrors::CANNOT_UPDATE_CATEGORY_PRIVACY_CONTEXT);
     }
     if (!$this->privacyContext && (!$sourceObject || !$sourceObject->getPrivacyContexts())) {
         if ($this->appearInList != KalturaAppearInListType::PARTNER_ONLY && $this->appearInList != null || $this->moderation != KalturaNullableBoolean::FALSE_VALUE && $this->moderation != null || $this->inheritanceType != KalturaInheritanceType::MANUAL && $this->inheritanceType != null || $this->privacy != KalturaPrivacyType::ALL && $this->privacy != null || $this->owner != null || $this->userJoinPolicy != KalturaUserJoinPolicyType::NOT_ALLOWED && $this->userJoinPolicy != null || $this->contributionPolicy != KalturaContributionPolicyType::ALL && $this->contributionPolicy != null || $this->defaultPermissionLevel != KalturaCategoryUserPermissionLevel::MEMBER && $this->defaultPermissionLevel !== null) {
             if ($this->parentId != null) {
                 $parentCategory = categoryPeer::retrieveByPK($this->parentId);
                 if (!$parentCategory) {
                     throw new KalturaAPIException(KalturaErrors::CATEGORY_NOT_FOUND, $this->parentId);
                 }
                 if ($parentCategory->getPrivacyContexts() == '') {
                     throw new KalturaAPIException(KalturaErrors::CANNOT_UPDATE_CATEGORY_ENTITLEMENT_FIELDS_WITH_NO_PRIVACY_CONTEXT);
                 }
             } else {
                 throw new KalturaAPIException(KalturaErrors::CANNOT_UPDATE_CATEGORY_ENTITLEMENT_FIELDS_WITH_NO_PRIVACY_CONTEXT);
             }
         }
     }
     if ($this->inheritanceType != KalturaInheritanceType::MANUAL && $this->inheritanceType != null || $this->inheritanceType == null && $sourceObject && $sourceObject->getInheritanceType() != KalturaInheritanceType::MANUAL) {
         if (!$sourceObject && $this->owner != null || $sourceObject && $this->owner != null && $this->owner != $sourceObject->getKuserId() || !$sourceObject && $this->userJoinPolicy != null || $sourceObject && $this->userJoinPolicy != null && $this->userJoinPolicy != $sourceObject->getUserJoinPolicy() || !$sourceObject && $this->defaultPermissionLevel != null || $sourceObject && $this->defaultPermissionLevel != null && $this->defaultPermissionLevel != $sourceObject->getDefaultPermissionLevel()) {
             throw new KalturaAPIException(KalturaErrors::CATEGORY_INHERIT_MEMBERS_CANNOT_UPDATE_INHERITED_ATTRIBUTES);
         }
     }
     if (!is_null($sourceObject)) {
         $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
         $partner = PartnerPeer::retrieveByPK($partnerId);
         if (!$partner || $partner->getFeaturesStatusByType(IndexObjectType::LOCK_CATEGORY)) {
             throw new KalturaAPIException(KalturaErrors::CATEGORIES_LOCKED);
         }
     }
     if ($this->owner && $this->owner != '' && !$this->owner instanceof KalturaNullField) {
         if (!preg_match(kuser::PUSER_ID_REGEXP, $this->owner)) {
             throw new KalturaAPIException(KalturaErrors::INVALID_FIELD_VALUE, 'owner');
         }
         $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
         kuserPeer::createKuserForPartner($partnerId, $this->owner);
     }
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:47,代码来源:KalturaCategory.php

示例11: setPuserId

 public function setPuserId($v)
 {
     $this->puserId = $v;
     kuserPeer::setUseCriteriaFilter(false);
     $kuser = kuserPeer::getKuserByPartnerAndUid($this->getPartnerId(), $this->puserId, true);
     kuserPeer::setUseCriteriaFilter(true);
     if (!$kuser) {
         // Associate new kuser for the specified partner
         $kuser = kuserPeer::createKuserForPartner($this->getPartnerId(), $v);
     }
     if ($kuser) {
         return $this->setKuserId($kuser->getId());
     }
 }
开发者ID:AdiTal,项目名称:server,代码行数:14,代码来源:AuditTrail.php

示例12: isValid

 public function isValid($partner_id, $puser_id, $type = false)
 {
     if (!$this->valid_string) {
         return self::INVALID_STR;
     }
     if (!$this->matchPartner($partner_id)) {
         return self::INVALID_PARTNER;
     }
     if (!$this->matchUser($puser_id)) {
         return self::INVALID_USER;
     }
     if ($type !== false) {
         // do not check ks type
         if (!$this->type == $type) {
             return self::INVALID_TYPE;
         }
     }
     if ($this->expired()) {
         return self::EXPIRED;
     }
     if (!$this->isUserIPAllowed()) {
         return self::EXCEEDED_RESTRICTED_IP;
     }
     if ($this->original_str && $partner_id != Partner::BATCH_PARTNER_ID && !$this->isWidgetSession() && $this->isKSInvalidated() !== false) {
         $criteria = new Criteria();
         $ksCriterion = $criteria->getNewCriterion(invalidSessionPeer::TYPE, invalidSession::INVALID_SESSION_TYPE_KS);
         $ksCriterion->addAnd($criteria->getNewCriterion(invalidSessionPeer::KS, $this->getHash()));
         $sessionId = $this->getSessionIdHash();
         if ($sessionId) {
             $invalidSession = $criteria->getNewCriterion(invalidSessionPeer::KS, $sessionId);
             $invalidSession->addAnd($criteria->getNewCriterion(invalidSessionPeer::TYPE, invalidSession::INVALID_SESSION_TYPE_SESSION_ID));
             $ksCriterion->addOr($invalidSession);
         }
         $criteria->add($ksCriterion);
         $dbKs = invalidSessionPeer::doSelectOne($criteria);
         if ($dbKs) {
             $currentActionLimit = $dbKs->getActionsLimit();
             if (is_null($currentActionLimit)) {
                 return self::LOGOUT;
             } elseif ($currentActionLimit <= 0) {
                 return self::EXCEEDED_ACTIONS_LIMIT;
             }
             $dbKs->setActionsLimit($currentActionLimit - 1);
             $dbKs->save();
         } else {
             $limit = $this->isSetLimitAction();
             if ($limit) {
                 invalidSessionPeer::actionsLimitKs($this, $limit - 1);
             }
         }
     }
     // creates the kuser
     if ($partner_id != Partner::BATCH_PARTNER_ID && PermissionPeer::isValidForPartner(PermissionName::FEATURE_END_USER_REPORTS, $partner_id)) {
         $this->kuser = kuserPeer::createKuserForPartner($partner_id, $puser_id);
         if (!$puser_id && $this->kuser->getScreenName() != 'Unknown') {
             $this->kuser->setScreenName('Unknown');
             $this->kuser->save();
         }
     }
     return self::OK;
 }
开发者ID:AdiTal,项目名称:server,代码行数:61,代码来源:kSessionUtils.class.php

示例13: validateForInsert

 public function validateForInsert($propertiesToSkip = array())
 {
     $category = categoryPeer::retrieveByPK($this->categoryId);
     if (!$category) {
         throw new KalturaAPIException(KalturaErrors::CATEGORY_NOT_FOUND, $this->categoryId);
     }
     if ($category->getInheritanceType() == InheritanceType::INHERIT) {
         throw new KalturaAPIException(KalturaErrors::CATEGORY_INHERIT_MEMBERS, $this->categoryId);
     }
     $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
     $kuser = kuserPeer::getKuserByPartnerAndUid($partnerId, $this->userId);
     if ($kuser) {
         $categoryKuser = categoryKuserPeer::retrieveByCategoryIdAndKuserId($this->categoryId, $kuser->getId());
         if ($categoryKuser) {
             throw new KalturaAPIException(KalturaErrors::CATEGORY_USER_ALREADY_EXISTS);
         }
     }
     $currentKuserCategoryKuser = categoryKuserPeer::retrievePermittedKuserInCategory($this->categoryId, kCurrentContext::getCurrentKsKuserId());
     if ((!$currentKuserCategoryKuser || $currentKuserCategoryKuser->getPermissionLevel() != CategoryKuserPermissionLevel::MANAGER) && $category->getUserJoinPolicy() == UserJoinPolicyType::NOT_ALLOWED && kEntitlementUtils::getEntitlementEnforcement()) {
         throw new KalturaAPIException(KalturaErrors::CATEGORY_USER_JOIN_NOT_ALLOWED, $this->categoryId);
     }
     //if user doesn't exists - create it
     if (!$kuser) {
         if (!preg_match(kuser::PUSER_ID_REGEXP, $this->userId)) {
             throw new KalturaAPIException(KalturaErrors::INVALID_FIELD_VALUE, 'userId');
         }
         kuserPeer::createKuserForPartner($partnerId, $this->userId);
     }
     return parent::validateForInsert($propertiesToSkip);
 }
开发者ID:GElkayam,项目名称:server,代码行数:30,代码来源:KalturaCategoryUser.php

示例14: copyEntry

 public static function copyEntry(entry $entry, Partner $toPartner = null, $dontCopyUsers = false)
 {
     KalturaLog::log("copyEntry - Copying entry [" . $entry->getId() . "] to partner [" . $toPartner->getId() . "]");
     $newEntry = $entry->copy();
     $newEntry->setIntId(null);
     $newEntry->setCategories(null);
     $newEntry->setCategoriesIds(null);
     if ($toPartner instanceof Partner) {
         $newEntry->setPartnerId($toPartner->getId());
         $newEntry->setSubpId($toPartner->getId() * 100);
         $newEntry->setAccessControlId($toPartner->getDefaultAccessControlId());
     }
     $newKuser = null;
     if (!$dontCopyUsers) {
         // copy the kuser (if the same puser id exists its kuser will be used)
         kuserPeer::setUseCriteriaFilter(false);
         $kuser = $entry->getKuser();
         $newKuser = kuserPeer::createKuserForPartner($newEntry->getPartnerId(), $kuser->getPuserId());
         $newEntry->setKuserId($newKuser->getId());
         $newEntry->setCreatorKuserId($newKuser->getId());
         kuserPeer::setUseCriteriaFilter(true);
     }
     // copy the kshow
     kshowPeer::setUseCriteriaFilter(false);
     $kshow = $entry->getKshow();
     if ($kshow) {
         $newKshow = $kshow->copy();
         $newKshow->setIntId(null);
         $newKshow->setPartnerId($toPartner->getId());
         $newKshow->setSubpId($toPartner->getId() * 100);
         if ($newKuser) {
             $newKshow->setProducerId($newKuser->getId());
         }
         $newKshow->save();
         $newEntry->setKshowId($newKshow->getId());
     }
     kshowPeer::setUseCriteriaFilter(true);
     // reset the statistics
     myEntryUtils::resetEntryStatistics($newEntry);
     // set the new partner id into the default category criteria filter
     $defaultCategoryFilter = categoryPeer::getCriteriaFilter()->getFilter();
     $oldPartnerId = $defaultCategoryFilter->get(categoryPeer::PARTNER_ID);
     $defaultCategoryFilter->remove(categoryPeer::PARTNER_ID);
     $defaultCategoryFilter->addAnd(categoryPeer::PARTNER_ID, $newEntry->getPartnerId());
     // save the entry
     $newEntry->save();
     // restore the original partner id in the default category criteria filter
     $defaultCategoryFilter->remove(categoryPeer::PARTNER_ID);
     $defaultCategoryFilter->addAnd(categoryPeer::PARTNER_ID, $oldPartnerId);
     KalturaLog::log("copyEntry - New entry [" . $newEntry->getId() . "] was created");
     // for any type that does not require assets:
     $shouldCopyDataForNonClip = true;
     if ($entry->getType() == entryType::MEDIA_CLIP) {
         $shouldCopyDataForNonClip = false;
     }
     if ($entry->getType() == entryType::PLAYLIST) {
         $shouldCopyDataForNonClip = false;
     }
     $shouldCopyDataForClip = false;
     // only images get their data copied
     if ($entry->getType() == entryType::MEDIA_CLIP) {
         if ($entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_VIDEO && $entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_AUDIO) {
             $shouldCopyDataForClip = true;
         }
     }
     //if entry is a static playlist, link between it and its new child entries
     if ($entry->getType() == entryType::PLAYLIST) {
         switch ($entry->getMediaType()) {
             case entry::ENTRY_MEDIA_TYPE_TEXT:
                 $from = $entry->getDataContent();
                 KalturaLog::debug("Entries to copy from source static playlist: [{$from}]");
                 $fromEntryIds = explode(",", $from);
                 $toEntryIds = array();
                 foreach ($fromEntryIds as $fromEntryId) {
                     $toEntryIds[] = kObjectCopyHandler::getMappedId(entryPeer::OM_CLASS, $fromEntryId);
                 }
                 $newEntry->setDataContent(implode(",", $toEntryIds));
                 break;
             case entry::ENTRY_MEDIA_TYPE_XML:
                 list($totalResults, $fromFiltersList) = myPlaylistUtils::getPlaylistFilterListStruct($entry->getDataContent());
                 $toPlaylistXml = new SimpleXMLElement("<playlist/>");
                 $toPlaylistXml->addChild("total_results", $totalResults);
                 $toFiltersXml = $toPlaylistXml->addChild("filters");
                 foreach ($fromFiltersList as $filterXML) {
                     $entryFilter = new entryFilter();
                     $entryFilter->fillObjectFromXml($filterXML, "_");
                     if (isset($entryFilter->fields["_matchand_categories_ids"])) {
                         $categoriesIds = explode(",", $entryFilter->fields["_matchand_categories_ids"]);
                         $newCategoriesIds = array();
                         foreach ($categoriesIds as $categoryId) {
                             $newCategoriesIds[] = kObjectCopyHandler::getMappedId(categoryPeer::OM_CLASS, $categoryId);
                         }
                         $entryFilter->fields["_matchand_categories_ids"] = implode(",", $newCategoriesIds);
                     }
                     if (isset($entryFilter->fields["_matchor_categories_ids"])) {
                         $categoriesIds = explode(",", $entryFilter->fields["_matchor_categories_ids"]);
                         $newCategoriesIds = array();
                         foreach ($categoriesIds as $categoryId) {
                             $newCategoriesIds[] = kObjectCopyHandler::getMappedId(categoryPeer::OM_CLASS, $categoryId);
                         }
//.........这里部分代码省略.........
开发者ID:kubrickfr,项目名称:server,代码行数:101,代码来源:myEntryUtils.class.php

示例15: checkAndSetValidUserUpdate

 /**
  * Sets the valid user for the entry 
  * Throws an error if the session user is trying to update entry to another user and not using an admin session 
  *
  * @param KalturaBaseEntry $entry
  * @param entry $dbEntry
  */
 protected function checkAndSetValidUserUpdate(KalturaBaseEntry $entry, entry $dbEntry)
 {
     KalturaLog::debug("DB puser id [" . $dbEntry->getPuserId() . "] kuser id [" . $dbEntry->getKuserId() . "]");
     // user id not being changed
     if ($entry->userId === null) {
         KalturaLog::log("entry->userId is null, not changing user");
         return;
     }
     if (!$this->getKs() || !$this->getKs()->isAdmin()) {
         $entryPuserId = $dbEntry->getPuserId();
         // non admin cannot change the owner of an existing entry
         if (strtolower($entry->userId) != strtolower($entryPuserId)) {
             KalturaLog::debug('API entry userId [' . $entry->userId . '], DB entry userId [' . $entryPuserId . '] - change required but KS is not admin');
             throw new KalturaAPIException(KalturaErrors::INVALID_KS, "", ks::INVALID_TYPE, ks::getErrorStr(ks::INVALID_TYPE));
         }
     }
     // need to create kuser if this is an admin changing the owner of the entry to a different user
     $kuser = kuserPeer::createKuserForPartner($dbEntry->getPartnerId(), $entry->userId);
     KalturaLog::debug("Set kuser id [" . $kuser->getId() . "] line [" . __LINE__ . "]");
     $dbEntry->setKuserId($kuser->getId());
 }
开发者ID:DBezemer,项目名称:server,代码行数:28,代码来源:KalturaEntryService.php


注:本文中的kuserPeer::createKuserForPartner方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。