From a77f211b8ec6a49afdf9186140d48f257baa0e6f Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 6 Oct 2022 09:23:43 -0400 Subject: [PATCH] Fix json restore of users and groups Defaults were erroneously used do to oversight and mistake in teh json restore code. --- confluent_server/confluent/config/configmanager.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/confluent_server/confluent/config/configmanager.py b/confluent_server/confluent/config/configmanager.py index 68a8c94a..e4fb25c0 100644 --- a/confluent_server/confluent/config/configmanager.py +++ b/confluent_server/confluent/config/configmanager.py @@ -2464,12 +2464,15 @@ class ConfigManager(object): self.set_group_attributes(tmpconfig[confarea], True) elif confarea == 'usergroups': for usergroup in tmpconfig[confarea]: - self.create_usergroup(usergroup) + role = tmpconfig[confarea][usergroup].get('role', 'Administrator') + self.create_usergroup(usergroup, role=role) elif confarea == 'users': for user in tmpconfig[confarea]: - uid = tmpconfig[confarea].get('id', None) - displayname = tmpconfig[confarea].get('displayname', None) - self.create_user(user, uid=uid, displayname=displayname) + ucfg = tmpconfig[confarea][user] + uid = ucfg.get('id', None) + displayname = ucfg.get('displayname', None) + role = ucfg.get('role', None) + self.create_user(user, uid=uid, displayname=displayname, role=role) for attrname in ('authid', 'authenticators', 'cryptpass'): if attrname in tmpconfig[confarea][user]: self._cfgstore['users'][user][attrname] = tmpconfig[confarea][user][attrname]