how to restrict add user search to subset of users?

Events happening in the community are now at Drupal community events on www.drupal.org.
mattheweigand's picture

I have a very strange problem that I've been unable to solve for a while now. What I need to do is to restrict the access of who a user can invite to a group. I've set up a system of inheritance on the web site, so that when users with permissions create more users, these new users get tagged with their creator's id. It is a user account field that is called creator_id. So, for instance, if the administrator (with user ID 1) creates a new user, that new user has a creator_id value of 1. I've been using this functionality to restrict what users other users can work with. They can only modify user accounts of users that they added, and can only see user accounts in Views listings of users that they added, etc.

What I would like to do now is to let users who create groups only add other users to the group that they created. However, I don't know how to modify the add user functionality of the organic groups module. If it was a normal form field I could create an entity reference view for it, something that I have done already for another case, but it doesn't seem to be. I have been searching in the OG module itself for clues to how it searches for users, but I haven't found the function yet. Does anyone have an idea of how to do this?

Organic groups

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: