Project

General

Profile

Bug #8030

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

Added by Benjamin Dauvergne about 4 years ago. Updated over 1 year ago.

Status:
Fermé
Priority:
Normal
Category:
-
Target version:
Start date:
06 Aug 2015
Due date:
% Done:

100%

Patch proposed:
No
Planning:
No

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.

Associated revisions

Revision 05c78426 (diff)
Added by Benjamin Dauvergne about 4 years ago

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.

History

#1 Updated by Benjamin Dauvergne about 4 years ago

  • % Done changed from 0 to 100
  • Status changed from Nouveau to Résolu (à déployer)

#2 Updated by Benjamin Dauvergne over 3 years ago

  • Status changed from Résolu (à déployer) to Solution déployée

#3 Updated by Benjamin Dauvergne over 1 year ago

  • Status changed from Solution déployée to Fermé

Also available in: Atom PDF