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


PHP PermissionPeer::checkValidPermissionsForRole方法代码示例

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


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

示例1: updateAction

 /**
  * Updates an existing user role object.
  * 
  * @action update
  * @param int $userRoleId The user role's unique identifier
  * @param KalturaUserRole $userRole The user role's unique identifier
  * @return KalturaUserRole The updated user role object
  *
  * @throws KalturaErrors::INVALID_OBJECT_ID
  * @throws KalturaErrors::PERMISSION_NOT_FOUND
  */
 public function updateAction($userRoleId, KalturaUserRole $userRole)
 {
     /* critera is used here instead of retrieveByPk on purpose!
        if the current context is assigned to a partner 0 role, then retrieveByPk will return it from cache even though partner 0 is not in
        the partner group for the current action and context */
     $c = new Criteria();
     $c->addAnd(UserRolePeer::ID, $userRoleId, Criteria::EQUAL);
     if ($this->partnerGroup() != myPartnerUtils::ALL_PARTNERS_WILD_CHAR) {
         $c->addAnd(UserRolePeer::PARTNER_ID, explode(',', $this->partnerGroup()), Criteria::IN);
     }
     $dbUserRole = UserRolePeer::doSelectOne($c);
     if (!$dbUserRole) {
         throw new KalturaAPIException(KalturaErrors::INVALID_OBJECT_ID, $userRoleId);
     }
     // cannot update name to a name that already exists
     if ($userRole->name && $userRole->name != $dbUserRole->getName()) {
         if (UserRolePeer::getByNameAndPartnerId($userRole->name, $this->getPartnerId())) {
             throw new KalturaAPIException(KalturaErrors::ROLE_NAME_ALREADY_EXISTS);
         }
     }
     if (!is_null($userRole->permissionNames) && !$userRole->permissionNames instanceof KalturaNullField) {
         try {
             PermissionPeer::checkValidPermissionsForRole($userRole->permissionNames, $this->getPartnerId());
         } catch (kPermissionException $e) {
             $code = $e->getCode();
             if ($code == kPermissionException::PERMISSION_NOT_FOUND) {
                 throw new KalturaAPIException(KalturaErrors::PERMISSION_NOT_FOUND, $e->getMessage());
             }
         }
     }
     $dbUserRole = $userRole->toUpdatableObject($dbUserRole);
     $dbUserRole->save();
     $userRole = new KalturaUserRole();
     $userRole->fromObject($dbUserRole, $this->getResponseProfile());
     return $userRole;
 }
开发者ID:DBezemer,项目名称:server,代码行数:47,代码来源:UserRoleService.php


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