當前位置: 首頁>>代碼示例>>PHP>>正文


PHP testplan::getPublicAttr方法代碼示例

本文整理匯總了PHP中testplan::getPublicAttr方法的典型用法代碼示例。如果您正苦於以下問題:PHP testplan::getPublicAttr方法的具體用法?PHP testplan::getPublicAttr怎麽用?PHP testplan::getPublicAttr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在testplan的用法示例。


在下文中一共展示了testplan::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


注:本文中的testplan::getPublicAttr方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。