Просмотр исходного кода

Fixes #5066: Update view_reportresult to view_report permission

Jeremy Stretch 5 лет назад
Родитель
Сommit
0a40418614

+ 3 - 1
docs/release-notes/version-2.9.md

@@ -4,6 +4,8 @@
 
 **NOTE:** This release removes support for the `DEFAULT_TIMEOUT` parameter under `REDIS` database configuration. Set `RQ_DEFAULT_TIMEOUT` as a global configuration parameter instead.
 
+**NOTE:** Any permissions referencing the legacy ReportResult model (e.g. `extras.view_reportresult`) should be updated to reference the Report model.
+
 ### Enhancements
 
 * [#1755](https://github.com/netbox-community/netbox/issues/1755) - Toggle order in which rack elevations are displayed
@@ -16,6 +18,7 @@
 ### Bug Fixes
 
 * [#5050](https://github.com/netbox-community/netbox/issues/5050) - Fix potential failure on `0016_replicate_interfaces` schema migration from old release
+* [#5066](https://github.com/netbox-community/netbox/issues/5066) - Update `view_reportresult` to `view_report` permission
 * [#5075](https://github.com/netbox-community/netbox/issues/5075) - Include a VLAN membership view for VM interfaces
 * [#5105](https://github.com/netbox-community/netbox/issues/5105) - Validation should fail when reassigning a primary IP from device to VM
 * [#5109](https://github.com/netbox-community/netbox/issues/5109) - Fix representation of custom choice field values for webhook data
@@ -24,7 +27,6 @@
 * [#5118](https://github.com/netbox-community/netbox/issues/5118) - Specifying an empty list of tags should clear assigned tags (REST API)
 * [#5133](https://github.com/netbox-community/netbox/issues/5133) - Fix disassociation of an IP address from a VM interface
 * [#5136](https://github.com/netbox-community/netbox/issues/5136) - Fix exception when bulk editing interface 802.1Q mode
-* [#5137](https://github.com/netbox-community/netbox/issues/5137) - Correct permission for viewing report results is `extras.view_reportresult` (not `extras.view_report`)
 * [#5156](https://github.com/netbox-community/netbox/issues/5156) - Add missing "add" button to rack reservations list
 * [#5167](https://github.com/netbox-community/netbox/issues/5167) - Support filtering ObjectChanges by multiple users
 

+ 1 - 1
netbox/extras/management/commands/runreport.py

@@ -25,7 +25,7 @@ class Command(BaseCommand):
             for report in report_list:
                 if module_name in options['reports'] or report.full_name in options['reports']:
 
-                    # Run the report and create a new ReportResult
+                    # Run the report and create a new JobResult
                     self.stdout.write(
                         "[{:%H:%M:%S}] Running {}...".format(timezone.now(), report.full_name)
                     )

+ 3 - 3
netbox/extras/views.py

@@ -315,7 +315,7 @@ class ReportListView(ContentTypePermissionRequiredMixin, View):
     Retrieve all of the available reports from disk and the recorded JobResult (if any) for each.
     """
     def get_required_permission(self):
-        return 'extras.view_reportresult'
+        return 'extras.view_report'
 
     def get(self, request):
 
@@ -347,7 +347,7 @@ class ReportView(ContentTypePermissionRequiredMixin, View):
     Display a single Report and its associated JobResult (if any).
     """
     def get_required_permission(self):
-        return 'extras.view_reportresult'
+        return 'extras.view_report'
 
     def get(self, request, module, name):
 
@@ -401,7 +401,7 @@ class ReportResultView(ContentTypePermissionRequiredMixin, View):
     Display a JobResult pertaining to the execution of a Report.
     """
     def get_required_permission(self):
-        return 'extras.view_reportresult'
+        return 'extras.view_report'
 
     def get(self, request, job_result_pk):
         report_content_type = ContentType.objects.get(app_label='extras', model='report')

+ 2 - 2
netbox/templates/home.html

@@ -276,7 +276,7 @@
             <div class="panel-heading">
                 <strong>Reports</strong>
             </div>
-            {% if report_results and perms.extras.view_reportresult %}
+            {% if report_results and perms.extras.view_report %}
                 <table class="table table-hover panel-body">
                     {% for result in report_results %}
                         <tr>
@@ -285,7 +285,7 @@
                         </tr>
                     {% endfor %}
                 </table>
-            {% elif perms.extras.view_reportresult %}
+            {% elif perms.extras.view_report %}
                 <div class="panel-body text-muted">
                     None found
                 </div>

+ 1 - 1
netbox/templates/inc/nav_menu.html

@@ -518,7 +518,7 @@
                         <li{% if not perms.extras.view_script %} class="disabled"{% endif %}>
                             <a href="{% url 'extras:script_list' %}">Scripts</a>
                         </li>
-                        <li{% if not perms.extras.view_reportresult %} class="disabled"{% endif %}>
+                        <li{% if not perms.extras.view_report %} class="disabled"{% endif %}>
                             <a href="{% url 'extras:report_list' %}">Reports</a>
                         </li>
                     </ul>