Is there a way to get a list/array of a user's ad group memberships using KUSTO? - azure-data-explorer

I know I can check group memberships using current_principal_is_member_of()
but I need to get a list of the groups in order to use them later on in a query, is there any way to retrieve a user's group memberships using KUSTO?
How can I get a list of users group names like
["XXXX","YYYY","ZZZZ","AAAA","BBBB","CCCC","DDDD"]
where each value is a group from Azure AD
Making a static table like this works
datatable (groupfromaad:string) [
"group1",
"group2"
]
But how do I make the datatable dynamic with a real query to the AD for the current user?

Related

Mgt people picker is not working for group-ids attribute

const groupids = '0ab449e7-5d06-4f8c-9bb0-de87e7f3f684,fae2d5ac-a9f6-42c2-9a4c-20143e49b21b';
Sorry, no people were found
mgt people picker is not fetching the users from the given group ids instead its fetching all the users. If i given hte attribue group-id and given the single group id its fetching the users from that group only but for multiple groups its not working

How to fetch group memberships from an AAD group

I'm trying to fetch all group memberships from an AAD. I have to name of the parent group I want to look for, but I need to fetch the users that are in sub groups of that parent. I've tried may things on the Microsoft docs, but I can't find the right request to find those groups.
This is a try:
var groups = await graphClient.Groups.Request().Filter($"startswith(displayName, '{Se_groupName}')").GetAsync(); //Fetch the parent group
var groupMembers = await graphClient.Groups[groups.FirstOrDefault().Id].Members.Request().GetAsync(); //Try to fetch the groups inside the first group, but its always empty
I was wondering is there a request like:
graphClient.Groups[groups.FirstOrDefault().Id].groupMemberships
To find the nested groups and users you can use the transitiveMembers endpoint
List group transitive members
GET https://graph.microsoft.com/v1.0/groups/{groupId}/transitiveMembers

‘Unless’ Firestore query?

I am make chat app. I have many user group. For example Group A, Group B, Group C. If user is Group A he can connect with other user in Group A.
So for give list of available user in Group A I have simple query:
.where(otherUserGroup, isEqualTo: currentUserGroup)
But now I want allow only some user in Group A see other user in Group A. For example if user is in location NY he is invisible to most user and only visible to other user who also have location NY. BUT I still want all user in NY be able to see all other user in Group A.
So I want run query like this (pseudocode):
.where(otherUserGroup, isEqualTo: currentUserGroup)
BUT do not return user document where otherUserLocation, isEqualTo: [List of location in Firestore collection (for example NY)]
UNLESS otherUserLocation, isEqualTo: currentUserLocation
How to make this query?
The only OR-like conditions that Firestore supports are in and array-contains-any, which check a single field for a bunch of given values. Doing any sort of OR condition across multiple fields is not possible with Cloud Firestore at the moment.
As far as I can see there is no way to do your complex OR condition in a single query.
You'll have to fire a separate query for each, and then merge the results in your application code.

How to manage groups in SignalR core? (joining/leaving from all)

I have some questions about SignalR.
An app scenario: An user can join/leave to many groups (NxN). But
those groups can be changed with a new request. So, how to remove an
user from all joined groups and add him to new list of groups? (Such
as: in first request i join A,B,C groups and with second request i
want to be in only groupS X,Z -i'm not listening a,b,c groups anymore-).
How to check a group name if it's already exists?
How to remove a group if it has no users/members in it? (garbage collector)
Hope someone helps me here!
(Signalr core: 2.2)
SignalR don't provide you the list of users that are in groups, how many groups there are and their names. So the logic that you need to implement is create for example a Dictionary so you can add there the name of your group and the users that are associated to that group. So when a request comes to change user from group A to group B you can do:
Lookup in what groups the user is.
Remove the user from the group.
Create the new group and add it to your Dictionary.
Add the user to the new group.
I believe this is a good aproach if you have one SignalR app/host because if you will have many instances of your signalR app, you can not access to the Dictionary to see if there is a user in some group in some other instance.

NHibernate - Exclude subclass using Criteria with Joined Subclass

I have a fluent nhibernate configuration in my app. Running latest of both. I am trying to create a criteria statement to pull back a specific class in a joined subclass hierarchy. This is an example of my inheritance structure:
Admin is an Employee is a Person (Admin : Employee, Employee : Person)
What I am trying to get is the Employees but not the Admins, but since admins are employees, they are coming back in the query. I do not have a discriminator column to use. Is there any way to accomplish this using the Criteria API?
Thanks in advance.
Schema as requested (just an example):
Person table: Id, Name
Employee table: PersonId, EmployeeNumber
Admin: PersonId, AdminNumber
NHibernate relates those properly. Everything else works except this specific type of query.
It appears that Criteria does not support that functionality. I was able to solve the issue by adding a SQL Restriction to the query to filter out the subclass results.
criteria.Add(
Expression.SQL("{alias}.MyPrimaryKey NOT IN (SELECT MyPrimaryKey FROM Admin)"));
This essentially excludes and results from the Employee SQL query where that Employee exists in the Admin table, thus returning only Employees that are not Admins.
I originally tried separately querying the Admin table via Criteria to get a list of Ids which I then fed into the Employee query using a NOT IN Criteria statement Restrictions.Not(Restrictions.In()) but SQL Server restricts the number of parameters to 2100 and blows up if that collection of Ids that you are trying to exclude has more than 2100 items.

Resources