Add support for organizations to disableabuser
This commit is contained in:
parent
457f685952
commit
2814d2d5eb
1 changed files with 4 additions and 4 deletions
|
@ -11,12 +11,12 @@ def disable_abusing_user(username, queue_name):
|
|||
if not username:
|
||||
raise Exception('Must enter a username')
|
||||
|
||||
user = model.user.get_user(username)
|
||||
user = model.user.get_namespace_user(username)
|
||||
if user is None:
|
||||
raise Exception('Unknown user %s' % username)
|
||||
raise Exception('Unknown user or organization %s' % username)
|
||||
|
||||
if not user.enabled:
|
||||
print "NOTE: User %s is already disabled" % username
|
||||
print "NOTE: Namespace %s is already disabled" % username
|
||||
|
||||
queue_prefix = '%s/%s/%%' % (queue_name, username)
|
||||
existing_queue_item_count = (QueueItem
|
||||
|
@ -75,7 +75,7 @@ def disable_abusing_user(username, queue_name):
|
|||
count_removed = dockerfile_build_queue.delete_namespaced_items(user.username)
|
||||
|
||||
info = (username, len(triggers), count_removed)
|
||||
print "User %s disabled, %s triggers deleted, %s queued builds removed" % info
|
||||
print "Namespace %s disabled, %s triggers deleted, %s queued builds removed" % info
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser(description='Disables a user abusing the build system')
|
||||
|
|
Reference in a new issue