Commit 0b4fe995 authored by Vincent Pelletier's avatar Vincent Pelletier

ERP5Type.patches.User: Scope role cache per user id.

When running test.erp5.testHalJsonStyle live tests, the same transaction
seems to be seeing two different users. This cause an incorrect cache hit
with the second user, which then retrieves values computed by & for the
first user.
Fix this by scoping the cache by user id, causing different cache entries
to be used.
parent 360acab2
Pipeline #8060 passed with stage
in 0 seconds
...@@ -60,9 +60,9 @@ def getRoles(self, _transactional_variable_pool=local()): ...@@ -60,9 +60,9 @@ def getRoles(self, _transactional_variable_pool=local()):
tv = TransactionalVariable() tv = TransactionalVariable()
_transactional_variable_pool.instance = tv _transactional_variable_pool.instance = tv
try: try:
extra_role_tuple = tv['user_extra_role_tuple'] extra_role_tuple = tv[('user_extra_role_tuple', self.getId())]
except KeyError: except KeyError:
tv['user_extra_role_tuple'] = extra_role_tuple = ( tv[('user_extra_role_tuple', self.getId())] = extra_role_tuple = (
(DEVELOPER_ROLE_ID, ) (DEVELOPER_ROLE_ID, )
if self.getId() in getattr( if self.getId() in getattr(
getattr( getattr(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment