Fix bugs
in the delete function for doors and groups
This commit is contained in:
parent
e9246bb376
commit
8d4600b490
@ -10,10 +10,10 @@ from flask import (
|
|||||||
)
|
)
|
||||||
import io
|
import io
|
||||||
from ldapSync import sync_ldap_to_database
|
from ldapSync import sync_ldap_to_database
|
||||||
from database import (WebServerPORT, add_door_to_database, check_access, delete_group_from_database,
|
from database import (add_door_to_database, check_access, delete_group_from_database,
|
||||||
get_doors, get_existing_groups, get_latest_logs, get_logs, get_users,
|
get_doors, get_existing_groups, get_latest_logs, get_logs, get_users,
|
||||||
log_access_attempt)
|
log_access_attempt)
|
||||||
from env import DBFILE
|
from env import DBFILE, WebServerPORT
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ def door_access():
|
|||||||
|
|
||||||
|
|
||||||
def run_flask_app():
|
def run_flask_app():
|
||||||
app.run(debug=True, use_reloader=False, port=5000, host="0.0.0.0")
|
app.run(debug=True, use_reloader=False, port=WebServerPORT, host="0.0.0.0")
|
||||||
|
|
||||||
|
|
||||||
def run_webServer_thread():
|
def run_webServer_thread():
|
||||||
|
|||||||
@ -232,6 +232,7 @@ def delete_group_from_database(group_cn):
|
|||||||
conn = sqlite3.connect(DBFILE)
|
conn = sqlite3.connect(DBFILE)
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
cursor.execute("DELETE FROM Groups WHERE cn = ?", (group_cn,))
|
cursor.execute("DELETE FROM Groups WHERE cn = ?", (group_cn,))
|
||||||
|
cursor.execute("DELETE FROM Doors WHERE GroupCn = ?", (group_cn,))
|
||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
|||||||
@ -99,4 +99,14 @@ form input[type="submit"]:hover {
|
|||||||
.navbar a:hover {
|
.navbar a:hover {
|
||||||
background-color: #ddd;
|
background-color: #ddd;
|
||||||
color: black;
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.delete-btn {
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px;
|
||||||
|
background-color: #b2424a;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Access Logs</title>
|
<title>Doors and Groups Associations</title>
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -14,7 +14,8 @@
|
|||||||
<a href="/LogsDB">Logs</a>
|
<a href="/LogsDB">Logs</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="container"><h1>Doors and Groups Associations</h1>
|
<div class="container">
|
||||||
|
<h1>Doors and Groups Associations</h1>
|
||||||
<h2>Doors</h2>
|
<h2>Doors</h2>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
@ -45,7 +46,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{{group}}</td>
|
<td>{{group}}</td>
|
||||||
<td>
|
<td>
|
||||||
<form action="{{ url_for('delete_group', group_cn=group['cn']) }}" method="post">
|
<form action="{{ url_for('delete_group', group_cn=group) }}" method="post">
|
||||||
<button type="submit" class="delete-btn">Delete</button>
|
<button type="submit" class="delete-btn">Delete</button>
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user