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


PHP testproject::getPublicAttr方法代码示例

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


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

示例1: hasRight

 /**
  * check right on effective role for user, using test project and test plan,
  * means that check right on effective role.
  *
  * @return string|null 'yes' or null
  *
  * @internal revisions
  */
 function hasRight(&$db, $roleQuestion, $tprojectID = null, $tplanID = null, $getAccess = false)
 {
     global $g_propRights_global;
     global $g_propRights_product;
     // var_dump($this->tprojectRoles);
     if (!is_null($tplanID)) {
         $testPlanID = $tplanID;
     } else {
         $testPlanID = isset($_SESSION['testplanID']) ? $_SESSION['testplanID'] : 0;
     }
     if (!is_null($tprojectID)) {
         $testprojectID = $tprojectID;
     } else {
         $testprojectID = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0;
     }
     $accessPublic = null;
     if ($getAccess) {
         if ($testprojectID > 0) {
             $mgr = new testproject($db);
             $accessPublic['tproject'] = $mgr->getPublicAttr($testprojectID);
             unset($mgr);
         }
         if ($testPlanID > 0) {
             $mgr = new testplan($db);
             $accessPublic['tplan'] = $mgr->getPublicAttr($testPlanID);
             unset($mgr);
         }
     }
     $userGlobalRights = (array) $this->globalRole->rights;
     $globalRights = array();
     foreach ($userGlobalRights as $right) {
         $globalRights[] = $right->name;
     }
     $allRights = $globalRights;
     $userTestProjectRoles = $this->tprojectRoles;
     $userTestPlanRoles = $this->tplanRoles;
     if (isset($userTestProjectRoles[$testprojectID])) {
         $userTestProjectRights = (array) $userTestProjectRoles[$testprojectID]->rights;
         // Special situation => just one right
         $doMoreAnalysis = true;
         if (count($userTestProjectRights) == 1) {
             $doMoreAnalysis = !is_null($userTestProjectRights[0]->dbID);
         }
         $allRights = null;
         if ($doMoreAnalysis) {
             //echo 'do more';
             $testProjectRights = array();
             foreach ($userTestProjectRights as $right) {
                 $testProjectRights[] = $right->name;
             }
             // subtract global rights
             $testProjectRights = array_diff($testProjectRights, array_keys($g_propRights_global));
             propagateRights($globalRights, $g_propRights_global, $testProjectRights);
             $allRights = $testProjectRights;
         } else {
             return false;
         }
     } else {
         if (!is_null($accessPublic) && $accessPublic['tproject'] == 0) {
             return false;
         }
     }
     if ($testPlanID > 0) {
         if (isset($userTestPlanRoles[$testPlanID])) {
             $userTestPlanRights = (array) $userTestPlanRoles[$testPlanID]->rights;
             $testPlanRights = array();
             foreach ($userTestPlanRights as $right) {
                 $testPlanRights[] = $right->name;
             }
             //subtract test projects rights
             $testPlanRights = array_diff($testPlanRights, array_keys($g_propRights_product));
             propagateRights($allRights, $g_propRights_product, $testPlanRights);
             $allRights = $testPlanRights;
         } else {
             if (!is_null($accessPublic) && $accessPublic['tplan'] == 0) {
                 return false;
             }
         }
     }
     return checkForRights($allRights, $roleQuestion);
 }
开发者ID:mokal,项目名称:DCN_TestLink,代码行数:89,代码来源:tlUser.class.php


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