Skip to content
Snippets Groups Projects
Commit 9d092cce authored by Tim Plunkett's avatar Tim Plunkett
Browse files

Issue #81953 by CashWilliams, larowlan: Fixed access bypass in CTools node...

Issue #81953 by CashWilliams, larowlan: Fixed access bypass in CTools node autocomplete: view unpublished nodes.
parent 4dc2d93c
No related branches found
Tags 7.x-1.3
No related merge requests found
......@@ -50,6 +50,21 @@ function ctools_content_autocomplete_entity($type, $string = '') {
$matches = array();
if ($type == 'node') {
if (!user_access('bypass node access')) {
// If the user is able to view their own unpublished nodes, allow them
// to see these in addition to published nodes.
if (user_access('view own unpublished content')) {
$query->condition(db_or()
->condition('b.status', NODE_PUBLISHED)
->condition('b.uid', $GLOBALS['user']->uid)
);
}
else {
// If not, restrict the query to published nodes.
$query->condition('b.status', NODE_PUBLISHED);
}
}
$query->addTag('node_access');
$query->join('users', 'u', 'b.uid = u.uid');
$query->addField('u', 'name', 'name');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment