Skip to content

Commit

Permalink
[IMP] edi_storage_oca: Fix permission
Browse files Browse the repository at this point in the history
Enable any internal user to trigger creation of EDI records without EDI Manager group nor read access to storage.backend
  • Loading branch information
tuantrantg authored and thienvh332 committed Dec 31, 2024
1 parent 24f2876 commit cf8ff34
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion edi_storage_oca/components/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def _get_remote_file(self, state, filename=None, binary=False):
# TODO: support match via pattern (eg: filename-prefix-*)
# otherwise is impossible to retrieve input files and acks
# (the date will never match)
return self.storage._get_b64_data(path.as_posix(), binary=binary)
return self.storage.sudo()._get_b64_data(path.as_posix(), binary=binary)
except FileNotFoundError:
_logger.info(
"Ignored FileNotFoundError when trying "
Expand Down
2 changes: 1 addition & 1 deletion edi_storage_oca/components/send.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def send(self):
return True
filedata = self.exchange_record.exchange_file
path = self._get_remote_file_path("pending")
self.storage._add_b64_data(path.as_posix(), filedata, binary=False)
self.storage.sudo()._add_b64_data(path.as_posix(), filedata, binary=False)
# TODO: delegate this to generic storage backend
# except paramiko.ssh_exception.AuthenticationException:
# # TODO this exc handling should be moved to sftp backend IMO
Expand Down
2 changes: 1 addition & 1 deletion edi_storage_oca/models/edi_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def _component_match_attrs(self, exchange_record, key):
res = super()._component_match_attrs(exchange_record, key)
if not self.storage_id or key not in self._storage_actions:
return res
res["storage_backend_type"] = self.storage_id.backend_type
res["storage_backend_type"] = self.sudo().storage_id.backend_type
return res

def _component_sort_key(self, component_class):
Expand Down

0 comments on commit cf8ff34

Please sign in to comment.