Skip to content

Commit

Permalink
[FIX] fixed new version feature. Compare object ids without the version
Browse files Browse the repository at this point in the history
  • Loading branch information
benwillig authored and jdoutreloux committed Aug 16, 2023
1 parent e10c005 commit 9f94988
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cmis_web_proxy/controllers/cmis.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def _check_cmis_content_access(
else:
cmis_content = repo.getObjectByPath(cmis_path)
request_cmis_objectid = cmis_content.getObjectId()
if request_cmis_objectid == token_cmis_objectid:
if self._is_cmis_objectid_equals(request_cmis_objectid, token_cmis_objectid):
# the operation is on the CMIS content linked to the Odoo model
# instance
return True
Expand All @@ -442,6 +442,18 @@ def _check_cmis_content_access(
)
return False

def _is_cmis_objectid_equals(self, oid1, oid2):
if oid1 == oid2:
return True
# object version is included in the object path so we can't
# make a simple name check, otherwise we won't be able to import
# a new version
oid1_parts = oid1.split(';')
oid2_parts = oid2.split(';')
if oid1_parts[:1] == oid2_parts[:1]:
return True
return False

def _check_content_action_access(
self, cmis_path, proxy_info, params, model_inst, field_name
):
Expand Down

0 comments on commit 9f94988

Please sign in to comment.