From e1e488f723cb338021308553e2a90f0f73d44c12 Mon Sep 17 00:00:00 2001 From: AIIrondev Date: Sun, 19 Jul 2026 20:20:41 +0200 Subject: [PATCH] changes to incorperate the Encryption frokm the borrower name correctly --- Web/app.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Web/app.py b/Web/app.py index 8326e7f..6276063 100755 --- a/Web/app.py +++ b/Web/app.py @@ -10404,13 +10404,8 @@ def admin_damaged_items(): flash('Administratorrechte erforderlich.', 'error') return redirect(url_for('login')) - ''' - permissions = _get_current_user_permissions() - if not _action_access_allowed(permissions, 'can_manage_settings'): - flash('Sie haben keine Berechtigung, die Schulstammdaten zu ändern.', 'error') - if cfg.MODULES.is_enabled('library'): - return redirect(url_for('library_admin')) - ''' + # Import the decryption handler if it's not already at the top of the file + from modules.inventarsystem.data_protection import decrypt_text client = None try: @@ -10450,9 +10445,18 @@ def admin_damaged_items(): {'Item': item_id, 'Status': {'$in': ['active', 'planned']}}, {'_id': 1, 'User': 1, 'Status': 1, 'End': 1} ) + + # Decrypt the borrower inside the active loan tracking object + if active_borrow and active_borrow.get('User'): + active_borrow['User'] = decrypt_text(active_borrow['User']) + reports = item_doc.get('DamageReports', []) or [] latest_report = reports[0] if reports else {} + # Decrypt the static snapshot borrower field on the item itself + raw_user = item_doc.get('User', '') + decrypted_user = decrypt_text(raw_user) if raw_user else '' + damaged_rows.append({ 'id': item_id, 'name': item_doc.get('Name', ''), @@ -10462,7 +10466,7 @@ def admin_damaged_items(): 'isbn': item_doc.get('ISBN', ''), 'condition': item_doc.get('Condition', ''), 'available': bool(item_doc.get('Verfuegbar', False)), - 'borrow_user': item_doc.get('User', ''), + 'borrow_user': decrypted_user, 'damage_count': len(reports), 'damage_reports': reports, 'latest_damage_description': latest_report.get('description', ''),