Closed (fixed)
Project:
Administer Users by Role
Version:
7.x-2.0-rc1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
29 Jul 2015 at 19:00 UTC
Updated:
13 Aug 2015 at 18:04 UTC
Jump to comment: Most recent
Comments
Comment #1
dave kopecekIs this a mismatch in call to entity_metadata_user_access ?
from /entity/modules/callback.inc line 706:
call from administerusersbyrole line 228:
Comment #2
adamps commentedHi, thanks for the report.
I think it's a harmless warning. Sorry I didn't spot it because I have my warning levels too low in my own testing. Basically the code accesses an array key that doesn't exist (generates a notice), and then immediately after does the safety check if the value is set. I will upload a fix.
Regarding #1, in summary no I'm pretty sure it's fine. It's pretty confusing I admit, but the two modules use the variable names in different ways. The entity module passes $entity, but in this case the entity is in fact a user account object users are entities of course), which in this module we call $account throughout, so I stuck with that.
Comment #3
adamps commentedWell I don't know if I can figure out a way to see the warning on my site. But I have some code that I think will fix it - tested the basic function still works at least. Please let me know if the next dev release that is built fixes for you.
Comment #5
dave kopecekThanks for your quick response. 3bbff54 on 7.x-2.x seems to do the trick.
For the record, the code before the fix can cause more than just harmless warnings. I have a "user" based view where administerusersbyrole_metadata_user_access() is getting called twice per view row. One call with $op='view', one with $op='update'.
With the original code administerusersbyrole_metadata_user_access() returns false when it should not for some users.
Running the view as an administrator returns the correct records, running the view as a non-admin would return an incorrect subset of the view's result rows. 3bbff54 on 7.x-2.x appears to fix the issue.
My view may be an edge case but it's worth mentioning to spare others pain.
Comment #6
adamps commented@Dave Kopecek Thanks for posting back with the update.