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


PHP PermissionPeer::setUseCriteriaFilter方法代码示例

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


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

示例1: addPermissionToPartner

function addPermissionToPartner($permissionCfg, $partnerId = null)
{
    // init new db permission object
    if (is_null($partnerId)) {
        $partnerId = $permissionCfg->partnerId;
    }
    PermissionPeer::setUseCriteriaFilter(false);
    $permission = PermissionPeer::getByNameAndPartner($permissionCfg->name, $partnerId);
    PermissionPeer::setUseCriteriaFilter(true);
    if (!$permission) {
        $permission = new Permission();
    }
    foreach ($permissionCfg as $key => $value) {
        if ($key == 'partnerPackages') {
            continue;
        }
        $setterCallback = array($permission, "set{$key}");
        call_user_func_array($setterCallback, array($value));
    }
    if (!$permission->getFriendlyName()) {
        $permission->setFriendlyName($permission->getName());
    }
    if ($partnerId != null) {
        $permission->setPartnerId($partnerId);
    }
    $permission->setStatus(PermissionStatus::ACTIVE);
    // add to database
    KalturaLog::log('Adding new permission with name [' . $permission->getName() . '] to partner id [' . $permission->getPartnerId() . ']');
    try {
        if ($permission->getId()) {
            $permission->save();
        } else {
            PermissionPeer::addToPartner($permission, $permission->getPartnerId());
        }
    } catch (kPermissionException $e) {
        if ($e->getCode() === kPermissionException::PERMISSION_ALREADY_EXISTS) {
            KalturaLog::log('Permission name [' . $permission->getName() . '] already exists for partner id [' . $permission->getPartnerId() . ']');
        } else {
            throw $e;
        }
    }
}
开发者ID:DBezemer,项目名称:server,代码行数:42,代码来源:addPermissionsAndItems.php

