Example #1
0
 public bool RemoveUserToGroup(string userlogin, string groupName)
 {
     try
     {
         m_DirectoryEntry = null;
         ADManager admanager = new ADManager(LDAPPath, LDAPUser, LDAPPassword);
         admanager.RemoveUserFromGroup(userlogin, groupName);
         return(true);
     }
     catch (Exception ex)
     {
         Trace.TraceError(ex.Message);
         string err      = ex.Message;
         int    Event_id = 1128;
         EventLog.WriteEntry(InfoHubEventLog.LogSource, err, EventLogEntryType.Warning, Event_id, Category);
         return(false);
     }
 }
Example #2
0
        public bool AddUserToGroup(ADUserDetail user, string groupName, ref string err)
        {
            err = "";
            try
            {
                ADManager admanager = new ADManager(LDAPPath, LDAPUser, LDAPPassword);
                if (admanager.AddUserToGroup(user.LoginName, groupName) == false)
                {
                    return(false);
                }

                return(UpdateUserByLogin(user, false, ref err));
            }
            catch (Exception ex)
            {
                err = MethodBase.GetCurrentMethod() + ", Exception:" + ex.Message;
                Trace.TraceError(err);
                return(false);
            }
        }