[FIX] dms: allow unarchiving DMS files for non-superusers#471
Open
[FIX] dms: allow unarchiving DMS files for non-superusers#471
Conversation
The _check_access_dms_record method uses self.search(domain) to verify write permissions. However, search() applies active_test=True by default, which excludes archived records (active=False). This means when a user tries to unarchive a file via toggle_active(), the write permission check cannot find the archived record in the search results, causing an AccessError even when the user has full write permissions through DMS access groups. Fix: add active_test=False context to include archived records in the permission check search.
8f3a708 to
86cc746
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixed a bug where non-superuser users cannot unarchive DMS files even when they have full write permissions through DMS access groups.
Root Cause
_check_access_dms_record()indms_security_mixin.pyusesself.search(domain)to verify write permissions. By default,search()appliesactive_test=True, which excludes archived records (active=False).When a user tries to unarchive a file via
toggle_active():_check_access_dms_record()search()filters out archived records → file not foundFix
Add
active_test=Falsecontext to the search in_check_access_dms_record()so archived records are included in the permission check.Steps to reproduce
Testing
self.env.su)