From 4dd529c6e67d4318c0593ad71780cba09d2d8e48 Mon Sep 17 00:00:00 2001 From: Yuming Zhu Date: Nov 17 2017 07:56:39 +0000 Subject: use `hasPerm` to check permission in save_failed_tree fixes #709 --- diff --git a/plugins/hub/save_failed_tree.py b/plugins/hub/save_failed_tree.py index 3a98128..5b34c2d 100644 --- a/plugins/hub/save_failed_tree.py +++ b/plugins/hub/save_failed_tree.py @@ -42,7 +42,7 @@ def saveFailedTree(buildrootID, full=False, **opts): elif allowed_methods != '*' and task_info['method'] not in allowed_methods: raise koji.PreBuildError("Only %s tasks can upload their buildroots (Task %s is %s)." % \ (', '.join(allowed_methods), task_info['id'], task_info['method'])) - elif task_info["owner"] != context.session.user_id and not context.session.assertPerm('admin'): + elif task_info["owner"] != context.session.user_id and not context.session.hasPerm('admin'): raise koji.ActionNotAllowed("Only owner of failed task or 'admin' can run this task.") elif not kojihub.get_host(task_info['host_id'])['enabled']: raise koji.PreBuildError("Host is disabled.")