Skip to content

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)

Edited by Nik | Klampfradler

Merge request reports

Loading