Add support for application wide maintainers, super maintainers, that are
maintainers for all versions of a particular application.
This commit is contained in:
@@ -37,6 +37,8 @@ function forum_lookup_user ($userid)
|
||||
*/
|
||||
function view_app_comment($ob)
|
||||
{
|
||||
global $apidb_root;
|
||||
|
||||
echo html_frame_start('','98%');
|
||||
echo '<table width="100%" border=0 cellpadding=2 cellspacing=1">',"\n";
|
||||
|
||||
@@ -69,10 +71,11 @@ function view_app_comment($ob)
|
||||
if(havepriv("admin") || isMaintainer($ob->appId, $ob->versionId))
|
||||
{
|
||||
echo "<tr>";
|
||||
echo '<td><form method=post name=message action="deletecomment.php"><input type=submit value="Delete" class=button> ',"\n";
|
||||
echo "<td><form method=post name=message action=$apidb_root/deletecomment.php><input type=submit value='Delete' class=button>\n";
|
||||
echo "<input type=hidden name='commentId' value=$ob->commentId>";
|
||||
echo "<input type=hidden name='appId' value=$ob->appId>";
|
||||
echo "<input type=hidden name='versionId' value=$ob->versionId></form></td>","\n";
|
||||
echo "blahblahblah $apidb_root";
|
||||
echo "</td></tr>";
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
function getAppsFromUserId($userId)
|
||||
{
|
||||
$result = mysql_query("SELECT appId, versionId FROM ".
|
||||
$result = mysql_query("SELECT appId, versionId, superMaintainer FROM ".
|
||||
"appMaintainers WHERE userId = '$userId'");
|
||||
if(mysql_num_rows($result) == 0)
|
||||
return;
|
||||
@@ -14,7 +14,7 @@ function getAppsFromUserId($userId)
|
||||
$c = 0;
|
||||
while($row = mysql_fetch_object($result))
|
||||
{
|
||||
$retval[$c] = array($row->appId, $row->versionId);
|
||||
$retval[$c] = array($row->appId, $row->versionId, $row->superMaintainer);
|
||||
$c++;
|
||||
}
|
||||
|
||||
@@ -44,4 +44,27 @@ function getMaintainersUserIdsFromAppIdVersionId($appId, $versionId)
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* get the userIds of super maintainers for this appId
|
||||
*/
|
||||
function getSuperMaintainersUserIdsFromAppId($appId)
|
||||
{
|
||||
$query = "SELECT userId FROM ".
|
||||
"appMaintainers WHERE appId = '$appId' " .
|
||||
"AND superMaintainer = '1';";
|
||||
$result = mysql_query($query);
|
||||
if(mysql_num_rows($result) == 0)
|
||||
return; // no sub categories
|
||||
|
||||
$retval = array();
|
||||
$c = 0;
|
||||
while($row = mysql_fetch_object($result))
|
||||
{
|
||||
$retval[$c] = array($row->userId);
|
||||
$c++;
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -28,9 +28,12 @@ function global_sidebar_login() {
|
||||
{
|
||||
$g->addmisc("");
|
||||
$g->addmisc("You maintain:\n");
|
||||
while(list($index, list($appId, $versionId)) = each($apps_user_maintains))
|
||||
while(list($index, list($appId, $versionId, $superMaintainer)) = each($apps_user_maintains))
|
||||
{
|
||||
$g->addmisc("<a href='".$apidb_root."appview.php?appId=$appId&versionId=$versionId'>".appIdToName($appId)." ".versionIdToName($versionId)."</a>", "center");
|
||||
if($superMaintainer)
|
||||
$g->addmisc("<a href='".$apidb_root."appview.php?appId=$appId'>".appIdToName($appId)."*</a>", "center");
|
||||
else
|
||||
$g->addmisc("<a href='".$apidb_root."appview.php?appId=$appId&versionId=$versionId'>".appIdToName($appId)." ".versionIdToName($versionId)."</a>", "center");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,6 +226,13 @@ class User {
|
||||
if(!loggedin() || !$this->userid)
|
||||
return false;
|
||||
|
||||
/* if this user is a super maintainer of this appid then they */
|
||||
/* are a maintainer of all of the versionId's of it as well */
|
||||
if($this->is_super_maintainer($appId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM appMaintainers WHERE userid = '$this->userid' AND appId = '$appId' AND versionId = '$versionId'";
|
||||
$result = mysql_query($query, $this->link);
|
||||
if(!$result)
|
||||
@@ -233,6 +240,22 @@ class User {
|
||||
return mysql_num_rows($result);
|
||||
}
|
||||
|
||||
/*
|
||||
* check if this user is an maintainer of a given appId/versionId
|
||||
*/
|
||||
function is_super_maintainer($appId)
|
||||
{
|
||||
global $current;
|
||||
if(!loggedin() || !$this->userid)
|
||||
return false;
|
||||
|
||||
$query = "SELECT * FROM appMaintainers WHERE userid = '$this->userid' AND appId = '$appId' AND superMaintainer = 1";
|
||||
$result = mysql_query($query, $this->link);
|
||||
if(!$result)
|
||||
return 0;
|
||||
return mysql_num_rows($result);
|
||||
}
|
||||
|
||||
function addpriv($priv)
|
||||
{
|
||||
if(!$this->userid || !$priv)
|
||||
@@ -302,6 +325,16 @@ function isMaintainer($appId, $versionId)
|
||||
return $current->is_maintainer($appId, $versionId);
|
||||
}
|
||||
|
||||
function isSuperMaintainer($appId)
|
||||
{
|
||||
global $current;
|
||||
|
||||
if(!loggedin())
|
||||
return false;
|
||||
|
||||
return $current->is_super_maintainer($appId);
|
||||
}
|
||||
|
||||
function debugging()
|
||||
{
|
||||
global $current;
|
||||
|
||||
Reference in New Issue
Block a user