I'm looking at an application where I need to do a very custom test to determine if a user can administer another user (it's based off user profile data). So it's very close to what user_protect does, and if I did it from scratch, it would use the same mechanism you use with userprotect.
My customer is already using userprotect for other reasons, so to do what I want, either I need to get in after you call hook_menu_alter and call userprotect_user_edit_access on your behalf, or I need to patch userprotect to do what I need it to do without conflicting with you.
It would be pretty easy for me to work in a hook_userprotect($op, $account) to do this. Would you be open to such a patch for the 6.x branch?
I've done the contributed module thing myself, and know what this looks like from your end. But I hope you'll be willing.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | userprotect-issue-1140350-7.x.patch | 4.41 KB | Torenware |
| #3 | userprotect-issue-1140350-6.x.patch | 4.14 KB | Torenware |
Comments
Comment #1
hunmonk commentedi would consider this for 7.x, but new features are closed for 6.x.
Comment #2
Torenware commentedFair enough. I'll supply both; the 6.x will then be findable to the folks who want it, and if you like the patch for 7.x, you'll have it handy.
Comment #3
Torenware commentedHere's the patch for 6.x. The patch for 7.x soon...
Comment #4
Torenware commentedAnd the 7.x patch, made against master.
Comment #5
Torenware commentedLooks like I need to change the status on this. I've been using this patch for a while on D6; works well.
Comment #6
hefox commentedThis seems a bit silly, $function = $module . '_userprotect' may be better.
elseif (coding standards)
Is something setting $response to not be false or the two later $response = FALSE not needed? (and thus the entire last else {}).
Same
My general opinion is that this a very non-standard way to do an access check (bad developer experience to have non-standard hooks). In most access hooks, the user returns the FALSE instead of overriding a variable.
This is my suggestion: