update permissions on write

This commit is contained in:
Jakob Ketterl 2021-02-18 21:07:45 +01:00
parent 0d77aaff26
commit d612792593
1 changed files with 3 additions and 0 deletions

View File

@ -4,6 +4,7 @@ from datetime import datetime, timezone
import json
import hashlib
import os
import stat
import logging
@ -189,6 +190,8 @@ class UserList(object):
jsonContent = json.dumps(users, indent=4)
with open(usersFile, "w") as f:
f.write(jsonContent)
# file should be readable by us only
os.chmod(usersFile, stat.S_IWUSR + stat.S_IRUSR)
except Exception:
logger.exception("error while writing users file %s", usersFile)
self.refresh()