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


PHP Partner::getUserSessionRoleId方法代码示例

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


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

示例1: initRoleIds

 private static function initRoleIds()
 {
     $roleIds = null;
     if (!self::$operatingPartner || !self::$ksString) {
         // no partner or session -> no role
         $roleIds = null;
     } else {
         // if user is defined -> get his role IDs
         if (self::$kuser) {
             $roleIds = self::$kuser->getRoleIds();
         }
         // if user has no defined roles or no user is defined -> get default role IDs according to session type (admin/not)
         if (!$roleIds) {
             if (self::$adminSession) {
                 // there is only one partner admin role defined in the system
                 $roleIds = self::$operatingPartner->getAdminSessionRoleId();
             } else {
                 // a partner may have special defined user session roles - get them from partner object
                 $roleIds = self::$operatingPartner->getUserSessionRoleId();
             }
         }
         if ($roleIds) {
             $roleIds = explode(',', trim($roleIds, ','));
         }
     }
     self::$roleIds = $roleIds;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:27,代码来源:kPermissionManager.php

示例2: initRoleIds

 private static function initRoleIds()
 {
     $roleIds = null;
     if (!self::$operatingPartner || !self::$ksString) {
         // no partner or session -> no role
         $roleIds = null;
     } else {
         $ks = ks::fromSecureString(self::$ksString);
         $ksSetRoleId = $ks->getSetRole();
         if ($ksSetRoleId) {
             //check if role exists
             $c = new Criteria();
             $c->addAnd(is_numeric($ksSetRoleId) ? UserRolePeer::ID : UserRolePeer::SYSTEM_NAME, $ksSetRoleId, Criteria::EQUAL);
             $c->addAnd(UserRolePeer::PARTNER_ID, array(self::$ksPartnerId, PartnerPeer::GLOBAL_PARTNER), Criteria::IN);
             $roleId = UserRolePeer::doSelectOne($c);
             if ($roleId) {
                 $roleIds = $roleId->getId();
             } else {
                 KalturaLog::debug("Role id [{$ksSetRoleId}] does not exists");
                 throw new KalturaAPIException(APIErrors::UNKNOWN_ROLE_ID, $ksSetRoleId);
             }
         }
         // if user is defined -> get his role IDs
         if (!$roleIds && self::$kuser) {
             $roleIds = self::$kuser->getRoleIds();
         }
         // if user has no defined roles or no user is defined -> get default role IDs according to session type (admin/not)
         if (!$roleIds) {
             if ($ks->isWidgetSession()) {
                 //there is only one partner widget role defined in the system
                 $roleIds = self::$operatingPartner->getWidgetSessionRoleId();
             } elseif (self::$adminSession) {
                 // there is only one partner admin role defined in the system
                 $roleIds = self::$operatingPartner->getAdminSessionRoleId();
             } else {
                 // a partner may have special defined user session roles - get them from partner object
                 $roleIds = self::$operatingPartner->getUserSessionRoleId();
             }
         }
         if ($roleIds) {
             $roleIds = explode(',', trim($roleIds, ','));
         }
     }
     self::$roleIds = $roleIds;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:45,代码来源:kPermissionManager.php

示例3: getRoleIds

 public static function getRoleIds(Partner $operatingPartner = null, kuser $kuser = null)
 {
     $roleIds = null;
     $ksString = kCurrentContext::$ks;
     $isAdminSession = !self::isEmpty(kCurrentContext::$is_admin_session) ? kCurrentContext::$is_admin_session : false;
     if (!$ksString || !$operatingPartner && kCurrentContext::$ks_partner_id != Partner::BATCH_PARTNER_ID) {
         $roleId = UserRolePeer::getIdByStrId(UserRoleId::NO_SESSION_ROLE);
         if ($roleId) {
             return array($roleId);
         }
         return null;
     }
     $ks = ks::fromSecureString($ksString);
     $ksSetRoleId = $ks->getSetRole();
     if ($ksSetRoleId) {
         if ($ksSetRoleId == 'null') {
             return null;
         }
         $ksPartnerId = !self::isEmpty(kCurrentContext::$ks_partner_id) ? kCurrentContext::$ks_partner_id : null;
         //check if role exists
         $c = new Criteria();
         $c->addAnd(is_numeric($ksSetRoleId) ? UserRolePeer::ID : UserRolePeer::SYSTEM_NAME, $ksSetRoleId, Criteria::EQUAL);
         $partnerIds = array_map('strval', array($ksPartnerId, PartnerPeer::GLOBAL_PARTNER));
         $c->addAnd(UserRolePeer::PARTNER_ID, $partnerIds, Criteria::IN);
         $roleId = UserRolePeer::doSelectOne($c);
         if ($roleId) {
             $roleIds = $roleId->getId();
         } else {
             KalturaLog::debug("Role id [{$ksSetRoleId}] does not exists");
             throw new kCoreException("Unknown role Id [{$ksSetRoleId}]", kCoreException::ID_NOT_FOUND);
         }
     }
     // if user is defined -> get his role IDs
     if (!$roleIds && $kuser) {
         $roleIds = $kuser->getRoleIds();
     }
     // if user has no defined roles or no user is defined -> get default role IDs according to session type (admin/not)
     if (!$roleIds) {
         if (!$operatingPartner) {
             // use system default roles
             if ($ks->isWidgetSession()) {
                 $strId = UserRoleId::WIDGET_SESSION_ROLE;
             } elseif ($isAdminSession) {
                 $strId = UserRoleId::PARTNER_ADMIN_ROLE;
             } else {
                 $strId = UserRoleId::BASE_USER_SESSION_ROLE;
             }
             $roleIds = UserRolePeer::getIdByStrId($strId);
         } else {
             if ($ks->isWidgetSession()) {
                 //there is only one partner widget role defined in the system
                 $roleIds = $operatingPartner->getWidgetSessionRoleId();
             } elseif ($isAdminSession) {
                 // there is only one partner admin role defined in the system
                 $roleIds = $operatingPartner->getAdminSessionRoleId();
             } else {
                 // a partner may have special defined user session roles - get them from partner object
                 $roleIds = $operatingPartner->getUserSessionRoleId();
             }
         }
     }
     if ($roleIds) {
         $roleIds = explode(',', trim($roleIds, ','));
     }
     return $roleIds;
 }
开发者ID:kubrickfr,项目名称:server,代码行数:66,代码来源:kPermissionManager.php


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