2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-15 12:17:47 +00:00

Fix json restore of users and groups

Defaults were erroneously used
do to oversight and mistake in teh json restore code.
This commit is contained in:
Jarrod Johnson 2022-10-06 09:23:43 -04:00
parent 3c29a5aa7f
commit a77f211b8e

View File

@ -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]