mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-25 08:46:10 -06:00
Use RestrictedQuerySet for ConfigRevision
This commit is contained in:
parent
8658bfc934
commit
85657918ed
@ -612,6 +612,8 @@ class ConfigRevision(models.Model):
|
||||
verbose_name='Configuration data'
|
||||
)
|
||||
|
||||
objects = RestrictedQuerySet.as_manager()
|
||||
|
||||
class Meta:
|
||||
ordering = ['-created']
|
||||
|
||||
|
@ -5,7 +5,6 @@ from django.urls.exceptions import NoReverseMatch
|
||||
|
||||
from netbox.registry import registry
|
||||
from .permissions import resolve_permission
|
||||
from .querysets import RestrictedQuerySet
|
||||
|
||||
__all__ = (
|
||||
'ContentTypePermissionRequiredMixin',
|
||||
@ -79,9 +78,8 @@ class ObjectPermissionRequiredMixin(AccessMixin):
|
||||
if user.has_perms((permission_required, *self.additional_permissions)):
|
||||
|
||||
# Update the view's QuerySet to filter only the permitted objects
|
||||
if isinstance(self.queryset, RestrictedQuerySet):
|
||||
action = resolve_permission(permission_required)[1]
|
||||
self.queryset = self.queryset.restrict(user, action)
|
||||
action = resolve_permission(permission_required)[1]
|
||||
self.queryset = self.queryset.restrict(user, action)
|
||||
|
||||
return True
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user