ChangeSet ID: 22279 CVSROOT: /opt/cvs-commit Module name: appdb Changes by: wineowner@winehq.org 2006/01/13 21:30:35
Modified files: . : distributionView.php include : distributions.php
Log message: Chris Morgan Only display testing results for applications that are not currently queued if the user isn't an admin.
Patch: http://cvs.winehq.org/patch.py?id=22279
Old revision New revision Changes Path 1.5 1.6 +8 -0 appdb/distributionView.php 1.1 1.2 +19 -3 appdb/include/distributions.php
Index: appdb/distributionView.php diff -u -p appdb/distributionView.php:1.5 appdb/distributionView.php:1.6 --- appdb/distributionView.php:1.5 14 Jan 2006 3:30:35 -0000 +++ appdb/distributionView.php 14 Jan 2006 3:30:35 -0000 @@ -119,6 +119,14 @@ else $oApp = new application($oVersion->iAppId); $oSubmitter = new User($oTest->iSubmitterId); $bgcolor = $oTest->sTestedRating; + + /* make sure the user can view the versions we list in the table */ + /* otherwise skip over displaying the entries in this table */ + if(!$_SESSION[current]->canViewApplication($oApp)) + continue; + if(!$_SESSION[current]->canViewVersion($oVersion)) + continue; + echo '<tr class='.$bgcolor.'>',"\n"; echo '<td><a href="'.BASE.'appview.php?versionId='.$oTest->iVersionId.'&iTestingId='.$oTest->iTestingId.'">',"\n"; echo $oApp->sName.' '.$oVersion->sName.'</a></td>',"\n"; Index: appdb/include/distributions.php diff -u -p appdb/include/distributions.php:1.1 appdb/include/distributions.php:1.2 --- appdb/include/distributions.php:1.1 14 Jan 2006 3:30:35 -0000 +++ appdb/include/distributions.php 14 Jan 2006 3:30:35 -0000 @@ -44,9 +44,25 @@ class distribution{ /* * We fetch Test Result Ids. */ - $sQuery = "SELECT testingId - FROM testResults - WHERE distributionId = ".$iDistributionId; + + if($_SESSION['current']->hasPriv("admin")) + { + $sQuery = "SELECT testingId + FROM testResults + WHERE distributionId = ".$iDistributionId; + } else /* only let users view test results that aren't queued and for apps that */ + /* aren't queued or versions that aren't queued */ + { + $sQuery = "SELECT testingId + FROM testResults, appFamily, appVersion + WHERE testResults.queued = 'false' AND + testResults.versionId = appVersion.versionId AND + appFamily.appId = appVersion.appId AND + appFamily.queued = 'false' AND + appVersion.queued = 'false' AND + distributionId = ".$iDistributionId; + } + if($hResult = query_appdb($sQuery)) { while($oRow = mysql_fetch_object($hResult))