Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
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
c4631b07
authored
Oct 02, 2013
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall: remove Rule.r_type
parent
c1c44020
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
9 deletions
+12
-9
circle/firewall/admin.py
+1
-1
circle/firewall/migrations/0034_auto__del_field_rule_r_type.py
+0
-0
circle/firewall/models.py
+11
-7
circle/network/forms.py
+0
-1
No files found.
circle/firewall/admin.py
View file @
c4631b07
...
@@ -49,7 +49,7 @@ class RuleAdmin(admin.ModelAdmin):
...
@@ -49,7 +49,7 @@ class RuleAdmin(admin.ModelAdmin):
list_display
=
(
'r_type'
,
'color_desc'
,
'owner'
,
'extra'
,
'direction'
,
list_display
=
(
'r_type'
,
'color_desc'
,
'owner'
,
'extra'
,
'direction'
,
'accept'
,
'proto'
,
'sport'
,
'dport'
,
'nat'
,
'accept'
,
'proto'
,
'sport'
,
'dport'
,
'nat'
,
'nat_dport'
,
'used_in'
)
'nat_dport'
,
'used_in'
)
list_filter
=
(
'
r_type'
,
'
vlan'
,
'owner'
,
'direction'
,
'accept'
,
list_filter
=
(
'vlan'
,
'owner'
,
'direction'
,
'accept'
,
'proto'
,
'nat'
)
'proto'
,
'nat'
)
def
color_desc
(
self
,
instance
):
def
color_desc
(
self
,
instance
):
...
...
circle/firewall/migrations/0034_auto__del_field_rule_r_type.py
0 → 100644
View file @
c4631b07
This diff is collapsed.
Click to expand it.
circle/firewall/models.py
View file @
c4631b07
...
@@ -62,10 +62,6 @@ class Rule(models.Model):
...
@@ -62,10 +62,6 @@ class Rule(models.Model):
verbose_name
=
_
(
"owner"
),
verbose_name
=
_
(
"owner"
),
help_text
=
_
(
"The user responsible for "
help_text
=
_
(
"The user responsible for "
"this rule."
))
"this rule."
))
r_type
=
models
.
CharField
(
max_length
=
10
,
verbose_name
=
_
(
"Rule type"
),
choices
=
CHOICES_type
,
help_text
=
_
(
"The type of entity the rule "
"belongs to."
))
nat
=
models
.
BooleanField
(
default
=
False
,
verbose_name
=
_
(
"NAT"
),
nat
=
models
.
BooleanField
(
default
=
False
,
verbose_name
=
_
(
"NAT"
),
help_text
=
_
(
"If network address translation "
help_text
=
_
(
"If network address translation "
"shoud be done."
))
"shoud be done."
))
...
@@ -129,6 +125,15 @@ class Rule(models.Model):
...
@@ -129,6 +125,15 @@ class Rule(models.Model):
((
"dport=
%
s "
%
self
.
dport
)
if
self
.
dport
else
''
)),
((
"dport=
%
s "
%
self
.
dport
)
if
self
.
dport
else
''
)),
'desc'
:
self
.
description
}
'desc'
:
self
.
description
}
@property
def
r_type
(
self
):
fields
=
[
self
.
vlan
,
self
.
vlangroup
,
self
.
host
,
self
.
hostgroup
,
self
.
firewall
]
for
field
in
fields
:
if
field
is
not
None
:
return
field
.
__class__
.
__name__
.
lower
()
return
None
@models.permalink
@models.permalink
def
get_absolute_url
(
self
):
def
get_absolute_url
(
self
):
return
(
'network.rule'
,
None
,
{
'pk'
:
self
.
pk
})
return
(
'network.rule'
,
None
,
{
'pk'
:
self
.
pk
})
...
@@ -137,7 +142,6 @@ class Rule(models.Model):
...
@@ -137,7 +142,6 @@ class Rule(models.Model):
verbose_name
=
_
(
"rule"
)
verbose_name
=
_
(
"rule"
)
verbose_name_plural
=
_
(
"rules"
)
verbose_name_plural
=
_
(
"rules"
)
ordering
=
(
ordering
=
(
'r_type'
,
'direction'
,
'direction'
,
'proto'
,
'proto'
,
'sport'
,
'sport'
,
...
@@ -495,11 +499,11 @@ class Host(models.Model):
...
@@ -495,11 +499,11 @@ class Host(models.Model):
if
public
<
1024
:
if
public
<
1024
:
raise
ValidationError
(
_
(
"Only ports above 1024 can be used."
))
raise
ValidationError
(
_
(
"Only ports above 1024 can be used."
))
rule
=
Rule
(
direction
=
'1'
,
owner
=
self
.
owner
,
dport
=
public
,
rule
=
Rule
(
direction
=
'1'
,
owner
=
self
.
owner
,
dport
=
public
,
proto
=
proto
,
nat
=
True
,
accept
=
True
,
r_type
=
"host"
,
proto
=
proto
,
nat
=
True
,
accept
=
True
,
nat_dport
=
private
,
host
=
self
,
foreign_network
=
vg
)
nat_dport
=
private
,
host
=
self
,
foreign_network
=
vg
)
else
:
else
:
rule
=
Rule
(
direction
=
'1'
,
owner
=
self
.
owner
,
dport
=
public
,
rule
=
Rule
(
direction
=
'1'
,
owner
=
self
.
owner
,
dport
=
public
,
proto
=
proto
,
nat
=
False
,
accept
=
True
,
r_type
=
"host"
,
proto
=
proto
,
nat
=
False
,
accept
=
True
,
host
=
self
,
foreign_network
=
vg
)
host
=
self
,
foreign_network
=
vg
)
rule
.
full_clean
()
rule
.
full_clean
()
...
...
circle/network/forms.py
View file @
c4631b07
...
@@ -166,7 +166,6 @@ class RuleForm(ModelForm):
...
@@ -166,7 +166,6 @@ class RuleForm(ModelForm):
'extra'
,
'extra'
,
'accept'
,
'accept'
,
'owner'
,
'owner'
,
'r_type'
,
'nat'
,
'nat'
,
'nat_dport'
,
'nat_dport'
,
),
),
...
...
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