Skip to content

wip: erp5_test_result: fix Unauthorized error when access connector

Xiaowu Zhang requested to merge xiaowu.zhang/erp5:fixbug into master

We sometimes get Unauthorized error when user cancel test suite, which then trigger TestResult_annotateCommit

the raison is getDestination() return value even user has no permission, we should probably check permission instead

Node: activities-02
Failures: 4
User name: 'xxxxxx'
Uid: 7998010792602638657
Document: /nexedi/test_result_module/xxxxxxxx
Method: TestResult_annotateCommit
Arguments: ('canceled',)
Named Parameters: {}

Exception:
  Module Products.CMFActivity.ActivityTool, line 372, in __call__
    result = method(*self.args, **self.kw)
  Module Products.ERP5Type.patches.PythonScript, line 182, in __call__
    return self._orig_bindAndExec(args, kw, None)
  Module Shared.DC.Scripts.Bindings, line 372, in _bindAndExec
    return self._exec(bound_data, args, kw)
  Module Products.PythonScripts.PythonScript, line 349, in _exec
    result = function(*args, **kw)
  Module script, line 41, in TestResult_annotateCommit
   - <PythonScript at /nexedi/TestResult_annotateCommit used for /nexedi/test_result_module/xxxxxxxx>
   - Line 41
    connector = portal.restrictedTraverse(connector_url)
  Module OFS.Traversable, line 360, in restrictedTraverse
    return self.unrestrictedTraverse(path, default, restricted=True)
  Module OFS.Traversable, line 292, in unrestrictedTraverse
   - __traceback_info__: ([], 'lab.nexedi.xxx')
    next = guarded_getattr(obj, name)
Unauthorized: You are not allowed to access 'lab.nexedi.xxx' in this context

Merge request reports