Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Issue: When users with the 'administer user' permission attempt to edit another user's address book, the page loads the wrong user's information. Currently, the 'Address Book' tab loads the logged in user's address book instead of the user to edit's.
Line 148 of addresses_user.inc needs to be changed.
144 drupal_goto("user/$uid/address");
145 break;
146
147 default:
148 - $addresses = _addresses_user_address_get($user->uid);
148 + $addresses = _addresses_user_address_get($uid);
Comments
Comment #1
AlexisWilke CreditAttribution: AlexisWilke commentedWow! That function is completely wrong actually. I think someone reported such a problem before...
If I understand the code I'm reading, if you are logged in and want to go see another user's address but you do not have 'administer users' permission, then you will see YOUR address, even though the path will show that other user UID.
So user/5/address should show user #5 address, but instead you'll get YOURs if you do not have the 'administer users' permission?!
Thank you.
Alexis
Comment #2
sean3z CreditAttribution: sean3z commentedYup. Currently (version 6.x-1.10), regardless of the 'administer users' permission, if you go to another user's Address Book it will load your own.
(see #1111940: Incorrect user access for the 'administer users' issue)
Changing
$user->uid
to$uid
on line 148 of addresses_user.inc will reprimand the issue :)Comment #3
AlexisWilke CreditAttribution: AlexisWilke commentedAh! I see. The permissions are checked on the menu so only authorized users can see that address anyway...
I suppose the address appears in the user's profile already so that's good enough like this. 8-)
Okay, your changes are good for now. 8-)
Thank you.
Alexis Wilke
Comment #4
AlexisWilke CreditAttribution: AlexisWilke commentedCommit:
http://drupalcode.org/project/addresses.git/commit/834657b
Thank you.
Alexis