You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR allows users with file add access to upload product tracking files on Engagement, Test, and Finding objects without requiring full edit access to those objects.
The previous behavior reused generic related-object permissions where file upload POST requests were treated like object edits. That blocked reader-style users from attaching supporting evidence files. The fix separates file permissions from generic related-object permissions and uses the existing Product_Tracking_Files_* permission enum for API file endpoints.
The Engagement, Test, and Finding file actions now use these file-specific permission classes instead of the broader related-object permission classes.
For the classic UI manage_files page, the PR keeps edit users on the existing full manage formset, but gives add-only users a separate formset that can upload new files without exposing existing-file delete controls.
Reviewed & tested — approving (milestone 3.2.0, since this targets dev).
Validated against a running instance: the added/updated permission tests pass — unittests.test_permissions_audit.TestRelatedObjectPermissions runs 40 tests OK (17 skipped under the OS legacy auth model).
Review confirmed the permission split is correct and opens no hole: the new permission_map entries map GET→Product_Tracking_Files_View, PUT→_Edit, DELETE→_Delete, POST→_Add, matching check_object_permission's method dispatch exactly. In OS, View/Edit/Add collapse to plain membership, so behavior is preserved there; the granularity matters under Pro RBAC.
One note: the new add-only AddOnlyManageFileFormSet branch in manage_files isn't exercised by the in-repo tests (OS always takes the edit-formset path), so that path's delete-disabled/empty-queryset behavior relies on Pro-side RBAC config. Worth adding coverage, but not a merge blocker.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR allows users with file add access to upload product tracking files on Engagement, Test, and Finding objects without requiring full edit access to those objects.
The previous behavior reused generic related-object permissions where file upload POST requests were treated like object edits. That blocked reader-style users from attaching supporting evidence files. The fix separates file permissions from generic related-object permissions and uses the existing
Product_Tracking_Files_*permission enum for API file endpoints.The Engagement, Test, and Finding file actions now use these file-specific permission classes instead of the broader related-object permission classes.
For the classic UI
manage_filespage, the PR keeps edit users on the existing full manage formset, but gives add-only users a separate formset that can upload new files without exposing existing-file delete controls.Results:
staticfiles.W004warning for/app/components/node_modules.TestRelatedObjectPermissionspassed: 39 tests, 17 skipped.Documentation
Please update any documentation when needed in the documentation folder)
Checklist
This checklist is for your information.
dev.dev.bugfixbranch.