Skip to content

Commit d828285

Browse files
shagab99dnplkndll
authored andcommitted
[FIX] dms: allow unarchiving DMS files for non-superusers
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.
1 parent fca5466 commit d828285

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

dms/models/dms_security_mixin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def _check_access_dms_record(self, operation: str) -> tuple | None:
282282
if any(self._ids) and not self.env.su:
283283
Rule = self.env["ir.rule"]
284284
domain = Rule._compute_domain(self._name, operation)
285-
items = self.search(domain)
285+
items = self.with_context(active_test=False).search(domain)
286286
if any(x_id not in items.ids for x_id in self.ids):
287287
raise Rule._make_access_error(operation, (self - items))
288288

0 commit comments

Comments
 (0)