mirror of
https://gitlab.crans.org/mediatek/med.git
synced 2024-11-26 20:47:10 +00:00
Nettoie la conf settings
This commit is contained in:
parent
1b2023fca8
commit
75424a6108
@ -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 @@
|
|||||||
|
|
||||||
|
|
||||||
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):
|
|||||||
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__
|
||||||
|
Loading…
Reference in New Issue
Block a user