bundles/users: fix adding of non-admin users

This commit is contained in:
Franzi 2021-06-01 16:53:29 +02:00
parent 47c18913ca
commit 09397e2597
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -20,17 +20,18 @@ def add_users_from_json(metadata):
json = loads(f.read())
users = {}
metadata_users = metadata.get('users', {})
# First, add all admin users
for uname, config in json.items():
if config.get('is_admin', False):
if config.get('is_admin', False) or uname in metadata_users:
users[uname] = {
'ssh_pubkey': set(config['ssh_pubkey']),
'is_admin': True,
'is_admin': config.get('is_admin', False),
}
# Then, run again to get all 'to be deleted' users
for uname, config in json.items():
if uname not in metadata.get('users', {}):
if uname not in metadata_users:
users.setdefault(uname, {
'delete': True,
})