canaille-globuzma/canaille/backends
Éloi Rivard 6a6350e368
fix: with LDAP backend, edition the admin group would fail
The `match_filter` method evaluate filters, and queries objects from their ids.
The value was stored in the `filter` arg, but being a dict it was
re-used during the following calls of `match_filter`.
After editing the `admin` group (by adding or removing an user), a new page is displayed, and as always it checks the user permissions.
The user permission check would call `match_filter` then compare an
updated version of the admin group (with one less or one new user) with
an unfortunate *cached* version in the `match_filter` `filter` arg.
With the SQL or the memory backend the comparision would be successful,
but it is not with the LDAP backend.
This resulted in permission loss for users after editing the `admin`
group. Being a method default value edited, it would remain until the
Canaille service was reloaded.

Related to https://stackoverflow.com/questions/1132941/least-astonishment-and-the-mutable-default-argument
2024-11-06 15:00:57 +01:00
..
ldap fix: LDAP backend rdn_value could try to strip a None value 2024-07-25 17:39:40 +02:00
memory refactor: apply ruff migrations for python 3.10+ 2024-10-28 09:13:00 +01:00
sql refactor: apply ruff migrations for python 3.10+ 2024-10-28 09:13:00 +01:00
__init__.py chore: automitaclly fix typos 2024-09-11 09:33:42 +02:00
commands.py chore: automitaclly fix typos 2024-09-11 09:33:42 +02:00
models.py fix: with LDAP backend, edition the admin group would fail 2024-11-06 15:00:57 +01:00