Views to display nodes based on ACL permission
According to: https://www.drupal.org/node/1255426, Drupal 7 does not have db_result function. You have to replace it with db_query().

Code which worked in my special case:

&lt;?php
global $user;
$query = db_query("SELECT GROUP_CONCAT(CAST(an.nid AS CHAR) SEPARATOR ',') FROM {acl_user} au INNER JOIN {acl_node} an ON au.acl_id = an.acl_id WHERE an.grant_view = 1 AND au.uid = :uid", array(':uid' =&gt; $user-&gt;uid));
$result = $query-&gt;fetchObject();
return reset($result);
?&gt;