From 9777f25b9f185bcc80bb03503a03999712dae0dd Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Fri, 26 Jun 2020 11:57:07 -0400 Subject: [PATCH] Set the default action to 'view' for restrict() --- netbox/utilities/querysets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netbox/utilities/querysets.py b/netbox/utilities/querysets.py index 04bc4c542..5a867c04d 100644 --- a/netbox/utilities/querysets.py +++ b/netbox/utilities/querysets.py @@ -59,13 +59,13 @@ class RestrictedQuerySet(QuerySet): self.allow_evaluation = True return self - def restrict(self, user, action): + def restrict(self, user, action='view'): """ Filter the QuerySet to return only objects on which the specified user has been granted the specified permission. :param user: User instance - :param action: The action which must be permitted (e.g. "view" for "dcim.view_site") + :param action: The action which must be permitted (e.g. "view" for "dcim.view_site"); default is 'view' """ # Resolve the full name of the required permission app_label = self.model._meta.app_label