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

Permission Constraints Not Accepting Script IDs #13107

Closed
theMachineMasse opened this issue Jul 6, 2023 · 1 comment
Closed

Permission Constraints Not Accepting Script IDs #13107

theMachineMasse opened this issue Jul 6, 2023 · 1 comment

Comments

@theMachineMasse
Copy link

NetBox version

v.3.5.4

Python version

3.8

Steps to Reproduce

  1. When modifying or creating a Permission for a User in the Admin menu, I have set the first few fields as such:
    image

  2. I select the Group or User I want to apply the Permission to.

  3. For the constraints, I set the field to {"id": "equipment-creation.SatelliteCreationScript"} given the following script
    image

  4. I hit the Save button to save the permission

Expected Behavior

The permission should save, making it so the User or Group only has access to run this particular script given the provided constraints.

Observed Behavior

A server error occurs: Field 'id' expected a number but got 'equipment-creation.SatelliteCreationScript'.

The expectation that the id must be a number is contradictory to the documentation and return result of the API endpoint extra_scripts_list GET. The top right part of the image that shows the script in the Steps to Reproduce indicates the ID is a string. This is further backed by doing the extract_scripts_list call, which returns the following:
image
As can be seen, the ID is a string not a number.

@theMachineMasse theMachineMasse added the type: bug A confirmed report of unexpected behavior in the application label Jul 6, 2023
@kkthxbye-code
Copy link
Contributor

Script is not a real model, and as such permission constraints do not work on it, because permission constraints are pretty much just QuerySet filters. However you might be able to do something with Core -> ManagedFile, either with the ìd` field (numeric) or the file path field.

This is not a bug, and while it's probably not going to change, the right way to change it would be a feature request and not a bug report.

@kkthxbye-code kkthxbye-code closed this as not planned Won't fix, can't repro, duplicate, stale Jul 7, 2023
@kkthxbye-code kkthxbye-code removed the type: bug A confirmed report of unexpected behavior in the application label Jul 7, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants