hobo_notify: handle new user attribute is_superuser (fixes #9488)
This commit is contained in:
parent
208152976b
commit
c693b7fa26
|
@ -372,6 +372,7 @@ def test_process_notification_user_provision():
|
|||
u'last_name': u'Doe',
|
||||
u'email': u'john.doe@example.net',
|
||||
u'zipcode': u'13400',
|
||||
u'is_superuser': False,
|
||||
u'roles': [
|
||||
{
|
||||
u'uuid': u'12345',
|
||||
|
@ -398,6 +399,7 @@ def test_process_notification_user_provision():
|
|||
assert user.form_data['_last_name'] == 'Doe'
|
||||
assert user.form_data['_zipcode'] == '13400'
|
||||
assert user.name_identifiers == ['a'*32]
|
||||
assert user.is_admin is False
|
||||
assert set(user.roles) == set(['12345', old_role.id])
|
||||
|
||||
notification = {
|
||||
|
@ -413,6 +415,7 @@ def test_process_notification_user_provision():
|
|||
u'last_name': u'Doe',
|
||||
u'email': u'john.doe@example.net',
|
||||
u'zipcode': u'13600',
|
||||
u'is_superuser': True,
|
||||
u'roles': [
|
||||
{
|
||||
u'uuid': u'xyz',
|
||||
|
@ -434,4 +437,5 @@ def test_process_notification_user_provision():
|
|||
assert user.form_data['_last_name'] == 'Doe'
|
||||
assert user.form_data['_zipcode'] == '13600'
|
||||
assert user.name_identifiers == ['a'*32]
|
||||
assert user.is_admin is True
|
||||
assert set(user.roles) == set([old_role.id])
|
||||
|
|
|
@ -180,6 +180,7 @@ class CmdHoboNotify(Command):
|
|||
user.name_identifiers = [uuid]
|
||||
role_uuids = [role['uuid'] for role in o['roles']]
|
||||
# reset roles
|
||||
user.is_admin = o.get('is_superuser', False)
|
||||
user.roles = []
|
||||
for role_uuid in role_uuids:
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue