New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix EZP-20601: Permission checking when using object states #745
Conversation
Using object states caused a fatal error in the sql query. Used the previous query from the 4.6 : http://pubsvn.ez.no/doxygen/4.6.0/html/ezcontentobjecttreenode_8php_source.html#l01633
Ok, travis seems to be ok with the change, +0.8 from me |
-1 Since the fix of https://jira.ez.no/browse/EZP-19158, As far as I can see, the SQL query that failed was: SELECT DISTINCT
ezcontentobject.*,
ezcontentobject_tree.*,
ezcontentclass.serialized_name_list as class_serialized_name_list,
ezcontentclass.identifier as class_identifier,
ezcontentclass.is_container as is_container,
ezcontentobject_name.name as name,
ezcontentobject_name.real_translation,
nmbcounters.count as counter
FROM
ezcontentobject_tree
INNER JOIN ezcontentobject ON (ezcontentobject_tree.contentobject_id = ezcontentobject.id)
INNER JOIN ezcontentclass ON (ezcontentclass.version = 0 AND ezcontentclass.id = ezcontentobject.contentclass_id)
INNER JOIN ezcontentobject_name ON (
ezcontentobject_tree.contentobject_id = ezcontentobject_name.contentobject_id AND
ezcontentobject_tree.contentobject_version = ezcontentobject_name.content_version
), nmbcounters
INNER JOIN ezcobj_state_link ezcobj_state_lnk_0_perm ON (ezcobj_state_lnk_0_perm.contentobject_id = ezcontentobject.id) INNER JOIN ezcobj_state_group ezcobj_state_grp_0_perm ON (ezcobj_state_grp_0_perm.identifier = 'workflow_date') INNER JOIN ezcobj_state ezcobj_state_0_perm ON (ezcobj_state_0_perm.id = ezcobj_state_lnk_0_perm.contentobject_state_id AND ezcobj_state_0_perm.group_id = ezcobj_state_grp_0_perm.id)
WHERE
ezcontentobject_tree.path_string like '/1/2/148/%' and ezcontentobject_tree.depth <= 12 and
ezcontentobject.id = nmbcounters.aid AND nmbcounters.type = 2 AND nmbcounters.identifier = '3d' AND
ezcontentobject_tree.node_id != 148 AND
( ezcontentobject_name.language_id & ezcontentobject.language_mask > 0 AND
( ( ezcontentobject.language_mask - ( ezcontentobject.language_mask & ezcontentobject_name.language_id ) ) & 1 )
+ ( ( ( ezcontentobject.language_mask - ( ezcontentobject.language_mask & ezcontentobject_name.language_id ) ) & 2 ) )
<
( ezcontentobject_name.language_id & 1 )
+ ( ( ezcontentobject_name.language_id & 2 ) )
)
AND ezcontentobject_tree.is_invisible = 0
AND ((ezcontentobject.contentclass_id in (33, 38, 60, 61, 68, 69, 70, 73) AND ezcontentobject.section_id in (3)) OR (ezcontentobject.section_id in (1) AND ezcobj_state_0_perm.id = 3))
AND ezcontentobject.language_mask & 3 > 0
ORDER BY
counter DESC
LIMIT
0, 10 while the error is in the way the The correct SQL query being: SELECT DISTINCT
ezcontentobject.*,
ezcontentobject_tree.*,
ezcontentclass.serialized_name_list as class_serialized_name_list,
ezcontentclass.identifier as class_identifier,
ezcontentclass.is_container as is_container,
ezcontentobject_name.name as name,
ezcontentobject_name.real_translation,
nmbcounters.count as counter
FROM
ezcontentobject_tree
INNER JOIN ezcontentobject ON (ezcontentobject_tree.contentobject_id = ezcontentobject.id)
INNER JOIN ezcontentclass ON (ezcontentclass.version = 0 AND ezcontentclass.id = ezcontentobject.contentclass_id)
INNER JOIN ezcontentobject_name ON (
ezcontentobject_tree.contentobject_id = ezcontentobject_name.contentobject_id AND
ezcontentobject_tree.contentobject_version = ezcontentobject_name.content_version
)
INNER JOIN nmbcounters ON (ezcontentobject.id = nmbcounters.aid)
INNER JOIN ezcobj_state_link ezcobj_state_lnk_0_perm ON (ezcobj_state_lnk_0_perm.contentobject_id = ezcontentobject.id) INNER JOIN ezcobj_state_group ezcobj_state_grp_0_perm ON (ezcobj_state_grp_0_perm.identifier = 'workflow_date') INNER JOIN ezcobj_state ezcobj_state_0_perm ON (ezcobj_state_0_perm.id = ezcobj_state_lnk_0_perm.contentobject_state_id AND ezcobj_state_0_perm.group_id = ezcobj_state_grp_0_perm.id)
WHERE
ezcontentobject_tree.path_string like '/1/2/148/%' and ezcontentobject_tree.depth <= 12 and
nmbcounters.type = 2 AND nmbcounters.identifier = '3d' AND
ezcontentobject_tree.node_id != 148 AND
( ezcontentobject_name.language_id & ezcontentobject.language_mask > 0 AND
( ( ezcontentobject.language_mask - ( ezcontentobject.language_mask & ezcontentobject_name.language_id ) ) & 1 )
+ ( ( ( ezcontentobject.language_mask - ( ezcontentobject.language_mask & ezcontentobject_name.language_id ) ) & 2 ) )
<
( ezcontentobject_name.language_id & 1 )
+ ( ( ezcontentobject_name.language_id & 2 ) )
)
AND ezcontentobject_tree.is_invisible = 0
AND ((ezcontentobject.contentclass_id in (33, 38, 60, 61, 68, 69, 70, 73) AND ezcontentobject.section_id in (3)) OR (ezcontentobject.section_id in (1) AND ezcobj_state_0_perm.id = 3))
AND ezcontentobject.language_mask & 3 > 0
ORDER BY
counter DESC
LIMIT
0, 10 The following part: INNER JOIN ezcontentobject_name ON (
...
), nmbcounters
INNER JOIN ezcobj_state_link ezcobj_state_lnk_0_perm ON (...) must be changed to: INNER JOIN ezcontentobject_name ON (
...
)
INNER JOIN nmbcounters ON (ezcontentobject.id = nmbcounters.aid)
INNER JOIN ezcobj_state_link ezcobj_state_lnk_0_perm ON (...) While removing the |
https://jira.ez.no/browse/EZP-20601
Using object states caused a fatal error in the sql query.
Used the previous query from the 4.6 : http://pubsvn.ez.no/doxygen/4.6.0/html/ezcontentobjecttreenode_8php_source.html#l01633
This is update to PR #477