Éloi Rivard
662f60af86
fix: attribute types detection
2024-12-06 17:55:22 +01:00
É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
Éloi Rivard
0b51b01031
refactor: apply ruff migrations for python 3.10+
2024-10-28 09:13:00 +01:00
Éloi Rivard
16c3021a8f
refactor: Rename BaseBackend in Backend
2024-05-03 22:25:20 +02:00
Éloi Rivard
6ff591b91c
refactor: Move __html__ from BackendModel to Model
2024-05-03 22:25:20 +02:00
Éloi Rivard
b2d5f8d3a1
refactor: move BackendModel.update to Backend.update
2024-05-03 22:25:20 +02:00
Éloi Rivard
473a262ea2
refactor: move BackendModel.reload to Backend.reload
2024-05-03 22:25:20 +02:00
Éloi Rivard
2ccdaeadf6
refactor: move BackendModel.delete to Backend.delete
2024-05-03 22:22:08 +02:00
Éloi Rivard
09588e0f48
refactor: move BackendModel.save to Backend.save
2024-05-03 22:22:06 +02:00
Éloi Rivard
44573713ed
refactor: move BackendModel.get to Backend.get
2024-05-03 21:54:03 +02:00
Éloi Rivard
fa6488bcd1
refactor: move BackendModel.fuzzy to Backend.fuzzy
2024-05-03 21:42:55 +02:00
Éloi Rivard
8425b2a3b8
refactor: move BackendModel.query to Backend.query
2024-05-03 21:42:54 +02:00
Éloi Rivard
dc89a20b11
chore: configure ruff
2024-04-23 22:12:04 +02:00
Éloi Rivard
256566df94
refactor: Model identifier_attributes are fixed.
2024-04-22 20:04:24 +02:00
Éloi Rivard
9c86f5e9af
refactor: Use annotations to mark model attributes
2024-04-21 11:48:39 +02:00
Éloi Rivard
0ba1c93152
chore: add typing to Model._attributes
2024-04-17 09:03:54 +02:00
Éloi Rivard
8c16a9dd6d
fix: Lazy permission loading exception
2024-04-08 10:50:37 +02:00
Éloi Rivard
fecfcfa8f3
refactor: factorize Model.__html__
2024-04-07 20:23:43 +02:00
Éloi Rivard
6251455a1d
perf: cache the class attributes
2024-04-07 19:22:54 +02:00
Éloi Rivard
c0a28c1480
refactor: set default values for core models
2024-04-07 16:51:55 +02:00
Éloi Rivard
b6c59b3eda
refactor: add some typing to models
2024-04-07 16:39:05 +02:00
Éloi Rivard
f113188368
refactor: factorize match_filter in the main User class
2024-04-07 01:25:44 +02:00
Éloi Rivard
945daee715
refactor: prefer typing.get_type_hints to __annotations__
2024-04-06 23:22:38 +02:00
Éloi Rivard
75837fa207
refactor: model attributes are walked from the top to the bottom
2024-04-06 22:46:11 +02:00
Éloi Rivard
f06f0c4e25
doc: fix references to BackendModel
2024-04-05 16:09:20 +02:00
Éloi Rivard
7734ed185e
refactor: the id attribute is attached to the Model class
2024-04-05 16:05:17 +02:00
Éloi Rivard
18e3f8cde5
refactor: split the base model class in two
2024-04-01 18:55:05 +02:00
Éloi Rivard
be2fa8b7f5
doc: minor various improvements
2024-03-29 09:35:29 +01:00
Éloi Rivard
8625318341
feat: use pydantic to validate the configuration
2024-03-28 17:44:26 +01:00
Éloi Rivard
ffa12b0f71
feat: created
and last_modified
model attributes
2024-03-27 13:57:38 +01:00
Éloi Rivard
395b6ab4f3
chore: add docformatter pre-commit
2023-12-28 18:31:57 +01:00
Éloi Rivard
1fd8af2cf4
refactor: models attributes cardinality is closer to SCIM models
2023-11-17 21:21:25 +01:00
Éloi Rivard
77cccc3a10
doc: better model inheritance to generate a clearer documentation
2023-08-23 16:41:41 +02:00
Éloi Rivard
553595c5ed
doc: model documentation
2023-08-17 16:11:24 +02:00