Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server error when creating permission constraints for extras > script #15174

Closed
julianstolp opened this issue Feb 16, 2024 · 1 comment · Fixed by #15202
Closed

Server error when creating permission constraints for extras > script #15174

julianstolp opened this issue Feb 16, 2024 · 1 comment · Fixed by #15202
Assignees
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@julianstolp
Copy link

julianstolp commented Feb 16, 2024

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 julianstolp added the type: bug A confirmed report of unexpected behavior in the application label Feb 16, 2024
@julianstolp julianstolp changed the title Server error when creating permission constraints for Extras > Script Server error when creating permission constraints for extras > script Feb 16, 2024
@jeremystretch
Copy link
Member

This is not currently supported as reports and scripts don't map to actual database objects. However, this is changing in NetBox v4.0 (see #14438). In the interim, we could simply disable constraints for permissions targeting reports or scripts.

@jeremystretch jeremystretch added status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation severity: low Does not significantly disrupt application functionality, or a workaround is available labels Feb 20, 2024
@abhi1693 abhi1693 self-assigned this Feb 20, 2024
@abhi1693 abhi1693 added status: accepted This issue has been accepted for implementation and removed status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation labels Feb 20, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants