protected override void testSelectedPhase(staffSpecSL aStaffSpecSL, DateTime runDateTime) { // put on hold and not fully implemented yet DataView wDV; String sqlInsert; foreach (staffSpec ss in aStaffSpecSL.Values) { mAttributeValues = GetLDAPInfo("cn=" + ss.NDSName); String homeDir = attributeValue("ndshomedirectory").ToLower(); String[] hd = homeDir.Split(','); //if (homeDir.Length > 0) hd = homeDir.Split(','); //test for example cn=orion_home if (hd[0].ToString().Trim() == ss.ActionData.ToString().ToLower().Trim()) { //sqlInsert = "wcIDMEnableDisableApplications " + ss.QLId.ToString() + ",'" + ss.NDSName.ToString() + "'," + "'F','F','N','N'"; //wDV = staffUtility.readDataView(staffUtility.couplerDB, sqlInsert); //if (wDV[0][0].ToString() == "1" && wDV[0][1].ToString() == "1" && wDV[0][2].ToString() == "1" && (wDV[0][3].ToString() == "1" || wDV[0][3].ToString() == "3")) // { mTestedOK.Add(ss.queueItem.ToString()); //} } else if (ss.attempts > mTryCount) { mFailed.Add(ss.queueItem.ToString()); } } }
protected override void testSelectedPhase(staffSpecSL aStaffSpecSL, DateTime runDateTime) { foreach (staffSpec ss in aStaffSpecSL.Values) { mAttributeValues = GetLDAPInfo("cn=" + ss.NDSName); // this problem is a synchronisation issue - nds may not match staffidentity for telephone number. //the staff maitenance form does not allow a blank telephone number so the staff identity telephone must be blank // because this class is shared with the Publishposts routine we need to ensure that the telephone number matches // with the NDS number so set them equal. if (ss.Tel.Length < 1) { ss.Tel = attributeValue("telephonenumber").Trim().ToUpper().ToString(); } String y = attributeValue("telephonenumber").Trim().ToUpper().ToString(); if ( (attributeValue("telephonenumber").Trim().ToUpper().ToString() == ss.Tel.Trim().ToUpper().ToString()) && (attributeValue("surname").ToUpper().Trim() == ss.Surname.ToUpper().Trim()) && (attributeValue("givenname").ToUpper().Trim() == ss.Forename.ToUpper().Trim()) && (attributeValue("title").ToUpper().Trim() == ss.JobTitle.ToUpper().Trim()) ) { mTestedOK.Add(ss.queueItem.ToString()); } else if (ss.attempts > mTryCount) { mFailed.Add(ss.queueItem.ToString()); } } }
protected override void testSelectedPhase(staffSpecSL aStaffSpecSL, DateTime runDateTime) { foreach (staffSpec ss in aStaffSpecSL.Values) { mAttributeValues = GetLDAPInfo("cn=" + ss.NDSName); //DateTime gwexpire = DateTime.Parse(attributeValue("gwexpire")); DateTime cwDate = DateTime.Now; DateTime nullDate = new DateTime(1970, 1, 1, 0, 0, 0);// if groupwise date is equal to this then a date has not been set. DateTime gwexpire = nullDate; if (DateTime.TryParse(attributeValue("gwexpire"), out gwexpire)) { //gwexpire has a good value } else { //set gwexpire again because the date returned by the tryparse was 01/01/0001 which means we have a problem with access manager. gwexpire = nullDate; } int expiredCount = DateTime.Compare(cwDate, gwexpire); // >0 means that the expirydate has expired in groupwise. int expireDateSet = DateTime.Compare(nullDate, gwexpire); // 0 means that no expirydate has been set in groupwise if (expireDateSet != 0 && expiredCount > 0) // then the groupwise DateTime has expired - so remove the staffidentity keepProxy flag. //if (attributeValue("ngwmailboxexpirationtime").ToLower() == "true") { staffUtility.updateWcStaffIdentity(ss.NDSName, "SET keepProxy = 0"); mTestedOK.Add(ss.queueItem.ToString()); } else if (ss.attempts > mTryCount) { mFailed.Add(ss.queueItem.ToString()); } } }
protected override void testSelectedPhase(staffSpecSL aStaffSpecSL, DateTime runDateTime) { DataView wDV; String sqlInsert; foreach (staffSpec ss in aStaffSpecSL.Values) { mAttributeValues = GetLDAPInfo("cn=" + ss.NDSName); if (attributeValue("logindisabled").ToLower() == "true") { staffUtility.updateWcStaffIdentity(ss.NDSName, "SET NDSdisabled = 1"); // update applications to disabled // SHD, EHD, QLR, phone_list sqlInsert = "wcIDMEnableDisableApplications " + ss.QLId.ToString() + ",'" + ss.NDSName.ToString() + "'," + "'F','F','N','N'"; wDV = staffUtility.readDataView(staffUtility.couplerDB, sqlInsert); if (wDV[0][0].ToString() == "1" && wDV[0][1].ToString() == "1" && wDV[0][2].ToString() == "1" && (wDV[0][3].ToString() == "1" || wDV[0][3].ToString() == "3")) { mTestedOK.Add(ss.queueItem.ToString()); } } else if (ss.attempts > mTryCount) { mFailed.Add(ss.queueItem.ToString()); } } }
protected override void testSelectedPhase(staffSpecSL aStaffSpecSL, DateTime runDateTime) { foreach (staffSpec ss in aStaffSpecSL.Values) { string y = ""; mAttributeValues = GetLDAPInfo("cn=" + ss.NDSName); Boolean grpExists = false; foreach (String grp in attributeArray("grpmbr")) { if (buildGroupContext(grp) == ss.ActionData.Replace("Group=", "").ToString().ToUpper()) { grpExists = true; break; } } if (!grpExists) { mTestedOK.Add(ss.queueItem.ToString()); } if (ss.attempts > mTryCount) { mFailed.Add(ss.queueItem.ToString()); } } }
protected override void testSelectedPhase(staffSpecSL aStaffSpecSL, DateTime runDateTime) { //if nds account not exist then delete is true //write a defaultDelete job in the coupler with updateCouplerMessageQueueSet() ? // //DateTime theDate = DateTime.Parse("31 Dec 2006 21:00:00"); //TimeSpan timeOnly = theDate.TimeOfDay; //DateTime theDateNow = DateTime.Now; //TimeSpan timeOnlyNow = theDateNow.TimeOfDay; //bool result; //result = timeOnlyNow > timeOnly; //if (result) //{ foreach (staffSpec ss in aStaffSpecSL.Values) { mAttributeValues = GetLDAPInfo("cn=" + ss.NDSName); if (mAttributeValues == null) //if (attributeValue("logindisabled").ToLower() == "true") { staffUtility.writeCouplerMessageQueue(ss.NDSName, ss.QLId); staffUtility.updateWcStaffIdentity(ss.NDSName, "SET job_Title = DELETED NDS record"); mTestedOK.Add(ss.queueItem.ToString()); } else if (ss.attempts > mTryCount) { mFailed.Add(ss.queueItem.ToString()); } } //} }
protected override void testSelectedPhase(staffSpecSL aStaffSpecSL, DateTime runDateTime) { DataView wDV; String sqlInsert; foreach (staffSpec ss in aStaffSpecSL.Values) { mAttributeValues = GetLDAPInfo("cn=" + ss.NDSName); string logEx = attributeValue("loginexpirationtime").ToString(); string description = "Enabled=" + ss.queueItem.ToString().Trim(); // set the test value for NDS // the decription from NDS should have the queueItem after a successful enable e.g. "Enabled=10817@07/11/2010 20:18". // split the NDS description to get the queuItem string[] descriptions = attributeValue("description").ToString().Trim().Split('@'); String LD = "FALSE";//set default FALSE for Attribute value LoginDisabled does not exist, this means that the account is enabled. if (mAttributeValues.ContainsKey("logindisabled")) { LD = "TRUE"; //attribute value LoginDisabled exists } if (!ss.WhenRead) { staffUtility.writeCouplerMessageQueueV2(ss.NDSName, "", "ExchangeConnect"); // Create a coupler job for re-enabling Exchange. } if (!ss.WhenRead) { staffUtility.writeCouplerMessageQueueV2(ss.NDSName, "", "RestoreGoogle"); // Write a coupler job to create a Google account } if ((attributeValue("logindisabled").ToLower() == "false" || LD == "FALSE") && attributeValue("generationqualifier").ToString().Trim() == ss.StaffID.ToString().Trim() && descriptions[0].ToString().Trim() == description) { staffUtility.updateWcStaffIdentity(ss.NDSName, "SET NDSdisabled = 0"); staffUtility.wcIDMReSetStaffIdentity(ss.NDSName); sqlInsert = "wcIDMEnableDisableApplications " + ss.QLId.ToString() + ",'" + ss.NDSName.ToString() + "'," + "'T','T','Y','Y'"; wDV = staffUtility.readDataView(staffUtility.couplerDB, sqlInsert); if (wDV.Count > 0) { if ((wDV[0][0].ToString() == "1" && wDV[0][1].ToString() == "1" && wDV[0][2].ToString() == "1" && wDV[0][3].ToString() == "1") || (wDV[0][0].ToString() == "1" && wDV[0][1].ToString() == "1" && wDV[0][2].ToString() == "1" && wDV[0][3].ToString() == "3" && ss.EmpType.ToString().ToUpper() == "TEMP")) { mTestedOK.Add(ss.queueItem.ToString()); } } } else if (ss.attempts > mTryCount) { mFailed.Add(ss.queueItem.ToString()); } } }
protected override void testSelectedPhase(staffSpecSL aStaffSpecSL, DateTime runDateTime) { DataView wDV; String sqlInsert; String LD = "FALSE";//set default FALSE for Attribute value LoginDisabled does not exist, this means that the account is enabled. foreach (staffSpec ss in aStaffSpecSL.Values) { if ((mAttributeValues = GetLDAPInfo("cn=" + ss.NDSName.Trim())) != null) { String x = attributeValue("gwexpire").ToString(); String[] groups = attributeArray("grpmbr"); Boolean InGroups = false; Boolean allsites = false; Boolean vdi = false; if (groups != null) { if (groups.Length > 1) { for (int i = 0; i < groups.Length; i++) { if (groups[i].ToLower().Contains("allsites")) { allsites = true; } if (groups[i].ToLower().Contains("vdi_groups")) { vdi = true; } if (allsites && vdi) { InGroups = true; } } } } if (attributeValue("logindisabled").ToLower() == "false" && InGroups == true) { //studentUtility.updateWcStaffIdentity(ss.NDSName, "SET NDSdisabled = 0"); mTestedOK.Add(ss.queueItem.ToString()); } else if (ss.attempts > mTryCount) { mFailed.Add(ss.queueItem.ToString()); } } else if (ss.attempts > mTryCount) { mFailed.Add(ss.queueItem.ToString()); } } }
protected override void testSelectedPhase(staffSpecSL aStaffSpecSL, DateTime runDateTime) { DataView wDV; String sqlInsert; foreach (staffSpec ss in aStaffSpecSL.Values) { mAttributeValues = GetLDAPInfo("cn=" + ss.NDSName); if (attributeValue("logindisabled").ToLower() == "true") { staffUtility.updateWcStaffIdentity(ss.NDSName, "SET NDSdisabled = 1"); // update applications to disabled // SHD, EHD, QLR, phone_list // Disable Lync first then the AD processing can create a coupler job to disable excahnge if (ss.keepProxy == false) { staffUtility.writeCouplerMessageQueueV2(ss.NDSName, "", "ExchangeLyncDisable"); } if (ss.keepProxy == false) { staffUtility.writeCouplerMessageQueueV2(ss.NDSName, "", "SuspendGoogle"); } sqlInsert = "wcIDMEnableDisableApplications " + ss.QLId.ToString() + ",'" + ss.NDSName.ToString() + "'," + "'F','F','N','N'"; wDV = staffUtility.readDataView(staffUtility.couplerDB, sqlInsert); if (wDV.Count > 0) { if (((wDV[0][0].ToString() == "1" || wDV[0][0].ToString() == "3") && (wDV[0][1].ToString() == "1" || wDV[0][1].ToString() == "3") && (wDV[0][2].ToString() == "1" || wDV[0][2].ToString() == "3") && (wDV[0][3].ToString() == "1" || wDV[0][3].ToString() == "3")) || ((wDV[0][0].ToString() == "1" || wDV[0][0].ToString() == "3") && (wDV[0][1].ToString() == "1" || wDV[0][1].ToString() == "3") && (wDV[0][2].ToString() == "1" || wDV[0][2].ToString() == "3") && ss.EmpType.ToString().ToUpper() == "TEMP")) { mTestedOK.Add(ss.queueItem.ToString()); bool wB = staffUtility.sendEmail( "*****@*****.**", "*****@*****.**", "Staff Disable : " + ss.NDSName, "( " + ss.NDSName + " ) has been disabled in NDS. Please disable user in EXCHANGE.", null); } } } else if (ss.attempts > mTryCount) { mFailed.Add(ss.queueItem.ToString()); } } }
protected override void doSelectedPhase(staffSpecSL aStaffSpecSL, DateTime runDateTime) { if (aStaffSpecSL.Count > 0) { StreamWriter wNewNDSStream = new StreamWriter( mJRBFilesPath + runDateTime.ToString("yyyyMMddHHmmss") + ".txt" ); foreach (staffSpec ss in aStaffSpecSL.Values) { wNewNDSStream.WriteLine(doSelectedItem(ss)); } wNewNDSStream.Close(); } }
public void doPhase(DataView aCouplerDV, DateTime runDateTime) { aCouplerDV.RowFilter = "action='" + mActionName + "'"; aCouplerDV.Sort = "NDSName, queueItem desc"; if (aCouplerDV.Count > 0) { staffSpecSL wSSL = new staffSpecSL(aCouplerDV, mSkipped); doSelectedPhase(wSSL, runDateTime); foreach (staffSpec aSS in wSSL.Values) { mWritten.Add(aSS.queueItem.ToString()); } } }
protected override void testSelectedPhase(staffSpecSL aStaffSpecSL, DateTime runDateTime) { foreach (staffSpec ss in aStaffSpecSL.Values) { mAttributeValues = GetLDAPInfo("cn=" + ss.NDSName); // TEST NDS for the queueItem, this shows us that the jrbimprt has taken place. // NOTE - jrbimprt has to overwrite the description field with the queueItem because it is a global setting within the control file // the reason is we don't want some of the multivalued fields to have multi values // so if more than one // job has been sent for processing then only one job will test for complete and that will be the job // that was last processed by jrbimprt. // this is a problem because the system is 'disconnected' String description = "ChangeContactNDS=" + ss.queueItem.ToString().Trim(); // set the test value for NDS String[] Alldescriptions = attributeArray("description"); String isDone = "N"; if (Alldescriptions != null) { foreach (String NDSdescription in Alldescriptions) { String[] descriptions = NDSdescription.ToString().Trim().Split('@'); foreach (string NDSdesc in descriptions) { if (NDSdesc.ToString().Trim() == description) { isDone = "Y"; } } } } if (isDone == "Y") { // exec wcIDMupdateApplications - A call to upDateApplicationUserName with OLDNDS= current NDSname will update all relevant applications. staffUtility.writeCouplerMessageQueueV2(ss.NDSName, "OldNDS=" + ss.NDSName, "updateApplicationUserName"); //Udate the 'OLD_' fields in the phone_list; NDS and Groupwise have been updated. String IDM = "wcIDMSynchPhoneListFields " + Convert.ToInt64(ss.QLId); DataView wDV = staffUtility.readDataView(staffUtility.couplerDB, IDM); mTestedOK.Add(ss.queueItem.ToString()); } else if (ss.attempts > mTryCount) { mFailed.Add(ss.queueItem.ToString()); } } }
protected override void testSelectedPhase(staffSpecSL aStaffSpecSL, DateTime runDateTime) { foreach (staffSpec ss in aStaffSpecSL.Values) { mAttributeValues = GetLDAPInfo("cn=" + ss.NDSName); if (attributeValue("logindisabled").ToLower() == "true" && attributeValue("description").ToLower().Contains("trashed")) { //staffUtility.updateWcStaffIdentity(ss.NDSName, "SET NDSdisabled = 1"); mTestedOK.Add(ss.queueItem.ToString()); bool wB = staffUtility.sendEmail( "*****@*****.**", "*****@*****.**", "Staff Trashed : " + ss.NDSName, "( " + ss.NDSName + " ) has been trashed in NDS. Please ensure user is disabled in EXCHANGE.", null); } else if (ss.attempts > mTryCount) { mFailed.Add(ss.queueItem.ToString()); } } }
protected override void testSelectedPhase(staffSpecSL aStaffSpecSL, DateTime runDateTime) { // foreach (staffSpec ss in aStaffSpecSL.Values) { bool groupsDeleted = true; mAttributeValues = GetLDAPInfo("cn=" + ss.NDSName); if (attributeArray("grpmbr") != null) { if (attributeArray("grpmbr").Length > 0) // user is a member of a group { groupsDeleted = false; // commented out because we are now interested in any group. //string[] groups = attributeArray("grpmbr"); //foreach (string group in groups) //{ // if (group.ToLower().IndexOf("ou=groupwise,o=wc") > 1) // { // // this means that this user is still a member of an email group. // groupsDeleted = false; // } //} } } if (groupsDeleted) { mTestedOK.Add(ss.queueItem.ToString()); } else if (ss.attempts > mTryCount) { mFailed.Add(ss.queueItem.ToString()); } } }
protected override void testSelectedPhase(staffSpecSL aStaffSpecSL, DateTime runDateTime) { foreach (staffSpec ss in aStaffSpecSL.Values) { bool testChangeSite = true; DataView dv = staffUtility.couplerDV( "WHERE " + "(c.whenDone IS NULL) AND " + "(c.action='" + mActionName + "') AND " + "(NDSName='" + ss.NDSName + "') AND " + "(c.queueItem>" + ss.queueItem.ToString() + ")" ); if (dv != null) { if (dv.Count > 0) { testChangeSite = false; } } if (testChangeSite) { mAttributeValues = GetLDAPInfo("cn=" + ss.NDSName); String wADSPath = attributeValue("adspath"); String wTargetSite = ss.ActionData.Replace("NewSite=", ""); Boolean wDoneIt = false; switch (wTargetSite.ToUpper()) { case "LEAMINGTON SPA": wDoneIt = (wADSPath.IndexOf("ou=LSPA,o=WC") > 0); break; case "RUGBY": wDoneIt = (wADSPath.IndexOf("ou=RUG,o=WC") > 0); break; case "TRIDENT PARK": wDoneIt = (wADSPath.IndexOf("ou=TRIDENT,o=WC") > 0); break; case "MORETON MORRELL": wDoneIt = (wADSPath.IndexOf("ou=MM,o=WC") > 0); break; case "HENLEY IN ARDEN": wDoneIt = (wADSPath.IndexOf("ou=ARDN,o=WC") > 0); break; case "PERSHORE": wDoneIt = (wADSPath.IndexOf("ou=PER,o=WC") > 0); break; default: break; } if (wDoneIt) { // site change has completed so update the wcStaffIdentity // staffUtility.updateWcStaffIdentity(ss.NDSName, "SET loc_id = '" + wTargetSite.ToString().Trim() + "', location = '" + wTargetSite.ToString().Trim() + "'"); staffUtility.updatePhoneList(ss.EmpID, "SET site = '" + wTargetSite.ToString().Trim() + "'"); mTestedOK.Add(ss.queueItem.ToString()); } else if (ss.attempts > mTryCount) { mFailed.Add(ss.queueItem.ToString()); } } else { mTestedOK.Add(ss.queueItem.ToString()); } } }
protected override void testSelectedPhase(staffSpecSL aStaffSpecSL, DateTime runDateTime) { DataView wDV; String sqlInsert; String LD = "FALSE";//set default FALSE for Attribute value LoginDisabled does not exist, this means that the account is enabled. foreach (staffSpec ss in aStaffSpecSL.Values) { if ((mAttributeValues = GetLDAPInfo("cn=" + ss.NDSName)) != null) { if (attributeValue("surname") != null) { String[] groups = attributeArray("grpmbr"); Boolean InGroups = false; if (groups != null) { if (groups.Length > 1) { if ((groups[0].ToLower().Contains("allsites") || groups[0].ToLower().Contains("vdi_groups")) && ((groups[1].ToLower().Contains("allsites") || groups[1].ToLower().Contains("vdi_groups")))) { InGroups = true; } } } if (InGroups == false) { // create a coupler job to updateNDS staffUtility.writeCouplerMessageQueueV2(ss.NDSName, "", "UpdateNDS"); } } if (mAttributeValues.ContainsKey("logindisabled")) { LD = "TRUE"; //attribute value LoginDisabled exists } if (attributeValue("logindisabled").ToLower() == "false" || LD == "FALSE") { if (ss.EmpType.ToString().ToUpper() == "TEMP") { mTestedOK.Add(ss.queueItem.ToString()); //TEMP accounts do not have a PhoneList record. } staffUtility.updateWcStaffIdentity(ss.NDSName, "SET NDSdisabled = 0"); mTestedOK.Add(ss.queueItem.ToString()); //staffUtility.writeCouplerMessageQueueV2(ss.NDSName, "", "CreateHomeDirectory");// Write a coupler job to Enable an exchange account staffUtility.writeCouplerMessageQueueV2(ss.NDSName, "", "ExchangeEnable"); // Write a coupler job to Enable an exchange account staffUtility.writeCouplerMessageQueueV2(ss.NDSName, "", "CreateLearningChannel"); // Write a coupler job to create a learning channel account staffUtility.writeCouplerMessageQueueV2(ss.NDSName, "", "CreateGoogleLogins"); // Write a coupler job to create a Google account bool wB = staffUtility.sendEmail( "*****@*****.**", "*****@*****.**", "Staff Creation : " + ss.NDSName, "( " + ss.NDSName + " ) has been created in NDS. Please link user in to EXCHANGE.", null); sqlInsert = "wcIDMPhoneListUpdateEmail " + ss.QLId.ToString(); wDV = staffUtility.readDataView(staffUtility.couplerDB, sqlInsert); //if (wDV.Count > 0) //{ // if (wDV[0][0].ToString() == "1") // { // } //} } else if (ss.attempts > mTryCount) { mFailed.Add(ss.queueItem.ToString()); } } else if (ss.attempts > mTryCount) { mFailed.Add(ss.queueItem.ToString()); } } }
protected override void testSelectedPhase(staffSpecSL aStaffSpecSL, DateTime runDateTime) { }
protected override void testSelectedPhase(staffSpecSL aStaffSpecSL, DateTime runDateTime) { foreach (staffSpec ss in aStaffSpecSL.Values) { Boolean wNewLoginOk = false; String NewNDSName = ""; String[] AD = ss.ActionData.Split('='); if (AD[0].ToString() == "NewNDS") { NewNDSName = AD[1].ToString(); } // chect to see if the old nds name has been deleted mAttributeValues = GetLDAPInfo("cn=" + ss.NDSName); if (mAttributeValues == null) { // check to see if new nds name has been created mAttributeValues = GetLDAPInfo("cn=" + NewNDSName); if (mAttributeValues.Count > 0) { wNewLoginOk = true; } } if (wNewLoginOk) { // maybe put this in its own coupler class?l // Call staff identity NEW NDS login stored procedure here if (ss.QLId.ToString().Trim().ToLower() != "deleted") { String IDM = "wcIDMupdateNewNDSname " + Convert.ToInt64(ss.QLId); DataView wDV = staffUtility.readDataView(staffUtility.couplerDB, IDM); if (wDV.Count > 0) { if (wDV[0][0].ToString() == "1") { // Success mTestedOK.Add(ss.queueItem.ToString()); } else { if (ss.attempts > mTryCount) { mFailed.Add(ss.queueItem.ToString()); } } } } // TEST the stored Procedure wcIDMupdateNewNDSname here // then do the Application part in defaultCouplerUpdateUserName // maybe call the stored procedure wcIDMupdateNewNDSname to do this /* Success processing * 1. Update NDSName on original * wcStaffIdentity record * 2. Delete the IsPending='Y' * wcStaffIdentity record * 3. Add record to mTestedOk */ } else if (ss.attempts > mTryCount) { mFailed.Add(ss.queueItem.ToString()); } } }
protected virtual void testSelectedPhase(staffSpecSL aStaffSpecSL, DateTime runDateTime) { }