security: update local roles also when user id is initialized
Since erp5 commit erp5@f8cd3922 (base: introduce Person.initUserId, 2020-08-13) _setUserId is no longer called when person are created, so we need another way to trigger local role generation. Extend interaction so that it is called also on initUserId
added 1 commit
- 2bec764b - security: update local roles also when user id is initialized
officejs_test:testOfficeJSSecurity was a failing test before these changes.
Another way I'm thinking of is to address this in
Person.initUserId
, so thatinitUserId
still callsetUserId
for compatibility with interaction workflow, some other projects might also have interaction workflows onPerson._setUserId
orPerson.setUserId
( I found one in slapos core it's for Computer which is probably another user class ).Because
Person._setUserId
does nothing when passed the existing user id, instead of:def initUserId(self): ... self._baseSetUserId(user_id) self.reindexObject()
we could write as:
def initUserId(self): ... self.setUserId(user_id)
this would also reindex without calling reindex manually and keep compatibility for such interactions, but I'm not really convinced we need that.
Writing this, I was wondering why this is needed, because when a document is created we calculate roles on the new document, but we do this before calling init script I don't know why.