Rewrite logic for AlekSIS/Django user/group sync to only save if necessary
This change refactors the code that ensures AlekSIS persons/groups are kept in sync with Django users/groups. Previously, the Django user object and all Djangogroup objects linked to a person were unconditionally saved on eache person save, which caused at least $number_of_groups+2
writes to the database (and as many haystack update tasks).
Now, we trace dirty fields (adding the django-dirtyfields library to ExensibleModel
, so that we can rely on this feature in general) to decide whether to refresh the user object or not, and connect selectively to the m2m_changed
signal on the members
and owners
relationships to decide which groups need refreshing.
Closes #350 (closed)
Merge request reports
Activity
added part::backend workflow::discussing labels
added 1 commit
- b9a2f044 - Use django-dirtyfields to find out whether users and groups need to be saved
added 2 commits
added 1 commit
- 472add6d - Fix signal API for m2m_changed on Group membership
assigned to @hansegucker and unassigned @nik
requested review from @debdolph
mentioned in commit 624a2cdb
mentioned in issue #371 (closed)