User management and module improvements

- Added daily_mirror module to permissions system
- Fixed user module management - updates now work correctly
- Implemented dashboard module filtering based on user permissions
- Fixed warehouse create_locations page (config parser and delete)
- Implemented POST-Redirect-GET pattern to prevent duplicate entries
- Added application license system with validation middleware
- Cleaned up debug logging code
- Improved user module selection with fetch API instead of form submit
This commit is contained in:
ske087
2025-11-29 14:16:36 +02:00
parent 3e314332a7
commit 7912885046
9 changed files with 355 additions and 69 deletions

View File

@@ -12,8 +12,10 @@ def get_db_connection():
settings = {}
with open(settings_file, 'r') as f:
for line in f:
key, value = line.strip().split('=', 1)
settings[key] = value
line = line.strip()
if line and '=' in line and not line.startswith('#'):
key, value = line.split('=', 1)
settings[key] = value
return mariadb.connect(
user=settings['username'],
password=settings['password'],
@@ -97,16 +99,22 @@ def delete_locations_by_ids(ids_str):
return f"Deleted {deleted} location(s)."
def create_locations_handler():
message = None
if request.method == "POST":
if request.form.get("delete_locations"):
ids_str = request.form.get("delete_ids", "")
message = delete_locations_by_ids(ids_str)
session['flash_message'] = message
else:
location_code = request.form.get("location_code")
size = request.form.get("size")
description = request.form.get("description")
message = add_location(location_code, size, description)
session['flash_message'] = message
# Redirect to prevent form resubmission on page reload
return redirect(url_for('warehouse.create_locations'))
# Get flash message from session if any
message = session.pop('flash_message', None)
locations = get_locations()
return render_template("create_locations.html", locations=locations, message=message)