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
2e330597
authored
May 30, 2013
by
Bence Dányi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall_gui: authorization added
parent
c8025a95
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
firewall_gui/views.py
+11
-5
No files found.
firewall_gui/views.py
View file @
2e330597
...
...
@@ -10,6 +10,7 @@ def req_staff(user):
''' decorator function for user permission checking '''
return
user
.
is_staff
@user_passes_test
(
req_staff
)
def
index
(
request
):
return
render
(
request
,
'firewall/index.html'
)
...
...
@@ -167,7 +168,7 @@ def list_entities(request, name):
'ipv4'
]),
}[
name
](
request
)),
content_type
=
'application/json'
)
@user_passes_test
(
req_staff
)
def
show_rule
(
request
,
id
=
None
):
try
:
rule
=
Rule
.
objects
.
get
(
id
=
id
)
...
...
@@ -251,7 +252,7 @@ def show_rule(request, id=None):
}
return
HttpResponse
(
json
.
dumps
(
rule
),
content_type
=
'application/json'
)
@user_passes_test
(
req_staff
)
def
show_host
(
request
,
id
=
None
):
try
:
host
=
Host
.
objects
.
get
(
id
=
id
)
...
...
@@ -319,7 +320,7 @@ def show_host(request, id=None):
}
return
HttpResponse
(
json
.
dumps
(
host
),
content_type
=
'application/json'
)
@user_passes_test
(
req_staff
)
def
show_vlan
(
request
,
id
=
None
):
try
:
vlan
=
Vlan
.
objects
.
get
(
id
=
id
)
...
...
@@ -389,7 +390,7 @@ def show_vlan(request, id=None):
}
return
HttpResponse
(
json
.
dumps
(
vlan
),
content_type
=
'application/json'
)
@user_passes_test
(
req_staff
)
def
show_vlangroup
(
request
,
id
=
None
):
try
:
group
=
VlanGroup
.
objects
.
get
(
id
=
id
)
...
...
@@ -434,7 +435,7 @@ def show_vlangroup(request, id=None):
}
return
HttpResponse
(
json
.
dumps
(
group
),
content_type
=
'application/json'
)
@user_passes_test
(
req_staff
)
def
show_hostgroup
(
request
,
id
=
None
):
try
:
group
=
Group
.
objects
.
get
(
id
=
id
)
...
...
@@ -479,6 +480,8 @@ def show_hostgroup(request, id=None):
}
return
HttpResponse
(
json
.
dumps
(
group
),
content_type
=
'application/json'
)
@user_passes_test
(
req_staff
)
def
show_record
(
request
,
id
=
None
):
try
:
record
=
Record
.
objects
.
get
(
id
=
id
)
...
...
@@ -526,6 +529,8 @@ def show_record(request, id=None):
}
return
HttpResponse
(
json
.
dumps
(
record
),
content_type
=
'application/json'
)
@user_passes_test
(
req_staff
)
def
show_domain
(
request
,
id
=
None
):
try
:
domain
=
Domain
.
objects
.
get
(
id
=
id
)
...
...
@@ -566,6 +571,7 @@ def make_autocomplete(entity, name='name'):
return
autocomplete
@user_passes_test
(
req_staff
)
def
autocomplete
(
request
,
entity
):
try
:
return
{
...
...
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