From 400fa8ed5f65c4b230029a61d90e5e3330e64625 Mon Sep 17 00:00:00 2001 From: Arthur Date: Tue, 31 Mar 2026 08:12:10 -0700 Subject: [PATCH] change to ScriptModule --- netbox/netbox/authentication/__init__.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/netbox/netbox/authentication/__init__.py b/netbox/netbox/authentication/__init__.py index b41a1d3ea..19b1e58ca 100644 --- a/netbox/netbox/authentication/__init__.py +++ b/netbox/netbox/authentication/__init__.py @@ -1,7 +1,6 @@ import logging from collections import defaultdict -from django.apps import apps from django.conf import settings from django.contrib.auth.backends import ModelBackend from django.contrib.auth.backends import RemoteUserBackend as _RemoteUserBackend @@ -138,14 +137,12 @@ class ObjectPermissionMixin: if obj is None: return True - # Sanity check: Ensure that the requested permission applies to the specified object. - # Also accept permissions for proxy models whose concrete model matches the object's. + # Sanity check: Ensure that the requested permission applies to the specified object model = obj._meta.concrete_model if model._meta.label_lower != '.'.join((app_label, model_name)): - if apps.get_model(app_label, model_name)._meta.concrete_model != model: - raise ValueError(_("Invalid permission {permission} for model {model}").format( - permission=perm, model=model - )) + raise ValueError(_("Invalid permission {permission} for model {model}").format( + permission=perm, model=model + )) # Compile a QuerySet filter that matches all instances of the specified model tokens = {