Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions netbox/extras/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,12 @@ def post(self, request, pk):
"""
Run a Script identified by its numeric PK or module & name and return the pending Job as the result
"""
if not request.user.has_perm('extras.run_script'):
raise PermissionDenied("This user does not have permission to run scripts.")

script = self._get_script(pk)

if not request.user.has_perm('extras.run_script', obj=script):
raise PermissionDenied("This user does not have permission to run this script.")

input_serializer = serializers.ScriptInputSerializer(
data=request.data,
context={'script': script}
Expand Down
Loading