Development #48372
doublon de permission, get() returned more than one Permission -- it returned 2
0%
Description
File "/usr/lib/python3/dist-packages/authentic2/manager/views.py" in dispatch 190. return super(SearchFormMixin, self).dispatch(request, *args, **kwargs) File "/usr/lib/python3/dist-packages/django/views/generic/base.py" in dispatch 88. return handler(request, *args, **kwargs) File "/usr/lib/python3/dist-packages/django/views/generic/edit.py" in get 174. return self.render_to_response(self.get_context_data()) File "/usr/lib/python3/dist-packages/authentic2/manager/role_views.py" in get_context_data 226. self.object.get_admin_role().children(include_self=False, File "/usr/lib/python3/dist-packages/authentic2/a2_rbac/models.py" in get_admin_role 252. operation=MANAGE_MEMBERS_OP) File "/usr/lib/python3/dist-packages/authentic2/a2_rbac/managers.py" in get_admin_role 60. **kwargs) File "/usr/lib/python3/dist-packages/django/db/models/manager.py" in manager_method 85. return getattr(self.get_queryset(), name)(*args, **kwargs) File "/usr/lib/python3/dist-packages/django/db/models/query.py" in update_or_create 480. obj = self.select_for_update().get(**lookup) File "/usr/lib/python3/dist-packages/django/db/models/query.py" in get 384. (self.model._meta.object_name, num) Exception Type: MultipleObjectsReturned at /manage/roles/6051/ Exception Value: get() returned more than one Permission -- it returned 2!
À inspecter,
>>> [x.__dict__ for x in Permission.objects.filter(target_id=role.pk)]
[{'_state': <django.db.models.base.ModelState object at 0x7ffb352d1748>, 'id': 10327, 'operation_id': 11, 'ou_id': 8, 'target_ct_id': 33, 'target_id': 6051}, {'_state': <django.db.models.base.ModelState object at 0x7ffb352d1f98>, 'id': 10343, 'operation_id': 11, 'ou_id': 1, 'target_ct_id': 33, 'target_id': 6051}]
Différence sur l'OU.
Fichiers
Révisions associées
misc: does not check global email uniqueness (#48372)
misc: move check of manager's roles (#48372)
misc: format long line (#48372)
misc: fix check of manager's roles ou (#48372)
misc: add checks and repairs on admin roles permissions and ou (#48372)
misc: remove update_roles_admins post_migrate (#48372)
tests: update test_check_and_repair_managers_of_roles (#48372)
Historique
Mis à jour par Frédéric Péters il y a plus de 3 ans
Localement corrigé via,
Permission.objects.filter(target_id=role.pk).exclude(ou=role.ou).delete()
Mis à jour par Benjamin Dauvergne il y a plus de 3 ans
- Fichier 0003-misc-move-check-of-manager-s-roles-48372.patch 0003-misc-move-check-of-manager-s-roles-48372.patch ajouté
- Fichier 0004-misc-format-long-line-48372.patch 0004-misc-format-long-line-48372.patch ajouté
- Fichier 0002-misc-does-not-check-global-email-uniqueness-48372.patch 0002-misc-does-not-check-global-email-uniqueness-48372.patch ajouté
- Fichier 0006-misc-add-checks-and-repairs-on-admin-roles-permissio.patch 0006-misc-add-checks-and-repairs-on-admin-roles-permissio.patch ajouté
- Fichier 0005-misc-fix-check-of-manager-s-roles-ou-48372.patch 0005-misc-fix-check-of-manager-s-roles-ou-48372.patch ajouté
- Fichier 0001-misc-change-registration-of-check-and-repair-methods.patch 0001-misc-change-registration-of-check-and-repair-methods.patch ajouté
- Tracker changé de Bug à Development
- Statut changé de Nouveau à Solution proposée
- Patch proposed changé de Non à Oui
Mis à jour par Benjamin Dauvergne il y a plus de 3 ans
- Fichier 0003-misc-move-check-of-manager-s-roles-48372.patch 0003-misc-move-check-of-manager-s-roles-48372.patch ajouté
- Fichier 0007-misc-remove-update_roles_admins-post_migrate-48372.patch 0007-misc-remove-update_roles_admins-post_migrate-48372.patch ajouté
- Fichier 0004-misc-format-long-line-48372.patch 0004-misc-format-long-line-48372.patch ajouté
- Fichier 0008-tests-update-test_check_and_repair_managers_of_roles.patch 0008-tests-update-test_check_and_repair_managers_of_roles.patch ajouté
- Fichier 0002-misc-does-not-check-global-email-uniqueness-48372.patch 0002-misc-does-not-check-global-email-uniqueness-48372.patch ajouté
- Fichier 0006-misc-add-checks-and-repairs-on-admin-roles-permissio.patch 0006-misc-add-checks-and-repairs-on-admin-roles-permissio.patch ajouté
- Fichier 0005-misc-fix-check-of-manager-s-roles-ou-48372.patch 0005-misc-fix-check-of-manager-s-roles-ou-48372.patch ajouté
- Fichier 0009-tests-update-test_check_identifiers_uniqueness-48372.patch 0009-tests-update-test_check_identifiers_uniqueness-48372.patch ajouté
- Fichier 0001-misc-change-registration-of-check-and-repair-methods.patch 0001-misc-change-registration-of-check-and-repair-methods.patch ajouté
Mise à jour des tests sur la commande.
Mis à jour par Valentin Deniaud il y a plus de 3 ans
- Statut changé de Solution proposée à Solution validée
La mise à jour des tests de 0009 ne peut pas être mise dans son patch correspondant ? (0002 ?) et pareil pour 0008
0004, mettre la parenthèse fermante sur une nouvelle ligne
0006, ligne 296, pourquoi passer par une liste, et se priver d'un qs.exclude(pk=first_perm.pk).delete() derrière au lieu de la boucle for ?
ack de toute manière comme tout ça c'est de la forme.
Mis à jour par Benjamin Dauvergne il y a plus de 3 ans
- Statut changé de Solution validée à Résolu (à déployer)
commit ea62c3f8caf14a82568792383127f6e36ac7a7cf Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Fri Dec 4 17:45:01 2020 +0100 tests: update test_check_and_repair_managers_of_roles (#48372) commit 95b4528228cb504c69cd999adbf235542965e58f Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Tue Dec 1 22:50:30 2020 +0100 misc: remove update_roles_admins post_migrate (#48372) commit bdb80f27e8218f106fa030613f79f46f69679186 Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Tue Dec 1 22:48:02 2020 +0100 misc: add checks and repairs on admin roles permissions and ou (#48372) commit c0c98c2da557402b48f4c5b0806550fce30517f2 Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Tue Dec 1 22:47:07 2020 +0100 misc: fix check of manager's roles ou (#48372) commit e7a6477635013b933d8e82f7579785a8f8f7d4df Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Tue Dec 1 22:46:32 2020 +0100 misc: format long line (#48372) commit 09c7bd1882a7acdfc5597178045edb16ba380727 Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Tue Dec 1 22:45:45 2020 +0100 misc: move check of manager's roles (#48372) commit 00d2f2584a746468bde21ac961961da28a80c1a3 Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Tue Dec 1 22:45:24 2020 +0100 misc: does not check global email uniqueness (#48372) commit 42b3ab4b29a454c138d7caa80bb0079eb2a8887e Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Tue Dec 1 22:44:50 2020 +0100 misc: change registration of check-and-repair methods (#48372)
Mis à jour par Frédéric Péters il y a plus de 3 ans
- Statut changé de Résolu (à déployer) à Solution déployée
misc: change registration of check-and-repair methods (#48372)