Commit 75424a61 authored by Med's avatar Med

Nettoie la conf settings

parent 1b2023fc
...@@ -150,4 +150,3 @@ PAGINATION_NUMBER = 25 ...@@ -150,4 +150,3 @@ PAGINATION_NUMBER = 25
PAGINATION_LARGE_NUMBER = 8 PAGINATION_LARGE_NUMBER = 8
GENERIC_IPSET_COMMAND = "/sbin/ipset -q "
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
from django.shortcuts import redirect
from med.settings import AUTHORIZED_IP_RANGE, AUTHORIZED_IP6_RANGE from med.settings import AUTHORIZED_IP_RANGE, AUTHORIZED_IP6_RANGE
import ipaddress import ipaddress
...@@ -34,7 +35,7 @@ def user_is_in_campus(function): ...@@ -34,7 +35,7 @@ def user_is_in_campus(function):
if not request.user.is_authenticated: if not request.user.is_authenticated:
remote_ip = get_ip(request) remote_ip = get_ip(request)
if not ipaddress.ip_address(remote_ip) in ipaddress.ip_network(AUTHORIZED_IP_RANGE) and not ipaddress.ip_address(remote_ip) in ipaddress.ip_network(AUTHORIZED_IP6_RANGE): if not ipaddress.ip_address(remote_ip) in ipaddress.ip_network(AUTHORIZED_IP_RANGE) and not ipaddress.ip_address(remote_ip) in ipaddress.ip_network(AUTHORIZED_IP6_RANGE):
raise PermissionDenied return redirect("/")
return function(request, *args, **kwargs) return function(request, *args, **kwargs)
wrap.__doc__ = function.__doc__ wrap.__doc__ = function.__doc__
wrap.__name__ = function.__name__ wrap.__name__ = function.__name__
......
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 to comment