本文整理汇总了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);
}