Add more execution controll of reports #2223

Closed
opened 2025-12-29 17:23:52 +01:00 by adam · 4 comments
Owner

Originally created by @Grokzen on GitHub (Dec 18, 2018).

Environment

  • Python version: 2.4.8
  • NetBox version: 3.6.x

Proposed Functionality

I want to extend the Report class and functionality to include options and controll to decide from what source i can execute each report. Right now there is 3 execution paths defined in the docs, through the UI, through the API and from command line. This feature should enable the user/developer of a report class to have controll of what execution paths is available.

It might only be needed that we can controll the execution through the UI and API. The CLI path probably have no need for this controll flow.

Use Case

If you have a report that does some really heavy lifting/processing to run, we do not want to have any user start a report run at any given time and have multiple reports running at the same time that would consume a lot of system resources. In this case we probably would like to deploy a crontab job on the server and run the report through the cli option at given intervals and only let the user view the latest report run. One solution would be to restrict what user could run or not run reports, but the problem is that it inlcudes or excludes the ability to run any report in the system.

Questions that needs answer

  1. How the report should behave (error codes and messages) when executed through the API but is blocked
  2. Should configuration of this be done on the class instance or in another place.

Database Changes

If done as properties on the report class instance itself then there is no need for DB changes.

Originally created by @Grokzen on GitHub (Dec 18, 2018). <!-- NOTE: This form is only for proposing specific new features or enhancements. If you have a general idea or question, please post to our mailing list instead of opening an issue: https://groups.google.com/forum/#!forum/netbox-discuss NOTE: Due to an excessive backlog of feature requests, we are not currently accepting any proposals which significantly extend NetBox's feature scope. Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report. --> ### Environment * Python version: 2.4.8 <!-- Example: 3.5.4 --> * NetBox version: 3.6.x <!-- Example: 2.3.6 --> <!-- Describe in detail the new functionality you are proposing. Include any specific changes to work flows, data models, or the user interface. --> ### Proposed Functionality I want to extend the Report class and functionality to include options and controll to decide from what source i can execute each report. Right now there is 3 execution paths defined in the docs, through the UI, through the API and from command line. This feature should enable the user/developer of a report class to have controll of what execution paths is available. It might only be needed that we can controll the execution through the UI and API. The CLI path probably have no need for this controll flow. <!-- Convey an example use case for your proposed feature. Write from the perspective of a NetBox user who would benefit from the proposed functionality and describe how. ---> ### Use Case If you have a report that does some really heavy lifting/processing to run, we do not want to have any user start a report run at any given time and have multiple reports running at the same time that would consume a lot of system resources. In this case we probably would like to deploy a crontab job on the server and run the report through the cli option at given intervals and only let the user view the latest report run. One solution would be to restrict what user could run or not run reports, but the problem is that it inlcudes or excludes the ability to run any report in the system. ### Questions that needs answer 1. How the report should behave (error codes and messages) when executed through the API but is blocked 2. Should configuration of this be done on the class instance or in another place. <!-- Note any changes to the database schema necessary to support the new feature. For example, does the proposal require adding a new model or field? (Not all new features require database changes.) ---> ### Database Changes If done as properties on the report class instance itself then there is no need for DB changes.
adam closed this issue 2025-12-29 17:23:52 +01:00
Author
Owner

@jeremystretch commented on GitHub (Dec 19, 2018):

I don't understand what you're asking for. Could you please state exactly what change you're proposing?

@jeremystretch commented on GitHub (Dec 19, 2018): I don't understand what you're asking for. Could you please state exactly what change you're proposing?
Author
Owner

@Grokzen commented on GitHub (Dec 19, 2018):

Hmm, i will try.

Basically i would want some kind of way to disable the possibility to start/run a specific report from either the GUI, through the API, or both.

The crontab example is probably the easiest to explain. We have a report, we want it to run at midnight for example. We deploy a crontab job on the server to run at that time. What we want is to block is that a user can start the same report from the GUI or through the API.

We can't just remove the permission to run reports as they need to be able to run other rpeorts.

@Grokzen commented on GitHub (Dec 19, 2018): Hmm, i will try. Basically i would want some kind of way to disable the possibility to start/run a specific report from either the GUI, through the API, or both. The crontab example is probably the easiest to explain. We have a report, we want it to run at midnight for example. We deploy a crontab job on the server to run at that time. What we want is to block is that a user can start the same report from the GUI or through the API. We can't just remove the permission to run reports as they need to be able to run other rpeorts.
Author
Owner

@Grokzen commented on GitHub (Dec 19, 2018):

In code terms, think something like this, but with way better variable names

from extras.reports import Report


class DeviceConnectionsReport(Report):
    description = "..."
    allow_execute_api = False
    allow_execute_gui = False
@Grokzen commented on GitHub (Dec 19, 2018): In code terms, think something like this, but with way better variable names ``` from extras.reports import Report class DeviceConnectionsReport(Report): description = "..." allow_execute_api = False allow_execute_gui = False ```
Author
Owner

@jeremystretch commented on GitHub (Dec 20, 2018):

The API and GUI are intended to maintain parity with one another. We won't take any action to intentionally inhibit access via one or the other.

Regarding access to individual reports, this would be a function of object-oriented permissions. This would fall under #554.

@jeremystretch commented on GitHub (Dec 20, 2018): The API and GUI are intended to maintain parity with one another. We won't take any action to intentionally inhibit access via one or the other. Regarding access to individual reports, this would be a function of object-oriented permissions. This would fall under #554.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2223