Make testData's objectGetEntries more consistent for rejected testData. Don't allow

maintainers to view rejected entries for the versions they maintain, but show them their own
rejected entries instead
This commit is contained in:
Alexander Nicolaysen Sørnes
2007-04-20 00:02:20 +00:00
committed by WineHQ
parent 67f61bbda5
commit a8a4da643b

View File

@@ -267,8 +267,7 @@ class testData{
$sSubject = "Submitted testing data rejected"; $sSubject = "Submitted testing data rejected";
$sMsg = "The testing data you submitted for '$sName' has ". $sMsg = "The testing data you submitted for '$sName' has ".
"been rejected by ".$_SESSION['current']->sRealname."."; "been rejected by ".$_SESSION['current']->sRealname.".";
$sMsg .= APPDB_ROOT."testResults.php?sSub=view&iTestingId=". $sMsg .= $this->objectMakeUrl()."\n";
$this->iTestingId."\n";
$sMsg .= "Reason given:\n"; $sMsg .= "Reason given:\n";
break; break;
case "delete": case "delete":
@@ -696,7 +695,18 @@ class testData{
$sQueued = objectManager::getQueueString($bQueued, $bRejected); $sQueued = objectManager::getQueueString($bQueued, $bRejected);
if($bQueued && !$oTest->canEdit()) if($bQueued && !$oTest->canEdit())
{ {
if($oTest->canEditSome()) if($bRejected)
{
$sQuery = "SELECT COUNT(testingId) AS count FROM
testResults, appVersion WHERE
appVersion.queued = 'false'
AND
appVersion.versionId = testResults.versionId
AND
testResults.submitterId = '?'
AND
testResults.queued = '?'";
} else
{ {
$sQuery = "SELECT COUNT(testingId) AS count FROM $sQuery = "SELECT COUNT(testingId) AS count FROM
testResults, appVersion, appMaintainers WHERE testResults, appVersion, appMaintainers WHERE
@@ -713,9 +723,10 @@ class testData{
) )
AND AND
testResults.queued = '?'"; testResults.queued = '?'";
}
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId, $hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
$sQueued); $sQueued);
}
} else } else
{ {
$sQuery = "SELECT COUNT(testingId) as count FROM testResults, $sQuery = "SELECT COUNT(testingId) as count FROM testResults,
@@ -743,7 +754,17 @@ class testData{
$sQueued = objectManager::getQueueString($bQueued, $bRejected); $sQueued = objectManager::getQueueString($bQueued, $bRejected);
if($bQueued && !$oTest->canEdit()) if($bQueued && !$oTest->canEdit())
{ {
if($oTest->canEditSome()) if($bRejected)
{
$sQuery = "SELECT testResults.* FROM testResults, appVersion WHERE
appVersion.queued = 'false'
AND
appVersion.versionId = testResults.versionId
AND
testResults.submitterId = '?'
AND
testResults.queued = '?'";
} else
{ {
$sQuery = "SELECT testResults.* FROM testResults, appVersion, $sQuery = "SELECT testResults.* FROM testResults, appVersion,
appMaintainers WHERE appMaintainers WHERE
@@ -760,9 +781,9 @@ class testData{
) )
AND AND
testResults.queued = '?'"; testResults.queued = '?'";
}
$hResult = query_parameters($sQuery, $_SESSION['current']->iUserId, $hResult = query_parameters($sQuery, $_SESSION['current']->iUserId,
$sQueued); $sQueued);
}
} else } else
{ {
$sQuery = "SELECT testResults.* FROM testResults, appVersion WHERE $sQuery = "SELECT testResults.* FROM testResults, appVersion WHERE
@@ -810,21 +831,13 @@ class testData{
$this->sTestedRelease, $this->sTestedRelease,
$this->sTestedRating); $this->sTestedRating);
if($this->canEditSome()) if($this->canEdit() or $this->sQueued == "rejected")
$aCells[] = "[ <a href=\"".$oObject->makeUrl("edit", $aCells[] = "[ <a href=\"".$oObject->makeUrl("edit",
$this->iTestingId)."\">$sEditLinkLabel</a> ]"; $this->iTestingId)."\">$sEditLinkLabel</a> ]";
echo html_tr($aCells, $this->sTestedRating); echo html_tr($aCells, $this->sTestedRating);
} }
function canEditSome()
{
if($this->canEdit() || maintainer::isUserMaintainer($_SESSION['current']))
return TRUE;
else
return FALSE;
}
function canEdit() function canEdit()
{ {
if($_SESSION['current']->hasPriv("admin")) if($_SESSION['current']->hasPriv("admin"))