Skip to content

Instantly share code, notes, and snippets.

@mduheaume
mduheaume / .gitignore
Created January 28, 2012 17:12
Git ignore file for unity projects
Temp/
Library/
obj/
*.svd
!Library/*.asset
!Library/AssetImportState
!Library/AssetVersioning.db
!Library/BuildPlayer.prefs
!Library/ScriptMapper
@mduheaume
mduheaume / gist:970987
Created May 13, 2011 17:52
Check if a user belongs to an AD group
using System.DirectoryServices.AccountManagement;
try
{
string adGroupName = "ACTIVE_DIR_GROUP_NAME";
string userAccount = "USER_ACCOUNT_NAME"
using (System.Web.Hosting.HostingEnvironment.Impersonate())
{
PrincipalContext ctx = new PrincipalContext(ContextType.Domain);
GroupPrincipal permissionGroup = GroupPrincipal.FindByIdentity(ctx, adGroupName);