Google gives the ability to add a group to another group.
For example, if we add Group A to Group B and user xyz#abc.com is present under Group A, and when I try to retrieve the groups of the user xyz#abc.com using OAuth 2.0 using the API https://www.googleapis.com/admin/directory/v1/groups, it returns only Group A, and not Group B.
I would like to get Group B too in the response from Google, since Group A is a part of Group B.
Is there any way to do this? Does Google provide us with the list of all parent groups as well in OAuth?
Related
Use case:
I need to create a report on office groups without owner. This happens when people leave the company and their account is deleted. Their groups live further, but eventually group expiration kicks in and somebody need to take action.
Question: What is the easiest was to create query in graph to filter groups that do not have an owner?
What I currently do is:
List all groups
Enumerate this list and look for groups where the owner array is empty:
https://graph.microsoft.com/v1.0/groups/{id}/owners?$select=mail
This returns an empty array when there are no owners.
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#directoryObjects(mail)",
"value": []
}
This, in theory, works, but takes ages as we have many 10 thousands of groups, so I am looking for a solution that makes this possible with one query. I also tried to filter the exprationDatTime property to limit results but query this doesn't seem to be supported. I mainly need groups that are due to expire.
There is no way how to get groups without owners with one query.
What you can do is to query all groups, expand owners and select only id of the group and id of the owner. It will minimize the response size.
Then iterate through the all groups and check for empty owners collection.
GET https://graph.microsoft.com/v1.0/groups?$expand=owners($select=id)&$select=id
Is there a script that can list all users of a given group recursively so it covers all nested groups and also lists the name of group (nested child group) that user is part of so i know the group that user is part of
We are using apartment gem for multi-tenant application. For each account, there will be a separate schema is maintained. based on the subdomain of the account, we list the data in each account.
In our new requirement, there is something like a super account where all the account data can be viewed. For example, if account 1 and account 2 is selected in the user list page, users of account 1 and 2 should be combined and viewed along with search provision. Is there any way to combine more than one schema data in the apartment? or any other alternates
The simplest approach I can think of is to perform union queries across the relevant schemas. So if you have schemas account_1 and account_2, you'd do something like SELECT * FROM account_1.users UNION SELECT * FROM account_2.users.
You can, of course, make this dynamic – so if you send the affected accounts as part of the params hash, you'd potentially have something like this:
accounts = Account.find(params[:account_ids])
# assuming the schema name is stored in the accounts.tenant_name column:
sql = accounts.map { |account| "SELECT * FROM #{account.tenant_name}.users" }.join(" UNION ")
users = User.find_by_sql(sql)
I have a class User, which has many Events and belongs to many Groups. I want to allow user to create Event and restrict who he wants the invite by Group, by user id or by both.
I am thinking creating a table Invitee to store all users' id and events id. For each Event, when user A chooses to invite group Z and users B and C, I will query group Z to find all user id of the members and add them to Invitee table, together with B and C's user id.
I think it is might not be the best way to do it. I wonder if there is a better way to do it.
Thank you.
Look in to polymorphic associations: basically you want invitations that can be either entity type.
In TFS 2010, is there a way that I can assign a work item to a group (i.e. Developers or Designers) instead of an individual user? I'd also want to be able to create a query so that we can filter on that group as well.
Yes, you can. If your group is a member of the larger group that can be assigned to, then it will appear in the list of assignable users.
For example, a user hierarchy might be like this:
[Assignable Users]
[Developers]
[Project Managers]
Mark Avenius
Joe Schmoe
EDIT
As for the query, you can have the clause Assigned To contains #Me, which I believe will do what you want.