summaryrefslogtreecommitdiffstats
path: root/web/lib
diff options
context:
space:
mode:
authorMark Weiman <mark.weiman@markzz.com>2018-02-06 03:54:56 +0100
committerLukas Fleischer <lfleischer@archlinux.org>2018-02-24 14:57:31 +0100
commitf15c700ad2ed2f5512a5574ab29f85c4848039e4 (patch)
treebc9232112070ce82dc18c4d5e5d7c0484187cad7 /web/lib
parent27654afadb5088dda4eafd83f07410c2a48fa4b0 (diff)
downloadaur-f15c700ad2ed2f5512a5574ab29f85c4848039e4.tar.gz
aur-f15c700ad2ed2f5512a5574ab29f85c4848039e4.tar.xz
Add capability for co-maintainers to disown packages
Implements FS#53832. Signed-off-by: Mark Weiman <mark.weiman@markzz.com> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/pkgbasefuncs.inc.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php
index ff1bc901..16f95dac 100644
--- a/web/lib/pkgbasefuncs.inc.php
+++ b/web/lib/pkgbasefuncs.inc.php
@@ -1158,11 +1158,12 @@ function pkgbase_get_comaintainer_uids($base_ids) {
*
* @param int $base_id The package base ID to update the co-maintainers of
* @param array $users Array of co-maintainer user names
+ * @param boolean $override Override credential check if true
*
* @return array Tuple of success/failure indicator and error message
*/
-function pkgbase_set_comaintainers($base_id, $users) {
- if (!has_credential(CRED_PKGBASE_EDIT_COMAINTAINERS, array(pkgbase_maintainer_uid($base_id)))) {
+function pkgbase_set_comaintainers($base_id, $users, $override=false) {
+ if (!$override && !has_credential(CRED_PKGBASE_EDIT_COMAINTAINERS, array(pkgbase_maintainer_uid($base_id)))) {
return array(false, __("You are not allowed to manage co-maintainers of this package base."));
}
@@ -1213,3 +1214,10 @@ function pkgbase_set_comaintainers($base_id, $users) {
return array(true, __("The package base co-maintainers have been updated."));
}
+
+function pkgbase_remove_comaintainer($base_id, $uid) {
+ $uname = username_from_id($uid);
+ $names = pkgbase_get_comaintainers($base_id);
+ $names = array_diff($names, array($uname));
+ return pkgbase_set_comaintainers($base_id, $names, true);
+}