Allow admins to operate on all sidetags

Fixes: #2321

Signed-off-by: Nils Philippsen <nils@redhat.com>
This commit is contained in:
Nils Philippsen 2020-06-16 17:10:58 +02:00 committed by Tomas Kopecek
parent a8c72a7740
commit cad3e63ee5

View file

@ -40,7 +40,8 @@ def is_sidetag(taginfo, raise_error=False):
def is_sidetag_owner(taginfo, user, raise_error=False):
"""Check, that given user is owner of the sidetag"""
result = (taginfo['extra'].get('sidetag') and
taginfo['extra'].get('sidetag_user_id') == user['id'])
(taginfo['extra'].get('sidetag_user_id') == user['id'] or
context.session.hasPerm('admin'))))
if not result and raise_error:
raise koji.ActionNotAllowed("This is not your sidetag")