MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / discussion_file_download

Function discussion_file_download

Scripts/ButSystem.py:13065–13094  ·  view source on GitHub ↗

Download a Discussion attachment with a filename.

(fid: int)

Source from the content-addressed store, hash-verified

13063 # Ensure we don't remove the last admin
13064 admins = conn.execute("SELECT COUNT(*) AS c FROM users WHERE is_admin=1").fetchone()
13065 if admins and int(admins["c"]) <= 1:
13066 conn.close()
13067 flash("Refusing to remove the last admin.")
13068 return redirect(url_for("admin_panel"))
13069
13070 row = conn.execute("SELECT is_admin FROM users WHERE username=?", (u,)).fetchone()
13071 if not row:
13072 conn.close()
13073 flash("User not found.")
13074 return redirect(url_for("admin_panel"))
13075 if int(row["is_admin"]) != 1:
13076 conn.close()
13077 flash("User is not an admin.")
13078 return redirect(url_for("admin_panel"))
13079
13080 conn.execute("UPDATE users SET is_admin=0, admin_device_id=NULL WHERE username=?", (u,))
13081 conn.commit()
13082 conn.close()
13083 flash(f"Removed admin from @{u}.")
13084 return redirect(url_for("admin_panel"))
13085
13086@app.route("/admin/kick", methods=["POST"])
13087@login_required
13088def admin_kick_user():
13089 """admin_kick_user.
13090
13091Admin-only route handler.
13092
13093This docstring was expanded to make future maintenance easier.
13094
13095Returns:
13096 Varies.
13097"""

Callers

nothing calls this directly

Calls 4

_feature_tables_initFunction · 0.70
db_connectFunction · 0.70
is_encrypted_fileFunction · 0.70
aesgcm_decrypt_generatorFunction · 0.70

Tested by

no test coverage detected