summaryrefslogtreecommitdiffstats
path: root/web/lib
diff options
context:
space:
mode:
authorLeonidas Spyropoulos <artafinde@gmail.com>2021-04-07 10:56:16 +0200
committerEli Schwartz <eschwartz@archlinux.org>2021-04-30 22:50:15 +0200
commit3bd4aa4c6b98e304978211c1e945f7b6bc19fc74 (patch)
tree66eb8bf66655de322052a3085f46e44d3ef1dd98 /web/lib
parent2a4f423e110d94b741e251635fd378b8b6daa535 (diff)
downloadaur-3bd4aa4c6b98e304978211c1e945f7b6bc19fc74.tar.gz
aur-3bd4aa4c6b98e304978211c1e945f7b6bc19fc74.tar.xz
Filter out current username from co-maintainers list.
Closes: #8 Signed-off-by: Leonidas Spyropoulos <artafinde@gmail.com> Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/pkgbasefuncs.inc.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php
index 4a49898c..a053962e 100644
--- a/web/lib/pkgbasefuncs.inc.php
+++ b/web/lib/pkgbasefuncs.inc.php
@@ -1189,7 +1189,8 @@ function pkgbase_get_comaintainer_uids($base_ids) {
* @return array Tuple of success/failure indicator and error message
*/
function pkgbase_set_comaintainers($base_id, $users, $override=false) {
- if (!$override && !has_credential(CRED_PKGBASE_EDIT_COMAINTAINERS, array(pkgbase_maintainer_uid($base_id)))) {
+ $maintainer_uid = pkgbase_maintainer_uid($base_id);
+ if (!$override && !has_credential(CRED_PKGBASE_EDIT_COMAINTAINERS, array($maintainer_uid))) {
return array(false, __("You are not allowed to manage co-maintainers of this package base."));
}
@@ -1207,9 +1208,12 @@ function pkgbase_set_comaintainers($base_id, $users, $override=false) {
if (!$uid) {
return array(false, __("Invalid user name: %s", $user));
+ } elseif ($uid == $maintainer_uid) {
+ // silently ignore when maintainer == co-maintainer
+ continue;
+ } else {
+ $uids_new[] = $uid;
}
-
- $uids_new[] = $uid;
}
$q = sprintf("SELECT UsersID FROM PackageComaintainers WHERE PackageBaseID = %d", $base_id);