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


PHP PermissionPeer::disableForPartner方法代码示例

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


在下文中一共展示了PermissionPeer::disableForPartner方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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::disableForPartner方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。