Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6f6485e4
authored
May 13, 2013
by
Bence Dányi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall_gui: code refactored
parent
d811b880
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
44 deletions
+13
-44
firewall_gui/views.py
+13
-44
No files found.
firewall_gui/views.py
View file @
6f6485e4
...
@@ -82,52 +82,21 @@ def list_entities(request, name):
...
@@ -82,52 +82,21 @@ def list_entities(request, name):
'nat'
,
'nat'
,
'accept'
,
'accept'
,
'description'
]),
'description'
]),
'hosts'
:
make_entity_lister
(
Host
,
[
'id'
,
'reverse'
,
'ipv4'
,
'shared_ip'
,
'description'
,
'comment'
,
'location'
,
'vlan'
,
'owner'
,
'created_at'
,
'modified_at'
,
'groups'
]),
}[
name
](
request
)),
content_type
=
'application/json'
)
}[
name
](
request
)),
content_type
=
'application/json'
)
def
list_rules
(
request
):
rules
=
[{
'id'
:
rule
.
id
,
'target'
:
{
'name'
:
rule
.
vlan
.
name
,
'id'
:
rule
.
vlan
.
id
,
'type'
:
'vlan'
,
}
if
rule
.
vlan
else
{
'name'
:
rule
.
vlangroup
.
name
,
'id'
:
rule
.
vlangroup
.
id
,
'type'
:
'vlangroup'
,
}
if
rule
.
vlangroup
else
{
'name'
:
rule
.
hostgroup
.
name
,
'id'
:
rule
.
hostgroup
.
id
,
'type'
:
'hostgroup'
,
}
if
rule
.
hostgroup
else
{
'name'
:
rule
.
firewall
.
name
,
'id'
:
rule
.
firewall
.
id
,
'type'
:
'firewall'
,
}
if
rule
.
firewall
else
{
'name'
:
rule
.
host
.
hostname
,
'id'
:
rule
.
host
.
id
,
'type'
:
'host'
,
},
'type'
:
rule
.
r_type
,
'direction'
:
rule
.
get_direction_display
(),
'proto'
:
rule
.
proto
,
'owner'
:
{
'name'
:
str
(
rule
.
owner
),
'id'
:
rule
.
owner
.
id
},
'foreignNetwork'
:
{
'name'
:
rule
.
foreign_network
.
name
,
'id'
:
rule
.
foreign_network
.
id
,
},
'created_at'
:
rule
.
created_at
.
isoformat
(),
'modified_at'
:
rule
.
modified_at
.
isoformat
(),
'nat'
:
rule
.
nat
,
'accept'
:
rule
.
accept
,
'description'
:
rule
.
description
,
}
for
rule
in
Rule
.
objects
.
all
()]
return
HttpResponse
(
json
.
dumps
(
rules
),
content_type
=
'application/json'
)
def
list_hosts
(
request
):
def
list_hosts
(
request
):
hosts
=
[{
hosts
=
[{
'id'
:
host
.
id
,
'id'
:
host
.
id
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment