You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[fix] Don't delete VpnClients when enforcing required templates
Bug:
The SortedManyToManyField clears all templates before adding new ones.
This operation emits an `m2m_changed` signal with the `post_clear` action,
which triggers the `Config.enforce_required_templates` receiver to add
required templates back.
Adding required templates emits another `m2m_changed` signal with the
`post_add` action, which executes `Config.manage_vpn_clients` receiver.
At this point, only required templates exist in the DB, hence we cannot
decide which VpnClient objects to delete.
Fix:
We don't delete any VpnClient objects when the `m2m_changed` signal
is sent for the `post_add` action for adding required templates.
The receiver will be called again with the `post_add` action when
all the templates are added back, including the required ones.
And then, it will delete any VpnClient objects that are not
associated with the current templates.
---------
Co-authored-by: Federico Capoano <[email protected]>
0 commit comments