diff --git a/users.py b/users.py index fe9fce5..b57f2a9 100644 --- a/users.py +++ b/users.py @@ -3,6 +3,7 @@ import hashlib # User bezogene Funktionen import os +from stat import S_IREAD, S_IWUSR import datetime import time import json @@ -230,11 +231,14 @@ class user: data["archived"] = 1 data["overtime"] = overtime - json_dict = json.dumps(data) + json_dict = json.dumps(data, indent=4) with open(filename, "w") as outputfile: outputfile.write(json_dict) - + # Dateien auf readonly setzen + os.chmod(filename, S_IREAD) + filename_txt = f"{self.userfolder}/{year}-{month}.txt" + os.chmod(filename_txt, S_IREAD) def get_last_months_overtime(self, year, month): try: if int(month) == 1: diff --git a/users/testuser1/2025-4.json b/users/testuser1/2025-4.json index 1346aed..a4558cf 100644 --- a/users/testuser1/2025-4.json +++ b/users/testuser1/2025-4.json @@ -1,12 +1 @@ -{ - "archived": 0, - "overtime": 0, - "absence": { - "7": "U", - "8": "K", - "9": "KK", - "10": "UU", - "11": "F", - "14": "EZ" - } -} \ No newline at end of file +{"archived": 1, "overtime": -860821, "absence": {"7": "U", "8": "K", "9": "KK", "10": "UU", "11": "F", "14": "EZ"}} \ No newline at end of file