mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-17 04:58:16 -06:00
14438 add permissions
This commit is contained in:
parent
4733376867
commit
1060ff8b2a
@ -51,6 +51,8 @@ class Script(EventRulesMixin, JobsMixin):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
objects = RestrictedQuerySet.as_manager()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ('module', 'name')
|
ordering = ('module', 'name')
|
||||||
constraints = (
|
constraints = (
|
||||||
|
@ -1042,15 +1042,12 @@ def get_script_module(module, request):
|
|||||||
return get_object_or_404(ScriptModule.objects.restrict(request.user), file_path__regex=f"^{module}\\.")
|
return get_object_or_404(ScriptModule.objects.restrict(request.user), file_path__regex=f"^{module}\\.")
|
||||||
|
|
||||||
|
|
||||||
class BaseScriptView(ContentTypePermissionRequiredMixin, generic.ObjectView):
|
class BaseScriptView(generic.ObjectView):
|
||||||
queryset = Script.objects.all()
|
queryset = Script.objects.all()
|
||||||
script = None
|
script = None
|
||||||
script_class = None
|
script_class = None
|
||||||
jobs = None
|
jobs = None
|
||||||
|
|
||||||
def get_required_permission(self):
|
|
||||||
return 'extras.view_script'
|
|
||||||
|
|
||||||
def _init_vars(self, request):
|
def _init_vars(self, request):
|
||||||
if self.script.python_class:
|
if self.script.python_class:
|
||||||
self.script_class = self.script.python_class()
|
self.script_class = self.script.python_class()
|
||||||
|
Loading…
Reference in New Issue
Block a user