Allow only Trusted Users, Developers, and Maintainers to unflag packages

Currently everyone is allowed to unflag a package as out of date. This should
be limited to only the appropriate people for a specific package.

Fixes FS#27263

Signed-off-by: canyonknight <canyonknight@gmail.com>
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
canyonknight 2012-08-09 21:15:50 -04:00 committed by Lukas Fleischer
parent 44d8588b63
commit e8cd6abc6e
3 changed files with 8 additions and 2 deletions

View file

@ -728,6 +728,10 @@ function pkg_flag ($atype, $ids, $action=true, $dbh=NULL) {
}
$q.= " WHERE ID IN (" . implode(",", $ids) . ")";
if (!$action && ($atype != "Trusted User" && $atype != "Developer")) {
$q.= "AND MaintainerUID = " . uid_from_sid($_COOKIE["AURSID"], $dbh);
}
db_query($q, $dbh);
if ($action) {

View file

@ -21,7 +21,8 @@
<?php if ($row["OutOfDateTS"] === NULL): ?>
<input type="submit" class="button" name="do_Flag" value="<?php echo __("Flag Out-of-date") ?>" />
<?php else: ?>
<?php elseif (($row["OutOfDateTS"] !== NULL) &&
($uid == $row["MaintainerUID"] || $atype == "Trusted User" || $atype == "Developer")): ?>
<input type="submit" class="button" name="do_UnFlag" value="<?php echo __("UnFlag Out-of-date") ?>" />
<?php endif; ?>
<?php endif; ?>

View file

@ -40,7 +40,8 @@ $sources = package_sources($row["ID"]);
<?php if ($USE_VIRTUAL_URLS && $uid): ?>
<?php if ($row["OutOfDateTS"] === NULL): ?>
<li><a href="<?php echo get_pkg_uri($row['Name']) . 'flag/'; ?>"><?php echo __('Flag package out-of-date'); ?></a></li>
<?php else: ?>
<?php elseif (($row["OutOfDateTS"] !== NULL) &&
($uid == $row["MaintainerUID"] || $atype == "Trusted User" || $atype == "Developer")): ?>
<li><a href="<?php echo get_pkg_uri($row['Name']) . 'unflag/'; ?>"><?php echo __('Unflag package'); ?></a></li>
<?php endif; ?>
<?php if (user_voted($uid, $row['ID'])): ?>