mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-06 01:46:27 +00:00
linter
This commit is contained in:
parent
f70b97677f
commit
a234be0981
2 changed files with 18 additions and 19 deletions
|
@ -240,7 +240,9 @@ class AutodetectACLPermission(permissions.BasePermission):
|
||||||
if getattr(view, "_ignore_model_permissions", False):
|
if getattr(view, "_ignore_model_permissions", False):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if not getattr(view, "queryset", None):
|
# Bypass permission verifications if it is a functional view
|
||||||
|
# (permissions are handled by ACL)
|
||||||
|
if not hasattr(view, "queryset") and not hasattr(view, "get_queryset"):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if not request.user or not request.user.is_authenticated:
|
if not request.user or not request.user.is_authenticated:
|
||||||
|
@ -277,8 +279,7 @@ class AutodetectACLPermission(permissions.BasePermission):
|
||||||
# they have read permissions to see 403, or not, and simply see
|
# they have read permissions to see 403, or not, and simply see
|
||||||
# a 404 response.
|
# a 404 response.
|
||||||
|
|
||||||
SAFE_METHODS = ("GET", "OPTIONS", "HEAD",
|
SAFE_METHODS = ("GET", "OPTIONS", "HEAD", "POST", "PUT", "PATCH", "DELETE")
|
||||||
"POST", "PUT", "PATCH", "DELETE")
|
|
||||||
|
|
||||||
if request.method in SAFE_METHODS:
|
if request.method in SAFE_METHODS:
|
||||||
# Read permissions already checked and failed, no need
|
# Read permissions already checked and failed, no need
|
||||||
|
|
|
@ -34,12 +34,12 @@ https://github.com/FreeRADIUS/freeradius-server/blob/master/src/modules/rlm_pyth
|
||||||
Inspired by Daniel Stan in Crans
|
Inspired by Daniel Stan in Crans
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import logging
|
|
||||||
import traceback
|
import traceback
|
||||||
import radiusd # Magic module freeradius (radiusd.py is dummy)
|
|
||||||
|
|
||||||
|
import radiusd # Magic module freeradius (radiusd.py is dummy)
|
||||||
from django.core.wsgi import get_wsgi_application
|
from django.core.wsgi import get_wsgi_application
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
|
@ -54,11 +54,10 @@ os.chdir(proj_path)
|
||||||
# This is so models get loaded.
|
# This is so models get loaded.
|
||||||
application = get_wsgi_application()
|
application = get_wsgi_application()
|
||||||
|
|
||||||
from machines.models import Interface, IpList, Nas, Domain
|
from machines.models import Domain, Interface, IpList, Nas
|
||||||
|
from preferences.models import RadiusOption
|
||||||
from topologie.models import Port, Switch
|
from topologie.models import Port, Switch
|
||||||
from users.models import User
|
from users.models import User
|
||||||
from preferences.models import RadiusOption
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
|
@ -162,8 +161,7 @@ def authorize(data):
|
||||||
|
|
||||||
@radius_event
|
@radius_event
|
||||||
def post_auth(data):
|
def post_auth(data):
|
||||||
""" Function called after the user is authenticated
|
""" Function called after the user is authenticated"""
|
||||||
"""
|
|
||||||
|
|
||||||
nas = data.get("NAS-IP-Address", data.get("NAS-Identifier", None))
|
nas = data.get("NAS-IP-Address", data.get("NAS-Identifier", None))
|
||||||
nas_instance = find_nas_from_request(nas)
|
nas_instance = find_nas_from_request(nas)
|
||||||
|
|
Loading…
Reference in a new issue