Projet

Général

Profil

Bug #8030

custom_user: fix left join query to get user roles and direct relationship status

Ajouté par Benjamin Dauvergne il y a plus de 8 ans. Mis à jour il y a plus de 6 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Catégorie:
-
Version cible:
Début:
06 août 2015
Echéance:
% réalisé:

100%

Temps estimé:
Patch proposed:
Non
Planning:

Description

Current query does not produce the wanted join i.e.

LEFT JOIN a2_rbac_role_members ON (a2_rbac_role_members.role_id = a2_rbac_role.id AND a2_rbac_role_members.user_id = <self.id>)

So instead of testing that "a2_rbac_role_members IS NOT NULL" since we cannot get the join we want, we make a prefetch_related() request on the members relation restricting it to the current user only.

Révisions associées

Révision 05c78426 (diff)
Ajouté par Benjamin Dauvergne il y a plus de 8 ans

custom_user: fix left join query to get user roles and direct relationship status (fixes #8030)

Current query does not produce the wanted join i.e.

LEFT JOIN a2_rbac_role_members ON (a2_rbac_role_members.role_id = a2_rbac_role.id AND a2_rbac_role_members.user_id = <self.id>)

So instead of testing that "a2_rbac_role_members IS NOT NULL" since we
cannot get the join we want, we make a prefetch_related() request on the
members relation restricting it to the current user only.

Historique

#1

Mis à jour par Benjamin Dauvergne il y a plus de 8 ans

  • Statut changé de Nouveau à Résolu (à déployer)
  • % réalisé changé de 0 à 100
#2

Mis à jour par Benjamin Dauvergne il y a environ 8 ans

  • Statut changé de Résolu (à déployer) à Solution déployée
#3

Mis à jour par Benjamin Dauvergne il y a plus de 6 ans

  • Statut changé de Solution déployée à Fermé

Formats disponibles : Atom PDF