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


PHP PermissionPeer::enableForPartner方法代码示例

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


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

示例1: postSave

 /**
  * Code to be run after persisting the object
  * @param PropelPDO $con
  */
 public function postSave(PropelPDO $con = null)
 {
     // update plugin permissions in the database
     if (is_array($this->setEnabledPlugins)) {
         foreach ($this->setEnabledPlugins as $pluginName => $enabled) {
             if ($enabled) {
                 PermissionPeer::enablePlugin($pluginName, $this->getId());
             } else {
                 PermissionPeer::disablePlugin($pluginName, $this->getId());
             }
         }
     }
     // update special services permissions in the database
     if (is_array($this->setEnabledServices)) {
         foreach ($this->setEnabledServices as $permissionName => $enabled) {
             if ($enabled) {
                 PermissionPeer::enableForPartner($permissionName, PermissionType::SPECIAL_FEATURE, $this->getId());
             } else {
                 PermissionPeer::disableForPartner($permissionName, $this->getId());
             }
         }
     }
     $this->setEnabledPlugins = array();
     $this->setEnabledServices = array();
     $ksObj = kSessionUtils::crackKs(kCurrentContext::$ks);
     $currentKuser = null;
     if (is_object($ksObj)) {
         $currentKuser = kuserPeer::getKuserByEmail($ksObj->user, -2);
     }
     if ($currentKuser) {
         $allowedPartners = $currentKuser->getAllowedPartners();
         if (isset($allowedPartners) && !empty($allowedPartners)) {
             $partnersArray = array_map('trim', explode(',', $allowedPartners));
             if (!in_array($this->getId(), $partnersArray)) {
                 $currentKuser->setAllowedPartners($allowedPartners . ',' . $this->getId());
             }
         } else {
             $currentKuser->setAllowedPartners($this->getId());
         }
         $currentKuser->save();
     }
 }
开发者ID:panigh,项目名称:server,代码行数:46,代码来源:Partner.php

