Badger service: handle missing data
This commit is contained in:
parent
222d9efc89
commit
ccfc1a663d
@ -21,13 +21,19 @@ def badger():
|
|||||||
|
|
||||||
# Parse the request
|
# Parse the request
|
||||||
args = request.json
|
args = request.json
|
||||||
action = args['action']
|
action = args.get('action', '')
|
||||||
user_email = args['user_email']
|
user_email = args.get('user_email', '')
|
||||||
role = args['role']
|
role = args.get('role', '')
|
||||||
|
|
||||||
if action not in {'grant', 'revoke'}:
|
if action not in {'grant', 'revoke'}:
|
||||||
raise wz_exceptions.BadRequest('Action %r not supported' % action)
|
raise wz_exceptions.BadRequest('Action %r not supported' % action)
|
||||||
|
|
||||||
|
if not user_email:
|
||||||
|
raise wz_exceptions.BadRequest('User email not given')
|
||||||
|
|
||||||
|
if not role:
|
||||||
|
raise wz_exceptions.BadRequest('Role not given')
|
||||||
|
|
||||||
log.info('Service account %s %ss role %r to/from user %s',
|
log.info('Service account %s %ss role %r to/from user %s',
|
||||||
g.current_user['user_id'], action, role, user_email)
|
g.current_user['user_id'], action, role, user_email)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user