Not sure if this has been addressed earlier, I've searched but came up empty.
Scenario:
Domain Access site with many domains, having many different domain editors. These editors needs to be able to search and edit users to handle incoming support requests, adding editors, assigning roles etc. Now, if an editor has permission to edit users, they can edit users for all domains. We need to restrict this so that an editor only has access to edit users that are assigned to the same domain as themselves.
I'm guessing it would include some pretty ugly checks in hook_user, but I wonder if that would be enough to completely fix this. Ideas? New module or patch to existing?
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | domain_user_restrict.zip | 1013 bytes | blackdog |
Comments
Comment #1
blackdog commentedMore accurate title.
Comment #2
agentrickardNew module.
Try using hook_menu_alter() to assert your own access callback for the path 'user/%user/edit'.
In that callback, check the domain information against the user data and permissions.
http://api.drupal.org/api/function/hook_menu_alter
Comment #3
blackdog commentedHey Ken,
I've attached the new module domain_user_restrict, if you'd like to review.
Should I start a new project for this, or could it be included in the domain module?
Comment #4
agentrickardNew project. We are already maintaining too much code.
Comment #5
agentrickardSome quick review:
-- I would change the name of the module. Domain User Restrict doesn't really suggest what it does. 'Domain User Edit' maybe?
-- You may have to run
domain_get_user_domains($account) and domain_get_user_domains($user)before you check $account and $user, as the loading of the $user object is notoriously inconsistent.Comment #6
blackdog commentedThanks Ken,
I'm gonna take a look at this tonight.
Comment #7
blackdog commentedNew module is up: http://drupal.org/project/domain_user_edit
First dev release should be up soon.
Comment #8
enrikito commentedD7 port?