示例2: save

 public function save(PropelPDO $con = null)
 {
     if ($this->isNew()) {
         $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
         $c = KalturaCriteria::create(categoryPeer::OM_CLASS);
         $c->add(categoryPeer::STATUS, CategoryStatus::DELETED, Criteria::NOT_EQUAL);
         $c->add(categoryPeer::PARTNER_ID, $partnerId, Criteria::EQUAL);
         KalturaCriterion::disableTag(KalturaCriterion::TAG_ENTITLEMENT_CATEGORY);
         $numOfCatsForPartner = categoryPeer::doCount($c);
         KalturaCriterion::restoreTag(KalturaCriterion::TAG_ENTITLEMENT_CATEGORY);
         $chunkedCategoryLoadThreshold = kConf::get('kmc_chunked_category_load_threshold');
         if ($numOfCatsForPartner >= $chunkedCategoryLoadThreshold) {
             PermissionPeer::enableForPartner(PermissionName::DYNAMIC_FLAG_KMC_CHUNKED_CATEGORY_LOAD, PermissionType::SPECIAL_FEATURE);
         }
         if ($this->getParentId() && ($this->getPrivacyContext() == '' || $this->getPrivacyContext() == null)) {
             $parentCategory = $this->getParentCategory();
             $this->setPrivacyContexts($parentCategory->getPrivacyContexts());
         }
     }
     if (!$this->getIsIndex() && ($this->isColumnModified(categoryPeer::NAME) || $this->isColumnModified(categoryPeer::PARENT_ID))) {
         $this->updateFullName();
     }
     if (trim($this->getPrivacyContexts()) == '') {
         $this->setDefaultUnEntitlmenetCategory();
     }
     // set the depth of the parent category + 1
     if (!$this->getIsIndex() && ($this->isNew() || $this->isColumnModified(categoryPeer::PARENT_ID))) {
         $this->reSetDepth();
     }
     if (!$this->isNew() && $this->isColumnModified(categoryPeer::PARENT_ID)) {
         $this->resetFullIds();
     }
     //index + update categoryEntry
     if (!$this->isNew() && ($this->isColumnModified(categoryPeer::FULL_IDS) || $this->isColumnModified(categoryPeer::PARENT_ID))) {
         $this->addIndexCategoryEntryJob($this->getId());
         $this->addIndexCategoryKuserJob($this->getId());
     }
     if (!$this->isNew() && $this->getInheritanceType() !== InheritanceType::INHERIT && $this->isColumnModified(categoryPeer::PRIVACY_CONTEXTS)) {
         if ($this->getPrivacyContexts() == '') {
             $this->addDeleteCategoryKuserJob($this->getId());
         }
     }
     if (!$this->isNew() && $this->isColumnModified(categoryPeer::PRIVACY_CONTEXTS)) {
         $this->addSyncCategoryPrivacyContextJob();
     }
     // save the childs for action category->delete - delete category is not done by async batch.
     foreach ($this->childs_for_save as $child) {
         $child->save();
     }
     $this->childs_for_save = array();
     if ($this->isColumnModified(categoryPeer::DELETED_AT) && $this->getDeletedAt() !== null) {
         // delete all categoryKuser objects for this category
         if ($this->getInheritanceType() == InheritanceType::MANUAL) {
             $this->addDeleteCategoryKuserJob($this->getId());
         }
         if ($this->move_entries_to_parent_category) {
             $this->addMoveEntriesToCategoryJob($this->move_entries_to_parent_category);
         } elseif ($this->move_entries_to_parent_category === 0) {
             $this->addDeleteCategoryEntryJob($this->getId());
         }
     }
     $kuserChanged = false;
     if (!$this->isNew() && $this->isColumnModified(categoryPeer::INHERITANCE_TYPE)) {
         if ($this->inheritance_type == InheritanceType::MANUAL && $this->old_inheritance_type == InheritanceType::INHERIT) {
             if ($this->parent_id) {
                 $categoryToCopyInheritedFields = $this->getInheritParent();
             }
             if ($categoryToCopyInheritedFields) {
                 $this->copyInheritedFields($categoryToCopyInheritedFields);
                 $kuserChanged = true;
             }
             $this->reSetMembersCount();
         } elseif ($this->inheritance_type == InheritanceType::INHERIT && $this->old_inheritance_type == InheritanceType::MANUAL) {
             $this->addDeleteCategoryKuserJob($this->getId(), true);
         }
     }
     if ($this->isColumnModified(categoryPeer::KUSER_ID)) {
         $kuserChanged = true;
     }
     if (!$this->isNew() && $this->isColumnModified(categoryPeer::PRIVACY) && $this->getPrivacy() == PrivacyType::MEMBERS_ONLY) {
         $this->removeNonMemberKusers();
     }
     parent::save($con);
     if ($kuserChanged && $this->inheritance_type != InheritanceType::INHERIT && $this->getKuserId()) {
         $categoryKuser = categoryKuserPeer::retrieveByCategoryIdAndKuserId($this->getId(), $this->getKuserId());
         if (!$categoryKuser) {
             $categoryKuser = new categoryKuser();
             $categoryKuser->setCategoryId($this->getId());
             $categoryKuser->setCategoryFullIds($this->getFullIds());
             $categoryKuser->setKuserId($this->getKuserId());
         }
         $categoryKuser->setPermissionLevel(CategoryKuserPermissionLevel::MANAGER);
         $permissionNamesArr = array();
         if ($categoryKuser->getPermissionNames()) {
             $permissionNamesArr = explode(",", $categoryKuser->getPermissionNames());
         }
         $permissionNamesArr = categoryKuser::removeCategoryPermissions($permissionNamesArr);
         $permissionNamesArr[] = PermissionName::CATEGORY_CONTRIBUTE;
         $permissionNamesArr[] = PermissionName::CATEGORY_EDIT;
         $permissionNamesArr[] = PermissionName::CATEGORY_MODERATE;
//.........这里部分代码省略.........
开发者ID:dozernz,项目名称:server,代码行数:101,代码来源:category.php

示例3: Permission

        // live stream
        $allowedLiveStream = $partner->getFromCustomData("liveEnabled", null, 0);
        if ($allowedLiveStream) {
            $livePermission = new Permission();
            $livePermission->setPartnerId($partner->getId());
            $livePermission->setName(PermissionName::FEATURE_LIVE_STREAM);
            $livePermission->setFriendlyName('Live stream feature');
            $livePermission->setDescription('Permission to use live stream');
            $livePermission->setStatus(PermissionStatus::ACTIVE);
            $livePermission->setType(PermissionType::SPECIAL_FEATURE);
            $newPermissions[] = $livePermission;
        }
        if (!$dryRun) {
            foreach ($newPermissions as $permission) {
                KalturaLog::log('SAVING new permission for partner [' . $partner->getId() . ']:');
                PermissionPeer::enableForPartner($permission->getName(), $permission->getType(), $partner->getId(), $permission->getFriendlyName(), $permission->getDescription());
                KalturaLog::log(print_r($permission, true));
            }
        } else {
            foreach ($newPermissions as $permission) {
                KalturaLog::log('DRY RUN ONLY - new permission for partner [' . $partner->getId() . ']:');
                KalturaLog::log(print_r($permission, true));
                // dry run - no saving!
            }
        }
        file_put_contents($lastPartnerFile, $lastPartner);
    }
    $partners = getPartners($lastPartner, $partnerLimitEachLoop);
}
$msg = 'Done - ' . ($dryRun ? 'DRY RUN!' : 'REAL RUN!');
KalturaLog::log($msg);
开发者ID:richhl,项目名称:kalturaCE,代码行数:31,代码来源:01_set_partner_service_and_plugin_permissions.php

示例4: postInsert

 public function postInsert(PropelPDO $con = null)
 {
     parent::postInsert($con);
     if (!$this->alreadyInSave) {
         kEventsManager::raiseEvent(new kObjectAddedEvent($this));
         $category = $this->getcategory();
         if ($category && $category->getPrivacyContexts() && !PermissionPeer::isValidForPartner(PermissionName::FEATURE_ENTITLEMENT_USED, $category->getPartnerId())) {
             PermissionPeer::enableForPartner(PermissionName::FEATURE_ENTITLEMENT_USED, PermissionType::SPECIAL_FEATURE, $category->getPartnerId());
         }
     }
 }
开发者ID:GElkayam,项目名称:server,代码行数:11,代码来源:categoryKuser.php

示例5: postSave

 /**
  * Code to be run after persisting the object
  * @param PropelPDO $con
  */
 public function postSave(PropelPDO $con = null)
 {
     // update plugin permissions in the database
     if (is_array($this->setEnabledPlugins)) {
         foreach ($this->setEnabledPlugins as $pluginName => $enabled) {
             if ($enabled) {
                 PermissionPeer::enablePlugin($pluginName, $this->getId());
             } else {
                 PermissionPeer::disablePlugin($pluginName, $this->getId());
             }
         }
     }
     // update special services permissions in the database
     if (is_array($this->setEnabledServices)) {
         foreach ($this->setEnabledServices as $permissionName => $enabled) {
             if ($enabled) {
                 PermissionPeer::enableForPartner($permissionName, PermissionType::SPECIAL_FEATURE, $this->getId());
             } else {
                 PermissionPeer::disableForPartner($permissionName, $this->getId());
             }
         }
     }
     $this->setEnabledPlugins = array();
     $this->setEnabledServices = array();
     parent::postSave($con);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:30,代码来源:Partner.php


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