Example #1
0
        public static void RemoveFromGroup(string userName, DirectoryEntry groupToRemoveFrom)
        {
            ADUtil         adu  = new ADUtil();
            DirectoryEntry user = adu.GetUserDirectoryEntry(userName);

            RemoveFromGroup(user, groupToRemoveFrom);
        }
Example #2
0
        public static void AddToGroup(string userName, DirectoryEntry groupEntry)
        {
            ADUtil         adu  = new ADUtil();
            DirectoryEntry user = adu.GetUserDirectoryEntry(userName);

            AddToGroup(user, groupEntry);
        }
Example #3
0
 public ADUser(string userId, DirectoryEntry searchRoot)
 {
     this.userId = userId;
     ADUtil ad = new ADUtil();
     this.userEntry = ad.GetUserDirectoryEntry(userId, new string[] { "givenName", "sn", "maxPwdAge", "pwdLastSet" }, searchRoot);
     this.firstName = EntryUtil.GetProperty(userEntry, "givenName");
     this.lastName = EntryUtil.GetProperty(userEntry, "sn");
     this.mailBoxLocation = EntryUtil.GetProperty(userEntry, "HomeMDB");
     this.hasExchangeMailBox = !string.IsNullOrEmpty(this.mailBoxLocation);
     this.emailAddress = EntryUtil.GetProperty(userEntry, "mail");
 }
Example #4
0
        public ADUser(string userId, DirectoryEntry searchRoot)
        {
            this.userId = userId;
            ADUtil ad = new ADUtil();

            this.userEntry          = ad.GetUserDirectoryEntry(userId, new string[] { "givenName", "sn", "maxPwdAge", "pwdLastSet" }, searchRoot);
            this.firstName          = EntryUtil.GetProperty(userEntry, "givenName");
            this.lastName           = EntryUtil.GetProperty(userEntry, "sn");
            this.mailBoxLocation    = EntryUtil.GetProperty(userEntry, "HomeMDB");
            this.hasExchangeMailBox = !string.IsNullOrEmpty(this.mailBoxLocation);
            this.emailAddress       = EntryUtil.GetProperty(userEntry, "mail");
        }
Example #5
0
 /// <summary>
 /// Returns true if the specified user is found in the default Active Directory for the 
 /// current process.
 /// </summary>
 /// <param name="userId">The userId to find.</param>
 /// <returns>True if the user is found false otherwise.</returns>
 public static bool Exists(string userId)
 {
     ADUtil ad = new ADUtil();
     return ad.GetUserDirectoryEntry(userId) != null;
 }
Example #6
0
        /// <summary>
        /// Returns true if the specified user is found in the default Active Directory for the
        /// current process.
        /// </summary>
        /// <param name="userId">The userId to find.</param>
        /// <returns>True if the user is found false otherwise.</returns>
        public static bool Exists(string userId)
        {
            ADUtil ad = new ADUtil();

            return(ad.GetUserDirectoryEntry(userId) != null);
        }
Example #7
0
 public static void AddToGroup(string userName, DirectoryEntry groupEntry)
 {
     ADUtil adu = new ADUtil();
     DirectoryEntry user = adu.GetUserDirectoryEntry(userName);
     AddToGroup(user, groupEntry);
 }
Example #8
0
 public static void RemoveFromGroup(string userName, DirectoryEntry groupToRemoveFrom)
 {
     ADUtil adu = new ADUtil();
     DirectoryEntry user = adu.GetUserDirectoryEntry(userName);
     RemoveFromGroup(user, groupToRemoveFrom);
 }
Example #9
0
 public static string[] GetUsersGroups(string userName, bool forceRecache)
 {
     ADUtil ad = new ADUtil();
     return GetUsersGroups(ad.GetUserDirectoryEntry(userName, null), forceRecache);
 }
Example #10
0
        public static string[] GetUsersGroups(string userName, bool forceRecache)
        {
            ADUtil ad = new ADUtil();

            return(GetUsersGroups(ad.GetUserDirectoryEntry(userName, null), forceRecache));
        }
Example #11
0
 public static DirectoryEntry GetOU(string ouPathWithoutDefaultNamingContext, string defaultNamingContext)
 {
     return(ADUtil.GetOU(ouPathWithoutDefaultNamingContext, defaultNamingContext));
 }
Example #12
0
        public static void DeleteGroup(string groupName, string ouPathWithoutDefaultNamingContext)
        {
            DirectoryEntry OU = ADUtil.GetOU(ouPathWithoutDefaultNamingContext);

            DeleteGroup(groupName, OU);
        }