Allow maintainers to submit un-queued distributions.They are allowed to submit un-queued

testData for the versions they maintain, so without this change they submit un-queued test
results associated with a queued distribution. This doesn't make any sense since the
testData would be active but the distribution queued. It's cleaner to just let maintainers
unqueue distributions for versions they maintain.
This commit is contained in:
Alexander Nicolaysen Sørnes
2007-04-27 23:22:37 +00:00
committed by WineHQ
parent 1b6fe53638
commit e87db015c2

View File

@@ -135,9 +135,11 @@ class distribution {
// Delete Distributution. // Delete Distributution.
function delete($bSilent=false) function delete($bSilent=false)
{ {
// is the current user allowed to delete this Distribution? /* Is the current user allowed to delete this distribution? We allow
if(!$_SESSION['current']->hasPriv("admin") && everyone to delete a queued, empty distribution, because it should be
!($_SESSION['current']->iUserId == $this->iSubmitterId)) deleted along with the last testData associated with it */
if(!($this->canEdit() || (!sizeof($this->aTestingIds) &&
$this->sQueued != "false")))
return; return;
/* Check for associated test results */ /* Check for associated test results */
@@ -168,11 +170,9 @@ class distribution {
// Move Distribution out of the queue. // Move Distribution out of the queue.
function unQueue() function unQueue()
{ {
// is the current user allowed to move this Distribution? /* Check permissions */
if(!$_SESSION['current']->hasPriv("admin")) if($this->mustBeQueued())
{ return FALSE;
return false;
}
// If we are not in the queue, we can't move the Distribution out of the queue. // If we are not in the queue, we can't move the Distribution out of the queue.
if(!$this->sQueued == 'true') if(!$this->sQueued == 'true')
@@ -481,12 +481,19 @@ class distribution {
if($_SESSION['current']->hasPriv("admin")) if($_SESSION['current']->hasPriv("admin"))
return TRUE; return TRUE;
/* Maintainers are allowed to process queued test results and therefore also
queued distributions */
if(is_object($this) && $this->sQueued != "false" &&
maintainer::isUserMaintainer($_SESSION['current']))
return TRUE;
return FALSE; return FALSE;
} }
function mustBeQueued() function mustBeQueued()
{ {
if($_SESSION['current']->hasPriv("admin")) if($_SESSION['current']->hasPriv("admin") ||
maintainer::isUserMaintainer($_SESSION['current']))
return FALSE; return FALSE;
else else
return TRUE; return TRUE;