Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b1c104f36c | |||
| 5afe05b2d2 | |||
| 7207fef0d4 |
+23
-7
@@ -289,7 +289,7 @@ SCHEDULER_INTERVAL = cfg.SCHEDULER_INTERVAL_MIN
|
|||||||
SSL_CERT = cfg.SSL_CERT
|
SSL_CERT = cfg.SSL_CERT
|
||||||
SSL_KEY = cfg.SSL_KEY
|
SSL_KEY = cfg.SSL_KEY
|
||||||
|
|
||||||
LIBRARY_ITEM_TYPES = ('book', 'cd', 'dvd', 'other', 'schoolbook', 'Buch', 'Schulbuch', 'schulbuch')
|
LIBRARY_ITEM_TYPES = ('book', 'cd', 'dvd', 'schoolbook', 'Buch', 'Schulbuch', 'schulbuch')
|
||||||
INVOICE_CURRENCY = 'EUR'
|
INVOICE_CURRENCY = 'EUR'
|
||||||
|
|
||||||
NOTIFICATION_STATUS_CACHE_TTL = max(3, int(os.getenv('INVENTAR_NOTIFICATION_STATUS_CACHE_TTL', '8')))
|
NOTIFICATION_STATUS_CACHE_TTL = max(3, int(os.getenv('INVENTAR_NOTIFICATION_STATUS_CACHE_TTL', '8')))
|
||||||
@@ -3212,7 +3212,7 @@ def api_library_items():
|
|||||||
ausleihungen_db = db['ausleihungen']
|
ausleihungen_db = db['ausleihungen']
|
||||||
|
|
||||||
query = {
|
query = {
|
||||||
'ItemType': {'$in': ['book', 'cd', 'dvd', 'other', 'schoolbook', 'schulbuch', 'Buch', 'Schulbuch']},
|
'ItemType': {'$in': ['book', 'cd', 'dvd', 'schoolbook', 'schulbuch', 'Buch', 'Schulbuch']},
|
||||||
'IsGroupedSubItem': {'$ne': True},
|
'IsGroupedSubItem': {'$ne': True},
|
||||||
'Deleted': {'$ne': True}
|
'Deleted': {'$ne': True}
|
||||||
}
|
}
|
||||||
@@ -3338,7 +3338,7 @@ def api_library_items():
|
|||||||
client = MongoClient(cfg.MONGODB_HOST, cfg.MONGODB_PORT)
|
client = MongoClient(cfg.MONGODB_HOST, cfg.MONGODB_PORT)
|
||||||
db = client[cfg.MONGODB_DB]
|
db = client[cfg.MONGODB_DB]
|
||||||
student_cards = db['student_cards']
|
student_cards = db['student_cards']
|
||||||
card = student_cards.find_one({'_id': ObjectId(borrow_id)})
|
card = student_cards.find_one({'_id': ObjectId(borrower)}) if borrower else None
|
||||||
card = _decrypt_student_card_doc(card)
|
card = _decrypt_student_card_doc(card)
|
||||||
client.close()
|
client.close()
|
||||||
borrower = card['SchülerName']
|
borrower = card['SchülerName']
|
||||||
@@ -8154,10 +8154,26 @@ def admin_audit_dashboard():
|
|||||||
|
|
||||||
# DEC_START: Decrypt the sensitive fields for display
|
# DEC_START: Decrypt the sensitive fields for display
|
||||||
for row in audit_rows:
|
for row in audit_rows:
|
||||||
if "payload" in row:
|
payload_raw = row.get("payload")
|
||||||
# decrypt_document_fields acts in-place
|
|
||||||
decrypt_document_fields(row["payload"], SENSITIVE_AUDIT_FIELDS)
|
if payload_raw and isinstance(payload_raw, str):
|
||||||
# DEC_END
|
try:
|
||||||
|
# Safely evaluate the python-like dict string, providing context for ObjectId
|
||||||
|
safe_context = {"ObjectId": ObjectId, "None": None, "True": True, "False": False}
|
||||||
|
payload_dict = eval(payload_raw, {"__builtins__": {}}, safe_context)
|
||||||
|
|
||||||
|
if isinstance(payload_dict, dict):
|
||||||
|
# Decrypt the sensitive keys inside the extracted dictionary
|
||||||
|
decrypt_document_fields(payload_dict, SENSITIVE_AUDIT_FIELDS)
|
||||||
|
|
||||||
|
# Replace the raw string with the clean dictionary for the Jinja template
|
||||||
|
row["payload"] = payload_dict
|
||||||
|
except Exception as parse_err:
|
||||||
|
app.logger.error(f"Failed to parse audit payload string for index {row.get('chain_index')}: {parse_err}")
|
||||||
|
|
||||||
|
elif payload_raw and isinstance(payload_raw, dict):
|
||||||
|
# Fallback in case some newer log rows are already stored as proper dictionaries
|
||||||
|
decrypt_document_fields(payload_raw, SENSITIVE_AUDIT_FIELDS)
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
'admin_audit.html',
|
'admin_audit.html',
|
||||||
|
|||||||
Reference in New Issue
Block a user