Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
fece1a96
authored
May 28, 2013
by
Bence Dányi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall_gui: allow to crete new vlangroup
parent
e01052c4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
52 deletions
+80
-52
firewall_gui/views.py
+80
-52
No files found.
firewall_gui/views.py
View file @
fece1a96
...
...
@@ -388,65 +388,93 @@ def show_vlan(request, id=None):
return
HttpResponse
(
json
.
dumps
(
vlan
),
content_type
=
'application/json'
)
def
show_vlangroup
(
request
,
id
):
group
=
get_object_or_404
(
VlanGroup
,
id
=
id
)
group
=
{
'id'
:
group
.
id
,
'name'
:
group
.
name
,
'vlans'
:
[{
'id'
:
vlan
.
id
,
'name'
:
vlan
.
name
}
for
vlan
in
group
.
vlans
.
all
()],
'description'
:
group
.
description
,
'owner'
:
{
'id'
:
group
.
owner
.
id
,
'name'
:
str
(
group
.
owner
)
},
'created_at'
:
group
.
created_at
.
isoformat
(),
'modified_at'
:
group
.
modified_at
.
isoformat
(),
'rules'
:
[{
'id'
:
rule
.
id
,
'direction'
:
rule
.
get_direction_display
(),
'proto'
:
rule
.
proto
,
def
show_vlangroup
(
request
,
id
=
None
):
try
:
group
=
VlanGroup
.
objects
.
get
(
id
=
id
)
group
=
{
'id'
:
group
.
id
,
'name'
:
group
.
name
,
'vlans'
:
[{
'id'
:
vlan
.
id
,
'name'
:
vlan
.
name
}
for
vlan
in
group
.
vlans
.
all
()],
'description'
:
group
.
description
,
'owner'
:
{
'id'
:
rule
.
owner
.
id
,
'name'
:
str
(
rule
.
owner
),
'id'
:
group
.
owner
.
id
,
'name'
:
str
(
group
.
owner
)
},
'accept'
:
rule
.
accept
,
'nat'
:
rule
.
nat
}
for
rule
in
group
.
rules
.
all
()]
}
'created_at'
:
group
.
created_at
.
isoformat
(),
'modified_at'
:
group
.
modified_at
.
isoformat
(),
'rules'
:
[{
'id'
:
rule
.
id
,
'direction'
:
rule
.
get_direction_display
(),
'proto'
:
rule
.
proto
,
'owner'
:
{
'id'
:
rule
.
owner
.
id
,
'name'
:
str
(
rule
.
owner
),
},
'accept'
:
rule
.
accept
,
'nat'
:
rule
.
nat
}
for
rule
in
group
.
rules
.
all
()]
}
except
:
group
=
{
'id'
:
None
,
'name'
:
None
,
'vlans'
:
[],
'description'
:
''
,
'owner'
:
{
'name'
:
None
},
'created_at'
:
None
,
'modified_at'
:
None
,
'rules'
:
[]
}
return
HttpResponse
(
json
.
dumps
(
group
),
content_type
=
'application/json'
)
def
show_hostgroup
(
request
,
id
):
group
=
get_object_or_404
(
Group
,
id
=
id
)
group
=
{
'id'
:
group
.
id
,
'name'
:
group
.
name
,
'description'
:
group
.
description
,
'owner'
:
{
'id'
:
group
.
owner
.
id
,
'name'
:
str
(
group
.
owner
),
},
'created_at'
:
group
.
created_at
.
isoformat
(),
'modified_at'
:
group
.
modified_at
.
isoformat
(),
'hosts'
:
[{
'id'
:
host
.
id
,
'name'
:
host
.
hostname
}
for
host
in
group
.
host_set
.
all
()],
'rules'
:
[{
'id'
:
rule
.
id
,
'direction'
:
rule
.
get_direction_display
(),
'proto'
:
rule
.
proto
,
def
show_hostgroup
(
request
,
id
=
None
):
try
:
group
=
get_object_or_404
(
Group
,
id
=
id
)
group
=
{
'id'
:
group
.
id
,
'name'
:
group
.
name
,
'description'
:
group
.
description
,
'owner'
:
{
'id'
:
rule
.
owner
.
id
,
'name'
:
str
(
rule
.
owner
),
'id'
:
group
.
owner
.
id
,
'name'
:
str
(
group
.
owner
),
},
'accept'
:
rule
.
accept
,
'nat'
:
rule
.
nat
}
for
rule
in
group
.
rules
.
all
()]
}
'created_at'
:
group
.
created_at
.
isoformat
(),
'modified_at'
:
group
.
modified_at
.
isoformat
(),
'hosts'
:
[{
'id'
:
host
.
id
,
'name'
:
host
.
hostname
}
for
host
in
group
.
host_set
.
all
()],
'rules'
:
[{
'id'
:
rule
.
id
,
'direction'
:
rule
.
get_direction_display
(),
'proto'
:
rule
.
proto
,
'owner'
:
{
'id'
:
rule
.
owner
.
id
,
'name'
:
str
(
rule
.
owner
),
},
'accept'
:
rule
.
accept
,
'nat'
:
rule
.
nat
}
for
rule
in
group
.
rules
.
all
()]
}
except
:
group
=
{
'id'
:
None
,
'name'
:
None
,
'description'
:
''
,
'owner'
:
{
'name'
:
None
,
},
'created_at'
:
None
,
'modified_at'
:
None
,
'hosts'
:
[],
'rules'
:
[]
}
return
HttpResponse
(
json
.
dumps
(
group
),
content_type
=
'application/json'
)
def
show_record
(
request
,
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