Pass a version object into user::hasAppVersionModifyPermission() instead of
the integer that is the index of the version in the database.
This commit is contained in:
@@ -104,13 +104,12 @@ if ($_REQUEST['sub'])
|
||||
else if($_REQUEST['apptype'] == 'version')
|
||||
{
|
||||
/* make sure the user has permission to view this version */
|
||||
if(!$_SESSION['current']->hasAppVersionModifyPermission($_REQUEST['versionId']))
|
||||
$oVersion = new Version($_REQUEST['versionId']);
|
||||
if(!$_SESSION['current']->hasAppVersionModifyPermission($oVersion))
|
||||
{
|
||||
errorpage("Insufficient privileges.");
|
||||
exit;
|
||||
}
|
||||
|
||||
$oVersion = new Version($_REQUEST['versionId']);
|
||||
} else
|
||||
{
|
||||
//error no Id!
|
||||
|
||||
@@ -16,7 +16,8 @@ require_once(BASE."include/distributions.php");
|
||||
if ($_REQUEST['sub'])
|
||||
{
|
||||
$oTest = new testData($_REQUEST['iTestingId']);
|
||||
if (!($_SESSION['current']->hasAppVersionModifyPermission($oTest->iVersionId)))
|
||||
$oVersion = new Version($oTest->iVersionId);
|
||||
if(!($_SESSION['current']->hasAppVersionModifyPermission($oVersion)))
|
||||
{
|
||||
errorpage("Insufficient privileges.");
|
||||
exit;
|
||||
|
||||
@@ -95,7 +95,7 @@ if ($_REQUEST['sub'])
|
||||
$oVersion = new Version($_REQUEST['versionId']);
|
||||
|
||||
// make sure the user has permission to view this version
|
||||
if(!$_SESSION['current']->hasAppVersionModifyPermission($oVersion->versionId) &&
|
||||
if(!$_SESSION['current']->hasAppVersionModifyPermission($oVersion) &&
|
||||
(($oVersion->queued=="false")?true:false) &&
|
||||
!$_SESSION['current']->isVersionSubmitter($oVersion->versionId))
|
||||
{
|
||||
|
||||
@@ -140,7 +140,7 @@ else
|
||||
echo '<td>'.$oTest->sInstalls.' </td>',"\n";
|
||||
echo '<td>'.$oTest->sRuns.' </td>',"\n";
|
||||
echo '<td>'.$oTest->sTestedRating.' </td>',"\n";
|
||||
if ($_SESSION['current']->hasAppVersionModifyPermission($oTest->iVersionId))
|
||||
if ($_SESSION['current']->hasAppVersionModifyPermission($oVersion))
|
||||
{
|
||||
echo '<td><a href="'.BASE.'admin/adminTestResults.php?sub=view&iTestingId='.$oTest->iTestingId.'">',"\n";
|
||||
echo 'Edit</a></td>',"\n";
|
||||
|
||||
@@ -62,8 +62,9 @@ class testData{
|
||||
function create()
|
||||
{
|
||||
// Security, if we are not an administrator or an maintainer the test result must be queued.
|
||||
$oVersion = new Version($oTest->iVersionId);
|
||||
if(!$_SESSION['current']->hasPriv("admin") &&
|
||||
!$_SESSION['current']->hasAppVersionModifyPermission($oTest->iVersionId))
|
||||
!$_SESSION['current']->hasAppVersionModifyPermission($oVersion))
|
||||
$this->sQueued = 'true';
|
||||
else
|
||||
$this->sQueued = 'false';
|
||||
@@ -99,8 +100,9 @@ class testData{
|
||||
function update($bSilent=false)
|
||||
{
|
||||
// is the current user allowed to update this testing result?
|
||||
$oVersion = new Version($this->iVersionId);
|
||||
if(!$_SESSION['current']->hasPriv("admin") &&
|
||||
!$_SESSION['current']->hasAppVersionModifyPermission($this->iVersionId) &&
|
||||
!$_SESSION['current']->hasAppVersionModifyPermission($oVersion) &&
|
||||
!(($_SESSION['current']->iUserId == $this->iSubmitterId) && !($this->sQueued == 'false')))
|
||||
{
|
||||
return;
|
||||
@@ -132,8 +134,9 @@ class testData{
|
||||
function delete($bSilent=false)
|
||||
{
|
||||
// is the current user allowed to delete this testing result?
|
||||
$oVersion = new Version($this->iVersionId);
|
||||
if(!$_SESSION['current']->hasPriv("admin") &&
|
||||
!$_SESSION['current']->hasAppVersionModifyPermission($this->iVersionId) &&
|
||||
!$_SESSION['current']->hasAppVersionModifyPermission($oVersion) &&
|
||||
!(($_SESSION['current']->iUserId == $this->iSubmitterId) && !($this->sQueued == 'false')))
|
||||
{
|
||||
return;
|
||||
@@ -158,7 +161,9 @@ class testData{
|
||||
function unQueue()
|
||||
{
|
||||
// is the current user allowed to delete this testing data?
|
||||
if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->hasAppVersionModifyPermission($this->iVersionId))
|
||||
$oVersion = new Version($this->iVersionId);
|
||||
if(!$_SESSION['current']->hasPriv("admin") &&
|
||||
!$_SESSION['current']->hasAppVersionModifyPermission($oVersion))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -180,7 +185,9 @@ class testData{
|
||||
function Reject()
|
||||
{
|
||||
// is the current user allowed to delete this testing data?
|
||||
if(!$_SESSION['current']->hasPriv("admin") && !$_SESSION['current']->hasAppVersionModifyPermission($this->iVersionId))
|
||||
$oVersion = new Version($this->iVersionId);
|
||||
if(!$_SESSION['current']->hasPriv("admin") &&
|
||||
!$_SESSION['current']->hasAppVersionModifyPermission($oVersion))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -202,8 +209,9 @@ class testData{
|
||||
function ReQueue()
|
||||
{
|
||||
// is the current user allowed to requeue this data
|
||||
$oVersion = new Version($this->iVersionId);
|
||||
if(!$_SESSION['current']->hasPriv("admin") &&
|
||||
!$_SESSION['current']->hasAppVersionModifyPermission($this->iVersionId) &&
|
||||
!$_SESSION['current']->hasAppVersionModifyPermission($oVersion) &&
|
||||
!$_SESSION['current']->iUserId == $this->iSubmitterId)
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -931,7 +931,7 @@ class User {
|
||||
if($this->hasPriv("admin"))
|
||||
return true;
|
||||
|
||||
if($this->hasAppVersionModifyPermission($oVersion->iVersionId))
|
||||
if($this->hasAppVersionModifyPermission($oVersion))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -945,7 +945,7 @@ class User {
|
||||
if($this->hasPriv("admin"))
|
||||
return true;
|
||||
|
||||
if($this->hasAppVersionModifyPermission($oVersion->iVersionId))
|
||||
if($this->hasAppVersionModifyPermission($oVersion))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -959,7 +959,7 @@ class User {
|
||||
if($this->hasPriv("admin"))
|
||||
return true;
|
||||
|
||||
if($this->hasAppVersionModifyPermission($oVersion->iVersionId))
|
||||
if($this->hasAppVersionModifyPermission($oVersion))
|
||||
return true;
|
||||
|
||||
if(($this->iUserId == $oVersion->iSubmitterId) &&
|
||||
|
||||
@@ -69,8 +69,9 @@ if ($_REQUEST['sub'])
|
||||
if(is_numeric($_REQUEST['iTestingId']))
|
||||
{
|
||||
// make sure the user has permission to view this testing result
|
||||
$oVersion = new Version($oTest->iVersionId);
|
||||
if(!$_SESSION['current']->hasPriv("admin") &&
|
||||
!$_SESSION['current']->hasAppVersionModifyPermission($oTest->iVersionId)&&
|
||||
!$_SESSION['current']->hasAppVersionModifyPermission($oVersion)&&
|
||||
!(($_SESSION['current']->iUserId == $oTest->iSubmitterId) && !($oTest->sQueued == 'false')))
|
||||
{
|
||||
errorpage("Insufficient privileges.");
|
||||
|
||||
Reference in New Issue
Block a user