What steps will reproduce the problem?
1. Use this query:
SELECT COUNT(*) AS Result
FROM
rbac_userroles AS TUrel
JOIN rbac_roles AS TRdirect ON (TRdirect.ID=TUrel.RoleID)
JOIN rbac_roles AS TR ON ( TR.Lft BETWEEN TRdirect.Lft AND TRdirect.Rght)
/* we join direct roles with indirect roles to have all descendants of direct roles */
JOIN
( rbac_permissions AS TPdirect
JOIN rbac_permissions AS TP ON ( TPdirect.Lft BETWEEN TP.Lft AND TP.Rght)
/* direct and indirect permissions */
JOIN rbac_rolepermissions AS TRel ON (TP.ID=TRel.PermissionID)
/* joined with role/permissions on roles that are in relation with these permissions*/
) ON ( TR.ID = TRel.RoleID)
WHERE
/* TU.ID=? */
TUrel.UserID=?
AND
TPdirect.ID=?
What is the expected output? What do you see instead?
This is what's causing trouble:
JOIN
( rbac_permissions AS TPdirect
JOIN rbac_permissions AS TP ON ( TPdirect.Lft BETWEEN TP.Lft AND TP.Rght)
/* direct and indirect permissions */
JOIN rbac_rolepermissions AS TRel ON (TP.ID=TRel.PermissionID)
/* joined with role/permissions on roles that are in relation with these permissions*/
) ON ( TR.ID = TRel.RoleID)
If I replace it with:
JOIN
rbac_permissions AS TPdirect
JOIN rbac_permissions AS TP ON ( TPdirect.Lft BETWEEN TP.Lft AND TP.Rght)
/* direct and indirect permissions */
JOIN rbac_rolepermissions AS TRel ON (TP.ID=TRel.PermissionID)
/* joined with role/permissions on roles that are in relation with these permissions*/
it works well.
What version of the product are you using? On what operating system?
Latest, on OS X Yosemite.
Please provide any additional information below.
This is a valid MySQL query (used in PhpRbac package).
Original issue reported on code.google.com by abiusx on 7 Oct 2014 at 8:13
Original issue reported on code.google.com by
abiusx
on 7 Oct 2014 at 8:13