Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
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
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
Show 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):
...
@@ -10,6 +10,7 @@ def req_staff(user):
''' decorator function for user permission checking '''
''' decorator function for user permission checking '''
return
user
.
is_staff
return
user
.
is_staff
@user_passes_test
(
req_staff
)
def
index
(
request
):
def
index
(
request
):
return
render
(
request
,
'firewall/index.html'
)
return
render
(
request
,
'firewall/index.html'
)
...
@@ -167,7 +168,7 @@ def list_entities(request, name):
...
@@ -167,7 +168,7 @@ def list_entities(request, name):
'ipv4'
]),
'ipv4'
]),
}[
name
](
request
)),
content_type
=
'application/json'
)
}[
name
](
request
)),
content_type
=
'application/json'
)
@user_passes_test
(
req_staff
)
def
show_rule
(
request
,
id
=
None
):
def
show_rule
(
request
,
id
=
None
):
try
:
try
:
rule
=
Rule
.
objects
.
get
(
id
=
id
)
rule
=
Rule
.
objects
.
get
(
id
=
id
)
...
@@ -251,7 +252,7 @@ def show_rule(request, id=None):
...
@@ -251,7 +252,7 @@ def show_rule(request, id=None):
}
}
return
HttpResponse
(
json
.
dumps
(
rule
),
content_type
=
'application/json'
)
return
HttpResponse
(
json
.
dumps
(
rule
),
content_type
=
'application/json'
)
@user_passes_test
(
req_staff
)
def
show_host
(
request
,
id
=
None
):
def
show_host
(
request
,
id
=
None
):
try
:
try
:
host
=
Host
.
objects
.
get
(
id
=
id
)
host
=
Host
.
objects
.
get
(
id
=
id
)
...
@@ -319,7 +320,7 @@ def show_host(request, id=None):
...
@@ -319,7 +320,7 @@ def show_host(request, id=None):
}
}
return
HttpResponse
(
json
.
dumps
(
host
),
content_type
=
'application/json'
)
return
HttpResponse
(
json
.
dumps
(
host
),
content_type
=
'application/json'
)
@user_passes_test
(
req_staff
)
def
show_vlan
(
request
,
id
=
None
):
def
show_vlan
(
request
,
id
=
None
):
try
:
try
:
vlan
=
Vlan
.
objects
.
get
(
id
=
id
)
vlan
=
Vlan
.
objects
.
get
(
id
=
id
)
...
@@ -389,7 +390,7 @@ def show_vlan(request, id=None):
...
@@ -389,7 +390,7 @@ def show_vlan(request, id=None):
}
}
return
HttpResponse
(
json
.
dumps
(
vlan
),
content_type
=
'application/json'
)
return
HttpResponse
(
json
.
dumps
(
vlan
),
content_type
=
'application/json'
)
@user_passes_test
(
req_staff
)
def
show_vlangroup
(
request
,
id
=
None
):
def
show_vlangroup
(
request
,
id
=
None
):
try
:
try
:
group
=
VlanGroup
.
objects
.
get
(
id
=
id
)
group
=
VlanGroup
.
objects
.
get
(
id
=
id
)
...
@@ -434,7 +435,7 @@ def show_vlangroup(request, id=None):
...
@@ -434,7 +435,7 @@ def show_vlangroup(request, id=None):
}
}
return
HttpResponse
(
json
.
dumps
(
group
),
content_type
=
'application/json'
)
return
HttpResponse
(
json
.
dumps
(
group
),
content_type
=
'application/json'
)
@user_passes_test
(
req_staff
)
def
show_hostgroup
(
request
,
id
=
None
):
def
show_hostgroup
(
request
,
id
=
None
):
try
:
try
:
group
=
Group
.
objects
.
get
(
id
=
id
)
group
=
Group
.
objects
.
get
(
id
=
id
)
...
@@ -479,6 +480,8 @@ def show_hostgroup(request, id=None):
...
@@ -479,6 +480,8 @@ def show_hostgroup(request, id=None):
}
}
return
HttpResponse
(
json
.
dumps
(
group
),
content_type
=
'application/json'
)
return
HttpResponse
(
json
.
dumps
(
group
),
content_type
=
'application/json'
)
@user_passes_test
(
req_staff
)
def
show_record
(
request
,
id
=
None
):
def
show_record
(
request
,
id
=
None
):
try
:
try
:
record
=
Record
.
objects
.
get
(
id
=
id
)
record
=
Record
.
objects
.
get
(
id
=
id
)
...
@@ -526,6 +529,8 @@ def show_record(request, id=None):
...
@@ -526,6 +529,8 @@ def show_record(request, id=None):
}
}
return
HttpResponse
(
json
.
dumps
(
record
),
content_type
=
'application/json'
)
return
HttpResponse
(
json
.
dumps
(
record
),
content_type
=
'application/json'
)
@user_passes_test
(
req_staff
)
def
show_domain
(
request
,
id
=
None
):
def
show_domain
(
request
,
id
=
None
):
try
:
try
:
domain
=
Domain
.
objects
.
get
(
id
=
id
)
domain
=
Domain
.
objects
.
get
(
id
=
id
)
...
@@ -566,6 +571,7 @@ def make_autocomplete(entity, name='name'):
...
@@ -566,6 +571,7 @@ def make_autocomplete(entity, name='name'):
return
autocomplete
return
autocomplete
@user_passes_test
(
req_staff
)
def
autocomplete
(
request
,
entity
):
def
autocomplete
(
request
,
entity
):
try
:
try
:
return
{
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