示例2: tearDown

 /**
  * Cleans up the environment after running a test.
  */
 protected function tearDown()
 {
     UserRolePeer::clearInstancePool();
     PermissionPeer::clearInstancePool();
     PermissionItemPeer::clearInstancePool();
     kuserPeer::clearInstancePool();
     PartnerPeer::clearInstancePool();
     $this->client = null;
     PermissionPeer::setUseCriteriaFilter(false);
     foreach ($this->addedPermissionIds as $id) {
         try {
             $obj = PermissionPeer::retrieveByPK($id);
             if ($obj) {
                 $obj->delete();
             }
         } catch (PropelException $e) {
         }
     }
     PermissionPeer::setUseCriteriaFilter(true);
     $this->addedPermissionIds = array();
     parent::tearDown();
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:25,代码来源:PermissionServiceUnitTest.php

示例3: postInsert

 /**
  * Code to be run after inserting to database
  * @param PropelPDO $con 
  */
 public function postInsert(PropelPDO $con = null)
 {
     PermissionPeer::setUseCriteriaFilter(false);
     $this->reload();
     PermissionPeer::setUseCriteriaFilter(true);
     kEventsManager::raiseEvent(new kObjectCreatedEvent($this));
     if ($this->copiedFrom) {
         kEventsManager::raiseEvent(new kObjectCopiedEvent($this->copiedFrom, $this));
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:14,代码来源:BasePermission.php

示例4: copyPermissions

 public static function copyPermissions(Partner $fromPartner, Partner $toPartner)
 {
     KalturaLog::log('Copying permissions from partner [' . $fromPartner->getId() . '] to partner [' . $toPartner->getId() . ']');
     PermissionPeer::setUseCriteriaFilter(false);
     $c = new Criteria();
     $c->addAnd(PermissionPeer::PARTNER_ID, $fromPartner->getId(), Criteria::EQUAL);
     $c->addDescendingOrderByColumn(PermissionPeer::CREATED_AT);
     $permissions = PermissionPeer::doSelect($c);
     PermissionPeer::setUseCriteriaFilter(true);
     foreach ($permissions as $permission) {
         $newPermission = $permission->copyToPartner($toPartner->getId());
         $newPermission->save();
     }
 }
开发者ID:dozernz,项目名称:server,代码行数:14,代码来源:myPartnerUtils.class.php

示例5: filterDependenciesByNames

 public static function filterDependenciesByNames($permissionNames, $partnerId)
 {
     $c = new Criteria();
     $c->addAnd(PermissionPeer::NAME, explode(',', $permissionNames), Criteria::IN);
     $c->addAnd(PermissionPeer::PARTNER_ID, array(strval($partnerId), strval(PartnerPeer::GLOBAL_PARTNER)), Criteria::IN);
     PermissionPeer::setUseCriteriaFilter(false);
     $permissionObjects = PermissionPeer::doSelect($c);
     PermissionPeer::setUseCriteriaFilter(true);
     $permissionObjects = PermissionPeer::filterDependencies($permissionObjects, $partnerId);
     $permissionNames = array();
     foreach ($permissionObjects as $object) {
         $permissionNames[] = $object->getName();
     }
     $permissionNames = implode(',', $permissionNames);
     return $permissionNames;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:16,代码来源:PermissionPeer.php

示例6: reload

 /**
  * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
  *
  * This will only work if the object has been saved and has a valid primary key set.
  *
  * @param      boolean $deep (optional) Whether to also de-associated any related objects.
  * @param      PropelPDO $con (optional) The PropelPDO connection to use.
  * @return     void
  * @throws     PropelException - if this object is deleted, unsaved or doesn't have pk match in db
  */
 public function reload($deep = false, PropelPDO $con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("Cannot reload a deleted object.");
     }
     if ($this->isNew()) {
         throw new PropelException("Cannot reload an unsaved object.");
     }
     if ($con === null) {
         $con = Propel::getConnection(PermissionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     // We don't need to alter the object instance pool; we're just modifying this instance
     // already in the pool.
     PermissionPeer::setUseCriteriaFilter(false);
     $stmt = PermissionPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
     PermissionPeer::setUseCriteriaFilter(true);
     $row = $stmt->fetch(PDO::FETCH_NUM);
     $stmt->closeCursor();
     if (!$row) {
         throw new PropelException('Cannot find matching row in the database to reload object values.');
     }
     $this->hydrate($row, 0, true);
     // rehydrate
     if ($deep) {
         // also de-associate any related objects?
         $this->collPermissionToPermissionItems = null;
         $this->lastPermissionToPermissionItemCriteria = null;
     }
     // if (deep)
 }
开发者ID:DBezemer,项目名称:server,代码行数:40,代码来源:BasePermission.php

示例7: sleep

    $c->setOffset($offset);
    PermissionPeer::clearInstancePool();
    $permissions = PermissionPeer::doSelect($c, $con);
    $offset += $countLimitEachLoop;
    sleep(1);
}
$c = new Criteria();
$c->add(UserRolePeer::PERMISSION_NAMES, "%dropFolder.CONTENT_INGEST_DROP_FOLDER_MATCH%", Criteria::LIKE);
$c->setLimit($countLimitEachLoop);
$userRoles = UserRolePeer::doSelect($c, $con);
while (count($userRoles)) {
    foreach ($userRoles as $userRole) {
        $partnerId = $userRole->getPartnerId();
        PermissionPeer::setUseCriteriaFilter(false);
        $permission = PermissionPeer::getByNameAndPartner('CONTENT_INGEST_DROP_FOLDER_MATCH', array($partnerId));
        PermissionPeer::setUseCriteriaFilter(true);
        if (!$permission) {
            $permission = new Permission();
            $permission->setName('CONTENT_INGEST_DROP_FOLDER_MATCH');
            $permission->setDependsOnPermissionNames('DROPFOLDER_PLUGIN_PERMISSION');
            $permission->setType(PermissionType::SPECIAL_FEATURE);
            $permission->setPartnerId($partnerId);
            $permission->setStatus(PermissionStatus::ACTIVE);
            // add to database
            KalturaLog::log('Adding new permission with name [' . $permission->getName() . '] to partner id [' . $permission->getPartnerId() . ']');
            PermissionPeer::addToPartner($permission, $permission->getPartnerId());
        }
    }
    $c->setOffset($offset);
    UserRolePeer::clearInstancePool();
    $userRoles = UserRolePeer::doSelect($c, $con);
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:31,代码来源:2012_01_03_drop_folder.php


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