public override void Execute() { if (!String.IsNullOrEmpty(model.Data.UserName) && !model.Data.UserName.ToUpper().Contains("LOCAL SYSTEM") && !model.Data.UserName.ToUpper().Equals("ADMINISTRATOR") && !model.Data.UserName.ToUpper().Contains(model.Data.ComputerName)) { if (DatabaseHelpers.AccountExists(model.Data.UserName)) { int daysValid = Convert.ToInt32(config.LDAP_DAYS_VALID); DateTime accountTimestamp = DatabaseHelpers.GetAccountTimestamp(model.Data.UserName); DateTime validUntilDate = accountTimestamp.AddDays(daysValid); if (DateTime.UtcNow.Date > validUntilDate) { log.Debug("AD Lookup rule enabled, account " + model.Data.UserName + " already exists however the days valid threshold has been exceeded, performing LDAP query for new metadata"); LdapQuery(); } } else { log.Debug("AD Lookup rule enabled, account " + model.Data.UserName + " does not exist in LDAP database"); LdapQuery(); } } }