Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
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
90a22a2f
authored
May 22, 2013
by
Bence Dányi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall_gui: delete entities
parent
95b82bbb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
cloud/urls.py
+10
-0
firewall_gui/views.py
+16
-0
No files found.
cloud/urls.py
View file @
90a22a2f
...
...
@@ -114,4 +114,14 @@ urlpatterns = patterns('',
url
(
r'^firewall/hostgroups/save/$'
,
'firewall_gui.views.save_hostgroup'
),
url
(
r'^firewall/domains/save/$'
,
'firewall_gui.views.save_domain'
),
url
(
r'^firewall/records/save/$'
,
'firewall_gui.views.save_record'
),
url
(
r'^firewall/(?P<name>\w+)/(?P<id>\d+)/delete/'
,
'firewall_gui.views.delete_entity'
),
url
(
r'^firewall/rules/new/$'
,
'firewall_gui.views.show_rule'
),
# url(r'^firewall/hosts/save/$', 'firewall_gui.views.save_host'),
# url(r'^firewall/vlans/save/$', 'firewall_gui.views.save_vlan'),
# url(r'^firewall/vlangroups/save/$', 'firewall_gui.views.save_vlangroup'),
# url(r'^firewall/hostgroups/save/$', 'firewall_gui.views.save_hostgroup'),
# url(r'^firewall/domains/save/$', 'firewall_gui.views.save_domain'),
# url(r'^firewall/records/save/$', 'firewall_gui.views.save_record'),
)
firewall_gui/views.py
View file @
90a22a2f
...
...
@@ -661,3 +661,19 @@ def save_record(request):
return
HttpResponse
(
json
.
dumps
(
errors
),
content_type
=
'application/json'
,
status
=
400
)
record
.
save
()
return
HttpResponse
(
'KTHXBYE'
)
@user_passes_test
(
req_staff
)
def
delete_entity
(
request
,
name
,
id
):
model
=
{
'rules'
:
Rule
,
'hosts'
:
Host
,
'hostgroups'
:
Group
,
'vlans'
:
Vlan
,
'vlangroups'
:
VlanGroup
,
'firewalls'
:
Firewall
,
'domains'
:
Domain
,
'records'
:
Record
,
'blacklists'
:
Blacklist
}[
name
]
model
.
objects
.
get
(
id
=
id
)
.
delete
()
return
HttpResponse
(
'KTHXBYE'
)
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