Needs review
Project:
Search Restrict
Version:
7.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
29 Dec 2009 at 17:12 UTC
Updated:
12 Sep 2011 at 09:11 UTC
Jump to comment: Most recent file
Comments
Comment #1
fizk commentedHere's the problem
if (!empty($selected) && in_array($role_id, $user->roles))$user->roles is the name of the role, but $role_id is the integer value of the role.
Comment #2
fizk commentedHere's a solution:
search_restrict.module: Line 139
Change
if (!empty($selected) && in_array($role_id, $user->roles)) {to
if (!empty($selected) && isset($user->roles[$role_id])) {Comment #3
jgreep commentedThis definitely helps, but when selecting the roles, the instructions say "If all checkboxes are unselected then everyone can search."
I find that I still need to select at least authenticated user for anything to show up.
Comment #4
oda commentedYou should also check if all (or none) roles were checked. It could be something like that in rewrite_sql hook.
I suggest the attached patch.
Thanks!
Comment #5
oda commentedoops, wrong status :P
Comment #6
fizk commentedComment #7
leksat commentedHere is my patch for solving this problem.
Comment #8
leksat commentedExample. I have 3 roles on my site, and I'm configured some content type (for example, page) 'anonymous' => off, 'authenticated' => on, 'admin' => on. Then I'm add new role 'stuff'. And stuff will allowed to search page.
Here another patch for fix that bug.
Comment #9
neochief commentedSubscribe
Comment #10
Leeteq commentedHow come an issue marked "Critical" with this kind of showstopper-like title and having a proposed fix, is not even pushed to the -dev version in over a year?
Comment #11
Leeteq commentedbtw, is this relevant for the 7.x branch too, or only 6.x?