-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserver.py
More file actions
28 lines (19 loc) · 690 Bytes
/
Copy pathserver.py
File metadata and controls
28 lines (19 loc) · 690 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
Simple Flask server for basic access control demonstration.
Note: This is a basic demo. Use backend/server.py for production.
"""
from flask import Flask, jsonify, request
app = Flask(__name__)
@app.route("/access", methods=["POST"])
def check_access():
"""Check if user has access based on simple whitelist."""
data = request.json
if not data or "user" not in data:
return jsonify({"error": "User not provided"}), 400
user = data["user"]
# Simple access check (for demonstration only)
if user in ["Jon", "Admin"]:
return jsonify({"access": True})
return jsonify({"access": False})
if __name__ == "__main__":
app.run(debug=True)