Commit d33f2aeb by Bence Dányi

firewall_gui: permission checking added

parent 298e85b1
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']:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment