Fix testData::create() permissions. Separate the cases where a user has edit rights from
when he has the right to unqueue items
This commit is contained in:
committed by
WineHQ
parent
2a58cf59af
commit
c43563eca6
@@ -73,7 +73,7 @@ class testData{
|
||||
$this->sTestedRelease, $this->sInstalls, $this->sRuns,
|
||||
$this->sTestedRating, $this->sComments,
|
||||
$_SESSION['current']->iUserId,
|
||||
$this->canEdit() ? "false" : "true");
|
||||
$this->mustBeQueued() ? "false" : "true");
|
||||
if($hResult)
|
||||
{
|
||||
$this->iTestingId = mysql_insert_id();
|
||||
@@ -470,18 +470,19 @@ class testData{
|
||||
}
|
||||
|
||||
/* retrieve the latest test result for a given version id */
|
||||
function getNewestTestIdFromVersionId($iVersionId)
|
||||
function getNewestTestIdFromVersionId($iVersionId, $bQueued = false)
|
||||
{
|
||||
$sQuery = "SELECT testingId FROM testResults WHERE
|
||||
versionId = '?'
|
||||
AND
|
||||
queued = 'false'
|
||||
queued = '?'
|
||||
ORDER BY testedDate DESC limit 1";
|
||||
$hResult = query_parameters($sQuery, $iVersionId);
|
||||
$hResult = query_parameters($sQuery, $iVersionId, $bQueued ? "true" : "false");
|
||||
if(!$hResult)
|
||||
return 0;
|
||||
|
||||
$oRow = mysql_fetch_object($hResult);
|
||||
|
||||
return $oRow->testingId;
|
||||
}
|
||||
|
||||
@@ -876,6 +877,21 @@ class testData{
|
||||
echo "distributions, please add it in the \n";
|
||||
echo "provided field.</p>\n\n";
|
||||
}
|
||||
|
||||
function mustBeQueued()
|
||||
{
|
||||
if($_SESSION['current']->hasPriv("admin"))
|
||||
return TRUE;
|
||||
else if($this->iVersionId)
|
||||
{
|
||||
$oVersion = new version($this->iVersionId);
|
||||
if($oVersion->canEdit())
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
} else
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user