mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-23 09:18:49 +02:00
change to ScriptModule
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import logging
|
import logging
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
from django.apps import apps
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.backends import ModelBackend
|
from django.contrib.auth.backends import ModelBackend
|
||||||
from django.contrib.auth.backends import RemoteUserBackend as _RemoteUserBackend
|
from django.contrib.auth.backends import RemoteUserBackend as _RemoteUserBackend
|
||||||
@@ -138,14 +137,12 @@ class ObjectPermissionMixin:
|
|||||||
if obj is None:
|
if obj is None:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# Sanity check: Ensure that the requested permission applies to the specified object.
|
# 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.
|
|
||||||
model = obj._meta.concrete_model
|
model = obj._meta.concrete_model
|
||||||
if model._meta.label_lower != '.'.join((app_label, model_name)):
|
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(
|
||||||
raise ValueError(_("Invalid permission {permission} for model {model}").format(
|
permission=perm, model=model
|
||||||
permission=perm, model=model
|
))
|
||||||
))
|
|
||||||
|
|
||||||
# Compile a QuerySet filter that matches all instances of the specified model
|
# Compile a QuerySet filter that matches all instances of the specified model
|
||||||
tokens = {
|
tokens = {
|
||||||
|
|||||||
Reference in New Issue
Block a user