From 64621b8a660cd20a17551bd6354d4562e228c5f4 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 23 2021 11:04:49 +0000 Subject: Fix the orphan endpoint In the previous commit we prevented anyone from orphaning packages but we prevented admins from doing it, which isn't what we meant to do, admins should be allowed to orphan any packages since sometime people become non-responsive. This commit fixes this, we now only allow the current main admin or admins to orphan packages. Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure_distgit/plugin.py b/pagure_distgit/plugin.py index f1970e4..1f5f0fa 100644 --- a/pagure_distgit/plugin.py +++ b/pagure_distgit/plugin.py @@ -276,7 +276,8 @@ def orphan_endpoint(namespace, repo): 401, error_code=APIERROR.EMODIFYPROJECTNOTALLOWED ) - if repo.user.user != flask.g.fas_user.username or pagure.utils.is_admin(): + if repo.user.user != flask.g.fas_user.username \ + and not pagure.utils.is_admin(): raise pagure.exceptions.APIError( 401, error_code=APIERROR.EMODIFYPROJECTNOTALLOWED )