支持批量删除
This commit is contained in:
parent
5c2381c3a8
commit
0001c8f0d3
35
app.py
35
app.py
@ -1533,41 +1533,6 @@ def download_crl(ca_id):
|
|||||||
return redirect(url_for('ca_detail', ca_id=ca_id))
|
return redirect(url_for('ca_detail', ca_id=ca_id))
|
||||||
|
|
||||||
|
|
||||||
@app.route('/certificates')
|
|
||||||
@login_required
|
|
||||||
def certificate_list():
|
|
||||||
conn = get_db_connection()
|
|
||||||
if conn:
|
|
||||||
try:
|
|
||||||
cursor = conn.cursor(dictionary=True)
|
|
||||||
if current_user.is_admin:
|
|
||||||
cursor.execute("""
|
|
||||||
SELECT c.*, ca.name as ca_name
|
|
||||||
FROM certificates c
|
|
||||||
JOIN certificate_authorities ca ON c.ca_id = ca.id
|
|
||||||
ORDER BY c.created_at DESC
|
|
||||||
""")
|
|
||||||
else:
|
|
||||||
cursor.execute("""
|
|
||||||
SELECT c.*, ca.name as ca_name
|
|
||||||
FROM certificates c
|
|
||||||
JOIN certificate_authorities ca ON c.ca_id = ca.id
|
|
||||||
WHERE c.created_by = %s
|
|
||||||
ORDER BY c.created_at DESC
|
|
||||||
""", (current_user.id,))
|
|
||||||
certificates = cursor.fetchall()
|
|
||||||
return render_template('certificate_list.html', certificates=certificates, get_username=get_username)
|
|
||||||
except Error as e:
|
|
||||||
print(f"Database error: {e}")
|
|
||||||
flash('获取证书列表失败', 'danger')
|
|
||||||
return redirect(url_for('index'))
|
|
||||||
finally:
|
|
||||||
if conn.is_connected():
|
|
||||||
cursor.close()
|
|
||||||
conn.close()
|
|
||||||
return redirect(url_for('index'))
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/certificates/create', methods=['GET', 'POST'])
|
@app.route('/certificates/create', methods=['GET', 'POST'])
|
||||||
@login_required
|
@login_required
|
||||||
def create_certificate_view():
|
def create_certificate_view():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user