poprawki i zmiany ux

This commit is contained in:
Mateusz Gruszczyński
2026-03-26 09:30:39 +01:00
parent fd0f645251
commit 138059945e
28 changed files with 1000 additions and 225 deletions

View File

@@ -78,3 +78,21 @@ def reset_password(username: str):
return jsonify({"detail": str(exc)}), 403
except ValueError as exc:
return jsonify({"detail": str(exc)}), 400
@auth_blueprint.put("/auth/users/<username>/role")
def update_user_role(username: str):
payload = request.get_json(silent=True) or {}
try:
service.require_admin()
user = service.update_role(username=username, role=payload.get("role", "user"))
return jsonify(to_plain({
"username": user.username,
"display_name": user.display_name,
"role": user.role,
"is_active": user.is_active,
}))
except PermissionError as exc:
return jsonify({"detail": str(exc)}), 403
except ValueError as exc:
return jsonify({"detail": str(exc)}), 400

View File

@@ -25,11 +25,11 @@ def _resolve_kiosk_mode(requested_mode: str, require_write_access: bool = False)
if normalized_mode == "public":
if require_write_access and auth_service.enabled and session.get("auth_role") != "admin":
raise PermissionError("Brak uprawnien do edycji publicznego kiosku")
raise PermissionError("You do not have permission to edit the public kiosk")
return "public", "public"
if normalized_mode != "private":
raise ValueError("Mode musi byc jednym z: public, private")
raise ValueError("Mode must be one of: public, private")
if not auth_service.enabled:
return "private", "private"