Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f17f67ac
authored
Jan 30, 2013
by
Dányi Bence
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
ssh://giccero.cloud.ik.bme.hu/cloud
parents
15690d76
ec6ca5ab
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
6 deletions
+10
-6
firewall/admin.py
+8
-2
firewall/models.py
+1
-1
firewall/views.py
+0
-2
one/models.py
+1
-1
No files found.
firewall/admin.py
View file @
f17f67ac
...
...
@@ -12,13 +12,19 @@ class RuleInline(contrib.admin.TabularInline):
model
=
Rule
class
HostAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'hostname'
,
'vlan'
,
'ipv4'
,
'ipv6'
,
'pub_ipv4'
,
'mac'
,
'shared_ip'
,
'owner'
,
'description'
,
'reverse'
)
list_display
=
(
'hostname'
,
'vlan'
,
'ipv4'
,
'ipv6'
,
'pub_ipv4'
,
'mac'
,
'shared_ip'
,
'owner'
,
'description'
,
'reverse'
,
'groups_l'
)
ordering
=
(
'hostname'
,
)
list_filter
=
(
'owner'
,
'vlan'
,
'groups'
)
search_fields
=
(
'hostname'
,
'description'
,
'ipv4'
,
'ipv6'
,
'mac'
)
filter_horizontal
=
(
'groups'
,
)
inlines
=
(
AliasInline
,
RuleInline
)
def
groups_l
(
self
,
instance
):
retval
=
[]
for
i
in
instance
.
groups
.
all
():
retval
.
append
(
i
.
name
)
return
u', '
.
join
(
retval
)
class
HostInline
(
contrib
.
admin
.
TabularInline
):
model
=
Host
fields
=
(
'hostname'
,
'ipv4'
,
'ipv6'
,
'pub_ipv4'
,
'mac'
,
'shared_ip'
,
'owner'
,
'reverse'
)
...
...
@@ -26,7 +32,7 @@ class HostInline(contrib.admin.TabularInline):
class
VlanAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'vid'
,
'name'
,
'ipv4'
,
'net_ipv4'
,
'ipv6'
,
'net_ipv6'
,
'description'
,
'domain'
,
'snat_ip'
,
)
ordering
=
(
'vid'
,
)
inlines
=
(
HostInline
,
RuleInline
)
inlines
=
(
RuleInline
,
)
class
RuleAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'r_type'
,
'color_desc'
,
'owner'
,
'extra'
,
'direction'
,
'accept'
,
'proto'
,
'sport'
,
'dport'
,
'nat'
,
'nat_dport'
,
'used_in'
)
...
...
firewall/models.py
View file @
f17f67ac
...
...
@@ -163,7 +163,7 @@ class Host(models.Model):
for
host
in
Host
.
objects
.
filter
(
pub_ipv4
=
self
.
pub_ipv4
):
if
host
.
rules
.
filter
(
nat
=
True
,
proto
=
proto
,
dport
=
public
):
raise
ValidationError
(
"A
%
s
%
s port mar hasznalva"
%
(
proto
,
public
))
rule
=
Rule
(
direction
=
'1'
,
owner
=
self
.
owner
,
dport
=
public
,
proto
=
proto
,
nat
=
True
,
accept
=
True
,
r_type
=
"host"
,
nat_dport
=
private
,
host
=
host
,
foreign_network
=
VlanGroup
.
objects
.
get
(
name
=
settings
[
"default_vlangroup"
]))
rule
=
Rule
(
direction
=
'1'
,
owner
=
self
.
owner
,
dport
=
public
,
proto
=
proto
,
nat
=
True
,
accept
=
True
,
r_type
=
"host"
,
nat_dport
=
private
,
host
=
self
,
foreign_network
=
VlanGroup
.
objects
.
get
(
name
=
settings
[
"default_vlangroup"
]))
rule
.
full_clean
()
rule
.
save
()
...
...
firewall/views.py
View file @
f17f67ac
...
...
@@ -17,8 +17,6 @@ import sys
def
reload_firewall
(
request
):
if
request
.
user
.
is_authenticated
():
if
(
request
.
user
.
is_superuser
):
ipv4
=
firewall
()
return
HttpResponse
(
ipv4
.
show
())
html
=
u"Be vagy jelentkezve es admin is vagy, kedves
%
s!"
%
request
.
user
.
username
html
+=
"<br> 10 masodperc mulva ujratoltodik"
ReloadTask
.
delay
()
...
...
one/models.py
View file @
f17f67ac
...
...
@@ -183,7 +183,7 @@ class Network(models.Model):
cls
.
objects
.
exclude
(
id__in
=
l
)
.
delete
()
def
__unicode__
(
self
):
return
u"
%
s (vlan
%03
d)"
%
(
self
.
name
,
self
.
id
)
return
self
.
name
class
Meta
:
ordering
=
[
'name'
]
...
...
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