PR#2457: hub: more verbose assertPerm error
Merges #2457 https://pagure.io/koji/pull-request/2457 Fixes: #2429 https://pagure.io/koji/issue/2429 assertPerm() should show the username
This commit is contained in:
commit
9c92f5e4be
1 changed files with 6 additions and 1 deletions
|
|
@ -501,7 +501,12 @@ class Session(object):
|
|||
|
||||
def assertPerm(self, name):
|
||||
if not self.hasPerm(name) and not self.hasPerm('admin'):
|
||||
raise koji.ActionNotAllowed("%s permission required" % name)
|
||||
msg = "%s permission required" % name
|
||||
if self.logged_in:
|
||||
msg += ' (logged in as %s)' % self.user_data['name']
|
||||
else:
|
||||
msg += ' (user not logged in)'
|
||||
raise koji.ActionNotAllowed(msg)
|
||||
|
||||
def assertLogin(self):
|
||||
if not self.logged_in:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue