Drupal 7 programmatically assign new user to OG - drupal-7

my site is sud-divided into organic groups.
Groups administrators are allowed to create new users but I need a means to auto-assign the new user to the same group the creating group administrator belongs to.
Can anyone tell me how I can accomplish this auto-assignment either programmatically or a module, please?

Related

In Azure AD what is the minimum privilege necessary to give a Guest Inviter the ability to add the invitees to groups?

As a Global administrator role, when I add a Guest User to the tenant, the UI allows me to add the invitee to groups.
However, as a Guest Inviter role, it does not allow me to do this.
So, what is the minimum privileged configuration that I need to give my "project manager people" the ability to add guest users and associate them with specific groups?
I'm still trying to determine how they can get that specific groups box in the invite window to appear for normal users, not sure that possible.
However, to answer your question. As long as those PM people are "owners" of those groups in question, they will have the ability to add the guests to those groups.
although its 1-2 extra steps. they would have to go to Groups instead of Users, click on the group they want and click add member. that's basically the only way to limit them to be able to add members to certain groups.
To make it easier to manage, I would create something like a PM Owner Group manage the membership of that group, then add that group to all the other groups you want those set of users to be able to add guests/members to.
But if you absolutely need the little group section as part of the invite window, my fear is it may need more permissions than you should ever give to a PM. However I will update if I find the exact permission.

Salesforce Roles

I have roles hierarchy in place.
the new requirement is to set up permission to specific external users so they will not be able to see other users records.
the sharing setting for the object is set to Private. I cannot create a user without a role. Other users should be able to see other users (in their role) records. but only this few users should be able to see only records they own.
any idea how to solve it?
thanks,
Chen

Drupal 7 all Users of one role need to be accessible from other role

We are using Drupal Commerce in our website.
We have multiple roles in this website ex. Customer, Customer representative, Content editor and Admin.
Users with "Customer" roles will be allowed to purchase product and make orders, Edit profile.
Users with "Customer representative" roles will be allowed to manage all users that are having "Customer" role. Which will include profile edit of any customer, edit customer's orders etc.
We are not sure how to make this functionality working with Drupal7 and Workbench module.
Any suggestions/ideas?? Thanks in advance!
This module allows site builders to set up fine-grained permissions for allowing "sub-admin" users to manage other users based on the target user\'s role.
The module defines new permissions to control access to edit/delete users - more specific than Drupal Core\'s all-or-nothing 'administer users'. It also provides and enforces a 'create users' permission.
https://www.drupal.org/project/administerusersbyrole

how to get all currenly logged-in user ids of anonymous user in drupal 7?

I have planed to create my own simple chat system. I am using wampserver on windowsxp. I need to get all currently logged-in user ids of anonymouse role in drupal 7. Having those ids we can get user names of all currently logged-in users from user table. so how do i get currently logged in user ids?
plase help me some to fix this problem.
"logged-in user ids of anonymous role" by default Drupal assigns 0 as uid for anonymous role.
If you want to display the users who is online currently, Drupal 7 comes with default block, "Who's online" block.
Goto Structure->Blocks and enable it to your preferred region.
and you can try Drupal chat module for chat feature.

Drupal 7 adding bulk users to group or roles

Is there a way to bulk add users to roles or group in Drupal 7.
I want to add users based on Profile 2 field(s) on filters like (Gender=Male and Age>=18) and so on.
I need to do this in order for Drupal content to be accessible to a specific group(s) or role(s) only.
I went through some modules (http://drupal.org/project/content_access, http://drupal.org/project/simple_access) but I'm really confused, on what suits best.
Try User Import Framework which allows you to use a CSV file to create new users and assign roles

Resources