Closed (fixed)
Project:
Realname Userreference
Version:
6.x-1.2
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
29 Jun 2010 at 22:42 UTC
Updated:
21 Mar 2011 at 16:41 UTC
Jump to comment: Most recent file
Comments
Comment #1
deruitern commentedHere is a patch that fixed this problem for me. It simply checks that $field_name is not empty, to make sure that the data is being requested by a field rather than being browsed to directly by a user. I've verified that the callback returns nothing if I go to http://mysite.com/realname_userreference/autocomplete, but and the field still works as expected.
Comment #2
guillaumeduveauThanks a lot deruitern, actually I thought I had fixed that in #716794: Permission of the autocomplete callback path but it's not working ! I'd prefer to understand what happens in that other bug first...
Comment #3
guillaumeduveauComment #4
guillaumeduveauIt's more a feature request, since in general Realnames are intended to be public as stated by the Drupal security team. But I do understand your point.
Isn't it possible to fake that a field is requesting http://mysite.com/realname_userreference/autocomplete ? Otherwise your solution seems OK, but why doesn't it work with the permissions like I wrote in http://drupal.org/node/716794#comment-4090534 ?
Comment #5
deruitern commentedWell, in my instance the Realnames are not intended to be public and are only for privileged users - and this part is working ... my Realnames cannot be accessed unless the user is logged in, ie. 'access content'.
For my setup, have a couple of different roles on my site, for example a customer role and a user role. I'm using a custom views filter to prevent customers from being able to reference other customer in the system, however users can reference any users or customers.
All AJAX requests and permissions are working fine when called from a module, but I think the issue is that if the callback is accessed directly in the URL. You are correct in that is possible to fake $field, so I've attached a patch to make sure that $field is a valid field before making the json request. Its seems that if $field is empty, the potential_references_views never gets called, but potential_references_standard does instead, even if the field is set up to use a view ... I'm assuming the default behavior for standard is to return all users, but a userreferences based on views, should only return the results from the view. Let me know if that doesn't make sense.
Comment #6
guillaumeduveauLike in CCK Nodereference, I prefer to check the access in a dedicated function outside of realname_userreference_auto(), and I guess the permission checks are fine too. So I'm thinking of :
Modification :
Add that :
What do you think ? Thanks again for pointing and helping with that issue.
Comment #7
guillaumeduveauDiscovering Git, I hope the patch is OK.
Comment #8
deruitern commentedHey guix, I wasn't able to apply this patch for some reason, but I applied it by hand and after testing, it seems to have resolved my issue. Thanks for the help.
Comment #9
guillaumeduveauGood, I'll commit on monday and release 6.x-1.2 !
Comment #10
guillaumeduveau