Commit 9355815f by Bence Dányi

firewall_gui: view response updated

parent 42f74a54
...@@ -10,26 +10,27 @@ def index(request): ...@@ -10,26 +10,27 @@ def index(request):
def list_rules(request): def list_rules(request):
rules = [{ rules = [{
'id': rule.id, 'id': rule.id,
'vlan': { 'target': {
'name': rule.vlan.name, 'name': rule.vlan.name,
'id': rule.vlan.id, 'id': rule.vlan.id,
} if rule.vlan else None, 'type': 'vlan',
'vlangroup': { } if rule.vlan else {
'name': rule.vlangroup.name, 'name': rule.vlangroup.name,
'id': rule.vlangroup.id, 'id': rule.vlangroup.id,
} if rule.vlangroup else None, 'type': 'vlangroup',
'hostgroup': { } if rule.vlangroup else {
'name': rule.hostgroup.name, 'name': rule.hostgroup.name,
'id': rule.hostgroup.id, 'id': rule.hostgroup.id,
} if rule.hostgroup else None, 'type': 'hostgroup',
'firewall': { } if rule.hostgroup else {
'name': rule.firewall.name, 'name': rule.firewall.name,
'id': rule.firewall.id, 'id': rule.firewall.id,
} if rule.firewall else None, 'type': 'firewall',
'host': { } if rule.firewall else {
'name': rule.host.hostname, 'name': rule.host.hostname,
'id': rule.host.id, 'id': rule.host.id,
} if rule.host else None, 'type': 'host',
},
'type': rule.r_type, 'type': rule.r_type,
'direction': rule.get_direction_display(), 'direction': rule.get_direction_display(),
'proto': rule.proto, 'proto': rule.proto,
...@@ -37,6 +38,10 @@ def list_rules(request): ...@@ -37,6 +38,10 @@ def list_rules(request):
'name': str(rule.owner), 'name': str(rule.owner),
'id': rule.owner.id 'id': rule.owner.id
}, },
'foreignNetwork': {
'name': rule.foreign_network.name,
'id': rule.foreign_network.id,
},
'created_at': rule.created_at.isoformat(), 'created_at': rule.created_at.isoformat(),
'modified_at': rule.modified_at.isoformat(), 'modified_at': rule.modified_at.isoformat(),
'nat': rule.nat, 'nat': rule.nat,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment