Skip to content

Instantly share code, notes, and snippets.

@thefringeninja
Created October 22, 2013 18:35
Show Gist options
  • Save thefringeninja/7105713 to your computer and use it in GitHub Desktop.
Save thefringeninja/7105713 to your computer and use it in GitHub Desktop.
Words fail.
private static IEnumerable<string> AreYouSerious(UserPrincipal identity)
{
var enumerator = identity.GetAuthorizationGroups().GetEnumerator();
while (enumerator.MoveNext())
{
Principal authorizationGroup = null;
try
{
authorizationGroup = enumerator.Current;
}
catch
{
}
if (authorizationGroup != null)
{
yield return authorizationGroup.Name;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment