From 1984e9239200fbde71a2d0e9131f2cbc410e59e0 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Mon, 4 Jan 2016 16:47:55 +0100 Subject: [PATCH] hobo_notify: handle new user attribute is_superuser (fixes #9488) --- tests/test_hobo_notify.py | 4 ++++ wcs/ctl/hobo_notify.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_hobo_notify.py b/tests/test_hobo_notify.py index ecc21f5..8c6751c 100644 --- a/tests/test_hobo_notify.py +++ b/tests/test_hobo_notify.py @@ -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]) diff --git a/wcs/ctl/hobo_notify.py b/wcs/ctl/hobo_notify.py index 91e2a1a..f931edd 100644 --- a/wcs/ctl/hobo_notify.py +++ b/wcs/ctl/hobo_notify.py @@ -150,7 +150,8 @@ class CmdHoboNotify(Command): and 'email' in o \ and 'first_name' in o \ and 'last_name' in o \ - and 'roles' in o + and 'roles' in o \ + and 'is_superuser' in o @classmethod def provision_user(cls, publisher, issuer, action, data, full=False): @@ -180,6 +181,7 @@ class CmdHoboNotify(Command): user.name_identifiers = [uuid] role_uuids = [role['uuid'] for role in o['roles']] # reset roles + user.is_admin = o['is_superuser'] user.roles = [] for role_uuid in role_uuids: try: -- 2.1.4