Browse Source

finishing touches and fixes on managed IPs database migration 16

asd
forest 12 months ago
parent
commit
74d77224f7
  1. 4
      capsulflask/auth.py
  2. 4
      capsulflask/schema_migrations/16_up_managed_ips.sql

4
capsulflask/auth.py

@ -38,10 +38,10 @@ def admin_account_required(view):
@functools.wraps(view)
def wrapped_view(**kwargs):
if session.get("account") is None or session.get("csrf-token") is None:
return redirect(url_for("auth.login"))
return abort(404)
if session.get("account") not in current_app.config["ADMIN_PANEL_ALLOW_EMAIL_ADDRESSES"].split(","):
return redirect(url_for("auth.login"))
return abort(404)
return view(**kwargs)

4
capsulflask/schema_migrations/16_up_managed_ips.sql

@ -13,8 +13,8 @@ ALTER TABLE vms RENAME COLUMN last_seen_ipv4 TO public_ipv4;
ALTER TABLE vms RENAME COLUMN last_seen_ipv6 TO public_ipv6;
ALTER TABLE vms ADD COLUMN network_name TEXT;
UPDATE vms SET network_name = 'virbr1' WHERE public_ipv6 < '69.61.2.192';
UPDATE vms SET network_name = 'virbr2' WHERE public_ipv6 >= '69.61.2.192';
UPDATE vms SET network_name = 'virbr1' WHERE public_ipv4 < '69.61.2.192' OR public_ipv4 is NULL;
UPDATE vms SET network_name = 'virbr2' WHERE public_ipv4 >= '69.61.2.192';
ALTER TABLE vms ALTER COLUMN network_name SET NOT NULL;

Loading…
Cancel
Save