A project_issue user at my day job reported a bug where, as an anonymous user trying to use the advanced issue search page, they got a JS error box when they tried to use any of the autocomplete fields (submitted, assigned, participant). The reason is that user/autocomplete requires 'access user profiles' permission, yet project_issue happily makes all those fields auto-complete, even if the current user can't access user/autocomplete. Attached patch solves the problem by only turning those fields into auto-complete fields if the current user has access. Applies cleanly to DRUPAL-5, but also applies (with fuzz) on HEAD, DRUPAL-4-7--2 and DRUPAL-4-7. Tested and working nicely, both with and without 'access user profiles'. Any objections before I commit? ;)
| Comment | File | Size | Author |
|---|---|---|---|
| issue_search_autocomplete_access.patch.txt | 1.7 KB | dww |
Comments
Comment #1
hunmonk commentedactually, yeah -- i think i do have an objection :)
my feeling is that this should be properly fixed in core. i'm guessing the fix would be about as hard in core, and then modules wouldn't have to mess with it at all.
i'm *pretty* sure that fixing it in core won't cause any weird limitations or behaviors -- the user that got the form should be the same user that's making the autocomplete request, so it should be fine to do the access check somewhere in the autocomplete building code.
Comment #2
dwwIt's not clear in the D5 menu API how to find out if the current user can access a given path. _menu_item_is_accessible() is supposedly private to menu.inc, and operates on menu ids (mids). Do I have to call menu_get_item() and then use this private function directly? It's no doubt going to be vastly different in D6 menu land. *sigh*
If this is going to be a core bug dealing with different versions of FAPI and multiple menu systems, I'm afraid I don't have the time or energy to work on this. Furthermore, the existing patch is totally unrelated to the new strategy for solving this, so "active" would be more accurate...
Comment #3
acsubscribing
Comment #4
dave reidMarking this as a duplicate of #284887: Check for access to autocomplete paths during form building since there's a pretty good core patch there (with tests!)
Comment #5
dave reidI called it too soon. :) This should be fixed for core in 6.x and 7.x, but it will remain a bug in 5.x. Setting proper version and back to active.
Comment #6
damien tournoud commentedThis is by design for D5.