netbox icon indicating copy to clipboard operation
netbox copied to clipboard

Server error when creating permission constraints for extras > script

Open julianstolp opened this issue 1 year ago • 0 comments

Deployment Type

Self-hosted

NetBox Version

v3.7.2

Python Version

3.10

Steps to Reproduce

  1. Create Script
from extras.scripts import *
class TestScript(Script):

    class Meta:
        name = "TestScript"
        description = "Just for testing"

    def run(self, data, commit):
        return "Test"

API-View: image

  1. Go to /users/permissions/add/ and create a viewing permission for Extras > Script with the following constraint. Keep in mind Choices are: id only
  2. We are creating two seperate errors so two constraints needed
    • First: {"id": "test.TestScript"} -> Got id from /api/extras/scripts/test.TestScript/
    • Second: {"id": 1} -> Just a number, because first error said a number is expected

The goal was to create a permission for a group to see only a selected script.

Expected Behavior

One of the constraints should work and create a permission to see the selected script.

Observed Behavior

  1. Constraint {"id": "test.TestScript"} image
  2. Constraint {"id": 1} image

julianstolp avatar Feb 16 '24 14:02 julianstolp