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
d33f2aeb
authored
May 13, 2013
by
Bence Dányi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall_gui: permission checking added
parent
298e85b1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
firewall_gui/views.py
+4
-0
No files found.
firewall_gui/views.py
View file @
d33f2aeb
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
django.shortcuts
import
render
,
get_object_or_404
from
django.shortcuts
import
render
,
get_object_or_404
from
django.contrib.auth.decorators
import
user_passes_test
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
from
firewall.fw
import
*
from
firewall.fw
import
*
from
firewall.models
import
*
from
firewall.models
import
*
def
req_staff
(
user
):
return
user
.
is_staff
def
index
(
request
):
def
index
(
request
):
return
render
(
request
,
'firewall/index.html'
)
return
render
(
request
,
'firewall/index.html'
)
...
@@ -387,6 +390,7 @@ def set_field(object, attr, errors, **kwargs):
...
@@ -387,6 +390,7 @@ def set_field(object, attr, errors, **kwargs):
'name'
:
kwargs
.
values
()[
0
]
'name'
:
kwargs
.
values
()[
0
]
}
}
@user_passes_test
(
req_staff
)
def
save_rule
(
request
):
def
save_rule
(
request
):
data
=
json
.
loads
(
request
.
body
)
data
=
json
.
loads
(
request
.
body
)
if
data
[
'id'
]:
if
data
[
'id'
]:
...
...
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