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

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

            AddToGroup(user, groupEntry);
        }
Ejemplo n.º 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");
 }
Ejemplo n.º 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");
        }
Ejemplo n.º 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;
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 7
0
 public static void AddToGroup(string userName, DirectoryEntry groupEntry)
 {
     ADUtil adu = new ADUtil();
     DirectoryEntry user = adu.GetUserDirectoryEntry(userName);
     AddToGroup(user, groupEntry);
 }
Ejemplo n.º 8
0
 public static void RemoveFromGroup(string userName, DirectoryEntry groupToRemoveFrom)
 {
     ADUtil adu = new ADUtil();
     DirectoryEntry user = adu.GetUserDirectoryEntry(userName);
     RemoveFromGroup(user, groupToRemoveFrom);
 }
Ejemplo n.º 9
0
 public static string[] GetUsersGroups(string userName, bool forceRecache)
 {
     ADUtil ad = new ADUtil();
     return GetUsersGroups(ad.GetUserDirectoryEntry(userName, null), forceRecache);
 }
Ejemplo n.º 10
0
        public static string[] GetUsersGroups(string userName, bool forceRecache)
        {
            ADUtil ad = new ADUtil();

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

            DeleteGroup(groupName, OU);
        }