I'm trying to find out what permissions a user has to a given security group. For example do the have Read, Read/Write, Admin, etc...
I get the list of groups they belong to but can't figure out how to get the permissions for those groups.
private static void FindUserById(PrincipalSearcher ps, PrincipalContext pc, string name)
{
var up = new UserPrincipal(pc)
{
// EmailAddress = wildcard
// GivenName = wildcard
Name = name
};
ps.QueryFilter = up;
foreach (var found in ps.FindAll())
{
if (found is UserPrincipal user)
{
string line = $"{{\"Name\":\"{user.DisplayName}\", \"Email\": \"{user.EmailAddress}\"}},";
var groups = user.GetAuthorizationGroups();
Console.WriteLine(line);
}
}
}