finishing touches and fixes on managed IPs database migration 16

This commit is contained in:
forest 2021-07-09 14:35:23 -05:00
parent 862b14545b
commit 74d77224f7
2 changed files with 4 additions and 4 deletions

View File

@ -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)

View File

@ -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;