mirror of
https://github.com/TakeusV1/flask_ipam.git
synced 2026-10-13 17:15:33 +02:00
V1.5
- BLACKLIST SYSTEM - FIXES
This commit is contained in:
1 parent
1f32755ade
commit
a2a86db788
4 files changed
+37
-3
No files matched your search
@@ -202,6 +202,31 @@ def network_delete(net_id):
|
||||
flash("Network Not Found", 'danger')
|
||||
return redirect(url_for('network.networks'))
|
||||
|
||||
@network.get('/<int:net_id>/blacklist/<action>')
|
||||
@login_required
|
||||
def network_blacklist(net_id, action):
|
||||
if current_user.is_reado:
|
||||
return abort(403)
|
||||
|
||||
db_network = Network.query.filter_by(id=net_id).first()
|
||||
|
||||
if db_network == None:
|
||||
flash("Network Not Found", 'danger')
|
||||
return redirect(url_for('network.networks'))
|
||||
|
||||
if action == 'blacklist':
|
||||
db_network.is_blacklisted = True
|
||||
db.session.commit()
|
||||
flash("Network Blacklisted", 'warning')
|
||||
|
||||
elif action == 'unblacklist':
|
||||
db_network.is_blacklisted = False
|
||||
db.session.commit()
|
||||
flash("Network Unblacklisted", 'success')
|
||||
|
||||
|
||||
return redirect(url_for('network.networks'))
|
||||
|
||||
## HTMX SEARCH
|
||||
@network.post('/<int:net_id>/allocations/search')
|
||||
@login_required
|
||||
|
||||
Reference in new issue
Block a user