/// <summary> /// For a list of users, get their emails from ActiveDirectory /// </summary> /// <param name="releaseDTO"></param> /// <param name="users"></param> /// <returns></returns> private List <string> getEmailAddresses(ADO_readerOutput users) { List <string> emails = new List <string>(); ADO ado = new ADO("defaultConnection"); try { ActiveDirectory_ADO adAdo = new ActiveDirectory_ADO(); adAdo.MergeAdToUsers(ref users); } catch (Exception ex) { throw ex; } finally { ado.Dispose(); } foreach (var v in users.data) { //Only send mails if the user notification flag is set in their profile if ((bool)v.CcnNotificationFlag) { emails.Add(v.CcnEmail.ToString()); } } return(emails); }
/// <summary> /// Read live releases for a given release, matrix and language codes /// </summary> /// <param name="releaseCode"></param> /// <param name="matrixCode"></param> /// <returns></returns> internal dynamic ReadLiveNow(int releaseCode, string matrixCode, string languageIsoCode) { var paramList = new List <ADO_inputParams>(); if (releaseCode > 0) { paramList.Add(new ADO_inputParams { name = "@RlsCode", value = releaseCode }); } if (!String.IsNullOrEmpty(matrixCode)) { paramList.Add(new ADO_inputParams { name = "@MtrCode", value = matrixCode }); } if (!String.IsNullOrEmpty(languageIsoCode)) { paramList.Add(new ADO_inputParams { name = "@LngIsoCode", value = languageIsoCode }); } ADO_readerOutput output = ado.ExecuteReaderProcedure("Data_Release_Live_Now", paramList); if (output.hasData) { if (output.data.Count == 1) { return(output.data[0]); } else if (output.data.Count > 1) { //We will return the matrix in the preferred language if possible, otherwise we will just revert to the version in the default language. var vPreferred = from x in output.data where x.LngIsoCode == languageIsoCode select x; if (vPreferred.ToList().Count > 0) { return(vPreferred.ToList()[0]); } var vDefault = from x in output.data where x.LngIsoCode == Configuration_BSO.GetCustomConfig("language.iso.code") select x; if (vDefault.ToList().Count > 0) { return(vDefault.ToList()[0]); } } } return(null); }
/// <summary> /// Reads the account table based on an Account_DTO_Read parameter /// </summary> /// <param name="ado"></param> /// <param name="account"></param> /// <returns></returns> internal ADO_readerOutput Read(ADO ado, Account_DTO_Read account) { List <ADO_inputParams> paramList = new List <ADO_inputParams>(); if (!string.IsNullOrEmpty(account.CcnUsername)) { paramList.Add(new ADO_inputParams() { name = "@CcnUsername", value = account.CcnUsername }); } if (!string.IsNullOrEmpty(account.PrvCode)) { paramList.Add(new ADO_inputParams() { name = "@PrvCode", value = account.PrvCode }); } ADO_readerOutput output = ado.ExecuteReaderProcedure("Security_Account_Read", paramList); return(output); }
/// <summary> /// Reads a Copyright /// </summary> /// <param name="ado"></param> /// <param name="copyright"></param> /// <returns></returns> internal ADO_readerOutput Read(ADO ado, Copyright_DTO_Read copyright) { ADO_readerOutput output = new ADO_readerOutput(); List <ADO_inputParams> paramList = new List <ADO_inputParams>(); if (!string.IsNullOrEmpty(copyright.CprCode)) { paramList.Add(new ADO_inputParams() { name = "@CprCode", value = copyright.CprCode }); } if (!string.IsNullOrEmpty(copyright.CprValue)) { paramList.Add(new ADO_inputParams() { name = "@CprValue", value = copyright.CprValue }); } //Call the stored procedure output = ado.ExecuteReaderProcedure("System_Settings_Copyright_Read", paramList); //return the list of entities that have been found return(output); }
/// <summary> /// Execute /// </summary> /// <returns></returns> protected override bool Execute() { //Validation of parameters and user have been successful. We may now proceed to read from the database var adoWorkflow = new Workflow_ADO(); ADO_readerOutput result = adoWorkflow.ReadLive(Ado, SamAccountName, DTO); if (!result.hasData) { return(false); } var adoAd = new ActiveDirectory_ADO(); adoAd.MergeAdToUsers(ref result); Response.data = result.data; return(true); }
/// <summary> /// Execute /// </summary> /// <returns></returns> protected override bool Execute() { //Validation of parameters and user have been successful. We may now proceed to read from the database var adoAccount = new Account_ADO(); //Accounts are returned as an ADO result if (DTO.CcnUsername == null) { DTO.CcnUsername = SamAccountName; } ADO_readerOutput result = adoAccount.Read(Ado, DTO); //Merge the data with Active Directory data if (result.hasData) { ActiveDirectory_ADO adAdo = new ActiveDirectory_ADO(); adAdo.MergeAdToUsers(ref result); if (!string.IsNullOrEmpty(DTO.CcnUsername)) { adAdo.MergeGroupsToUsers(Ado, ref result); } Response.data = result.data; return(true); } Log.Instance.Debug("No Account data found"); return(false); }
/// <summary> /// Read workflow history /// </summary> /// <param name="ado"></param> /// <param name="rlsCode"></param> /// <param name="userName"></param> /// <returns></returns> internal ADO_readerOutput ReadHistory(ADO ado, int rlsCode, string userName) { ADO_readerOutput output = new ADO_readerOutput(); var inputParams = new List <ADO_inputParams>() { new ADO_inputParams() { name = "@CcnUsername", value = userName }, new ADO_inputParams() { name = "@RlsCode", value = rlsCode } }; //Call the stored procedure output = ado.ExecuteReaderProcedure("Workflow_ReadHistory", inputParams); //Read the result of the call to the database if (output.hasData) { Log.Instance.Debug("Data found"); } else { //No data found Log.Instance.Debug("No data found"); } //return the list of entities that have been found return(output); }
/// <summary> /// Execute /// </summary> /// <returns></returns> protected override bool Execute() { DTO.CcnUsername = SamAccountName; if (!IsUserAuthenticated()) { return(true); } JSONRPC_Output response = new JSONRPC_Output(); //The cache key is created to be unique to a given CcnUsername. MemCachedD_Value cache = MemCacheD.Get_BSO <dynamic>("PxStat.Security", "Account_API", "ReadCurrentAccesss", DTO.CcnUsername); if (cache.hasData) { Response.data = cache.data; return(true); } Account_BSO bso = new Account_BSO(); ADO_readerOutput output = bso.ReadCurrentAccess(Ado, DTO.CcnUsername); if (!output.hasData) { Log.Instance.Debug("No Account data found"); return(false); } Response.data = output.data; return(true); }
/// <summary> /// Execute /// </summary> /// <returns></returns> protected override bool Execute() { //only if the WorkflowRequest is AwaitingResponse Workflow_ADO wfAdo = new Workflow_ADO(); ADO_readerOutput output = wfAdo.ReadAwaitingResponse(Ado, SamAccountName, DTO.RlsCode, Configuration_BSO.GetCustomConfig("language.iso.code")); if (!output.hasData) { Log.Instance.Debug("No valid AwaitingResponse workflow found for RlsCode " + DTO.RlsCode); return(false); } WorkflowRequest_ADO wfReqAdo = new WorkflowRequest_ADO(); int deleted = wfReqAdo.Delete(Ado, DTO.RlsCode, SamAccountName); if (deleted == 0) { Log.Instance.Debug("Can't delete the workflow for RlsCode " + DTO.RlsCode); return(false); } Response.data = JSONRPC.success; return(true); }
/// <summary> /// Reads a Reson entity /// </summary> /// <param name="ado"></param> /// <param name="reason"></param> /// <returns></returns> internal ADO_readerOutput Read(ADO ado, Reason_DTO_Read reason) { ADO_readerOutput output = new ADO_readerOutput(); List <ADO_inputParams> paramList = new List <ADO_inputParams>(); if (reason.RlsCode != default(int)) { paramList.Add(new ADO_inputParams() { name = "@RlsCode", value = reason.RlsCode }); } if (reason.RsnCode != null) { paramList.Add(new ADO_inputParams() { name = "@RsnCode", value = reason.RsnCode }); } paramList.Add(new ADO_inputParams() { name = "@LngIsoCode", value = reason.LngIsoCode }); //Call the stored procedure output = ado.ExecuteReaderProcedure("System_Settings_Reason_Read", paramList); //return the list of entities that have been found return(output); }
/// <summary> /// Adds the retrieved Active Directory information to the list of users /// </summary> /// <param name="result"></param> internal void MergeAdToUsers(ref ADO_readerOutput result) { // Get Active Directory IDictionary <string, dynamic> adDirectory; // List all users adDirectory = ActiveDirectory.List(); foreach (var user in result.data) { if (adDirectory.ContainsKey(user.CcnUsername)) { user.CcnEmail = adDirectory[user.CcnUsername].EmailAddress; user.CcnDisplayName = adDirectory[user.CcnUsername].GivenName + " " + adDirectory[user.CcnUsername].Surname; } else { if (!((IDictionary <string, Object>)user).ContainsKey("CcnDisplayName")) { user.CcnDisplayName = null; } if (user.CcnUsername != null && Regex.IsMatch(user.CcnUsername, Utility.GetCustomConfig("APP_REGEX_EMAIL"))) { user.CcnEmail = user.CcnUsername; } else { user.CcnEmail = null; } } } }
/// <summary> /// Checks if a user/group combination already exists in the database /// </summary> /// <param name="ado"></param> /// <param name="dto"></param> /// <returns></returns> internal bool Exists(ADO ado, string ccnUsername, string grpCode) { List <ADO_inputParams> paramList = new List <ADO_inputParams>() { new ADO_inputParams() { name = "@CcnUsername", value = ccnUsername }, new ADO_inputParams() { name = "@GrpCode", value = grpCode } }; ADO_readerOutput output = ado.ExecuteReaderProcedure("Security_GroupAccount_Read", paramList); if (output.hasData) { return(true); // the entity in question exists in the database already } else { return(false); // the entity in question doesn't already exist in the database } }
/// <summary> /// This method adds the groups to a list of users /// </summary> /// <param name="ado"></param> /// <param name="users"></param> /// <returns></returns> internal void MergeGroupsToUsers(ADO ado, ref ADO_readerOutput resultUsers) { GroupAccount_ADO adoGroupAccount = new GroupAccount_ADO(); //cycle through each user in the list and get the group data if (resultUsers.hasData) { foreach (var user in resultUsers.data) { GroupAccount_DTO_Read gpAccDto = new GroupAccount_DTO_Read(); gpAccDto.CcnUsername = user.CcnUsername; //Get the group data for the user ADO_readerOutput resultGroups = adoGroupAccount.Read(ado, gpAccDto); if (resultGroups.hasData) { user.UserGroups = new List <GroupAccount_DTO>(); foreach (var group in resultGroups.data) {// add the new data to the output GroupAccount_DTO groupAccountDTO = new GroupAccount_DTO(); groupAccountDTO.GrpName = group.GrpName; groupAccountDTO.GrpCode = group.GrpCode; groupAccountDTO.GccApproveFlag = group.GccApproveFlag; // add group to the user user.UserGroups.Add(groupAccountDTO); } } } } }
/// <summary> /// Get a list of users involved in a specific release. The isApprover flag is ignored if it is false /// </summary> /// <param name="ado"></param> /// <param name="rlsCode"></param> /// <param name="isApprover"></param> /// <param name="prvCode"></param> /// <returns></returns> internal ADO_readerOutput ReadReleaseUsers(ADO ado, int rlsCode, bool?isApprover, string prvCode = null) { List <ADO_inputParams> paramList = new List <ADO_inputParams>() { new ADO_inputParams() { name = "@RlsCode", value = rlsCode } }; if (isApprover != null) { paramList.Add(new ADO_inputParams() { name = "@GccApproveFlag", value = (bool)isApprover }); } if (prvCode != null) { paramList.Add(new ADO_inputParams() { name = "@PrvCode", value = prvCode }); } ADO_readerOutput output = ado.ExecuteReaderProcedure("Security_Account_ReadReleaseApprovers", paramList); return(output); }
internal dynamic Search(Navigation_DTO_Search dto) { //The ExecuteReaderProcedure method requires that the parameters be contained in a List<ADO_inputParams> List <ADO_inputParams> paramList = new List <ADO_inputParams>() { new ADO_inputParams() { name = "@LngIsoCode", value = dto.LngIsoCode } }; ADO_inputParams param = new ADO_inputParams() { name = "@Search", value = dto.SearchTerms }; param.typeName = "KeyValueVarcharAttribute"; paramList.Add(param); //We need a count of search terms (ignoring duplicates caused by singularisation) //Call the stored procedure ADO_readerOutput output = ado.ExecuteReaderProcedure("System_Navigation_Search", paramList); return(output.data); }
/// <summary> /// Returns the Groups to which the ccnUsername has access /// </summary> /// <param name="ado"></param> /// <param name="ccnUsername"></param> /// <returns></returns> internal ADO_readerOutput ReadAccess(ADO ado, string ccnUsername) { ADO_readerOutput output = new ADO_readerOutput(); List <ADO_inputParams> paramList = new List <ADO_inputParams>() { new ADO_inputParams() { name = "@CcnUsername", value = ccnUsername } }; //Call the stored procedure output = ado.ExecuteReaderProcedure("Security_Group_ReadAccess", paramList); //Read the result of the call to the database if (output.hasData) { Log.Instance.Debug("Data found"); } else { //No data found Log.Instance.Debug("No data found"); } //return the list of entities that have been found return(output); }
internal dynamic ReadSearchResults(DataTable dtMatrixResults, string lngIsoCode) { List <ADO_inputParams> paramList = new List <ADO_inputParams>() { new ADO_inputParams() { name = "@LngIsoCode", value = lngIsoCode }, new ADO_inputParams() { name = "@DefaultLngIsoCode", value = Configuration_BSO.GetCustomConfig(ConfigType.global, "language.iso.code") } }; ADO_inputParams param = new ADO_inputParams() { name = "@Result", value = dtMatrixResults }; param.typeName = "KeyValueVarcharAttribute"; paramList.Add(param); //Call the stored procedure ADO_readerOutput output = ado.ExecuteReaderProcedure("System_Navigation_Search_Read", paramList); return(output.data); }
/// <summary> /// Reads one or more Groups /// </summary> /// <param name="ado"></param> /// <param name="group"></param> /// <returns></returns> internal ADO_readerOutput Read(ADO ado, Group_DTO_Read group) { ADO_readerOutput output = new ADO_readerOutput(); List <ADO_inputParams> paramList = new List <ADO_inputParams>(); if (!string.IsNullOrEmpty(group.GrpCode)) { //We will only have one input parameter and we pass the value of the GrpCode to it: paramList.Add(new ADO_inputParams() { name = "@GrpCode", value = group.GrpCode }); } //Call the stored procedure output = ado.ExecuteReaderProcedure("Security_Group_Read", paramList); //Read the result of the call to the database if (output.hasData) { Log.Instance.Debug("Data found"); } else { //No data found Log.Instance.Debug("No data found"); } //return the list of entities that have been found return(output); }
/// <summary> /// Reads a ReasonRelease entity /// </summary> /// <param name="ado"></param> /// <param name="reasonRelease"></param> /// <returns></returns> internal ADO_readerOutput Read(ADO ado, ReasonRelease_DTO_Read reasonRelease) { ADO_readerOutput output = new ADO_readerOutput(); List <ADO_inputParams> inputParamList = new List <ADO_inputParams>() { new ADO_inputParams() { name = "@RlsCode", value = reasonRelease.RlsCode }, new ADO_inputParams() { name = "@LngIsoCode", value = reasonRelease.LngIsoCode } }; if (reasonRelease.RsnCode != null) { inputParamList.Add(new ADO_inputParams() { name = "@RsnCode", value = reasonRelease.RsnCode }); } //Call the stored procedure output = ado.ExecuteReaderProcedure("Data_Reason_Release_Read", inputParamList); //return the list of entities that have been found return(output); }
/// <summary> /// Execute /// </summary> /// <returns></returns> protected override bool Execute() { if (Request.sessionCookie == null) { Response.error = Label.Get("error.authentication"); return(false); } ADO_readerOutput user = null; using (Login_BSO lBso = new Login_BSO()) { user = lBso.ReadBySession(Request.sessionCookie.Value); if (user.hasData) { if (user.data[0].CcnEmail == null) { DTO.CcnUsername = user.data[0].CcnUsername; ActiveDirectory_ADO adAdo = new ActiveDirectory_ADO(); ActiveDirectory_DTO adDto = adAdo.GetUser(Ado, DTO); if (adDto.CcnDisplayName != null) { user.data[0].CcnEmail = adDto.CcnEmail; } } Response.data = user.data; return(true); } else { Response.error = Label.Get("error.authentication"); return(false); } } }
/// <summary> /// Execute /// </summary> /// <returns></returns> protected override bool Execute() { if (IsUserAuthenticated()) { if (AuthenticationType != authenticationType) { return(false); } } DTO.CcnUsername = SamAccountName; Log.Instance.Debug("ReadCurrentAccess SamAccountName:" + DTO.CcnUsername); if (DTO.CcnUsername == null) { Response.data = null; return(true); } Account_BSO bso = new Account_BSO(Ado); ADO_readerOutput output = bso.ReadCurrentAccess(Ado, DTO.CcnUsername); if (!output.hasData) { Log.Instance.Debug("No Account data found"); return(false); } Response.data = output.data[0]; return(true); }
protected override bool Execute() { if (!ReCAPTCHA.Validate(DTO.Captcha)) { Response.error = Label.Get("error.authentication"); return(false); } ActiveDirectory_ADO adAdo = new ActiveDirectory_ADO(); ActiveDirectory_DTO adDto = adAdo.GetUser(Ado, DTO); dynamic adUser = adAdo.GetAdSpecificDataForEmail(DTO.CcnEmail); if (adUser?.CcnEmail != null) { DTO.CcnEmail = adUser.CcnEmail; DTO.CcnDisplayname = adUser.CcnDisplayName; DTO.CcnUsername = adUser.CcnUsername; } else { Account_ADO aAdo = new Account_ADO(); var user = aAdo.Read(Ado, new Account_DTO_Read() { CcnUsername = DTO.CcnEmail }); if (!user.hasData) { Response.data = JSONRPC.success; return(true); } if (user.data[0].CcnEmail.Equals(DBNull.Value) || user.data[0].CcnDisplayName.Equals(DBNull.Value)) { Response.data = JSONRPC.success; return(true); } DTO.CcnDisplayname = user.data[0].CcnDisplayName; DTO.CcnEmail = user.data[0].CcnEmail; DTO.CcnUsername = DTO.CcnEmail; } Login_BSO lBso = new Login_BSO(Ado); ADO_readerOutput output = lBso.ReadByToken2Fa(DTO.LgnToken2Fa, DTO.CcnUsername); if (!output.hasData) { return(false); } //create a 2fa, save it to the database, unlock the account and send the 2fa back to the client to be displayed as a QRCode string token = lBso.Update2FA(new Login_DTO_Create2FA() { LgnToken2Fa = DTO.LgnToken2Fa, CcnUsername = DTO.CcnUsername }); Response.data = token; return(true); }
/// <summary> /// Execute /// </summary> /// <returns></returns> protected override bool Execute() { //Translate from bbCode to html Resources.BBCode bbc = new Resources.BBCode(); DTO.Body = bbc.Transform(DTO.Body); List <string> groupCodes = new List <string>(); GroupAccount_ADO gAdo = new GroupAccount_ADO(); foreach (var code in DTO.GroupCodes) { groupCodes.Add(code.GrpCode); } //Get accounts associated with the Group(s) ADO_readerOutput readGroupAccounts = gAdo.ReadMultiple(Ado, groupCodes); Account_ADO accAdo = new Account_ADO(); Account_DTO_Read dtoRead = new Account_DTO_Read(); dtoRead.PrvCode = Resources.Constants.C_SECURITY_PRIVILEGE_POWER_USER; ADO_readerOutput readPowerUsers = accAdo.Read(Ado, dtoRead); //Get the AD data associated with the users, specifically ActiveDirectory_ADO adAdo = new ActiveDirectory_ADO(); adAdo.MergeAdToUsers(ref readGroupAccounts); adAdo.MergeAdToUsers(ref readPowerUsers); eMail email = new eMail(); if (!readGroupAccounts.hasData && !readPowerUsers.hasData) { Response.data = JSONRPC.success; Log.Instance.Debug("No email addresses found"); return(true); } foreach (var user in readGroupAccounts.data) { email.Bcc.Add(user.CcnEmail.ToString()); } foreach (var user in readPowerUsers.data) { email.Bcc.Add(user.CcnEmail.ToString()); } email.Subject = DTO.Subject; email.Body = DTO.Body; sendMail(email, Configuration_BSO.GetCustomConfig("title"), DTO.Subject, DTO.Body); Response.data = JSONRPC.success; return(true); }
/// <summary> /// Checks if the user is registered on the system /// </summary> /// <param name="ado"></param> /// <param name="ccnUsername"></param> /// <returns></returns> internal bool IsRegistered(ADO ado, string ccnUsername) { Account_ADO accountAdo = new Account_ADO(); Account_DTO_Read dto = new Account_DTO_Read(); dto.CcnUsername = ccnUsername; ADO_readerOutput output = accountAdo.Read(ado, dto); return(output.hasData); }
/// <summary> /// Send email notification after Response /// Emails sent to Group of the release and all Power Users /// </summary> /// <param name="rspDTO"></param> /// <param name="releaseDTO"></param> internal void EmailResponse(WorkflowRequest_DTO requestDTO, WorkflowResponse_DTO rspDTO, Release_DTO releaseDTO) { eMail email = new eMail(); Account_BSO aBso = new Account_BSO(); ADO_readerOutput recipients = new ADO_readerOutput(); string subject = ""; string body = ""; string releaseUrl = getReleaseUrl(releaseDTO); string rqsvalue = Label.Get("workflow.request." + requestDTO.RqsValue); switch (rspDTO.RspCode) { case Constants.C_WORKFLOW_STATUS_APPROVE: //Send the email to power users only recipients = aBso.getUsersOfPrivilege(Resources.Constants.C_SECURITY_PRIVILEGE_POWER_USER); subject = string.Format(Label.Get("email.subject.response-approve"), releaseDTO.MtrCode, releaseDTO.RlsVersion, releaseDTO.RlsRevision); body = string.Format(Label.Get("email.body.response-approve"), rqsvalue, releaseDTO.MtrCode, releaseDTO.RlsVersion, releaseDTO.RlsRevision, releaseUrl, rspDTO.ResponseAccount.CcnEmail, rspDTO.ResponseAccount.CcnUsername, rspDTO.ResponseAccount.CcnName); break; case Constants.C_WORKFLOW_STATUS_REJECT: //Send the email to recipients = aBso.getReleaseUsers(releaseDTO.RlsCode, false); subject = string.Format(Label.Get("email.subject.response-reject"), releaseDTO.MtrCode, releaseDTO.RlsVersion, releaseDTO.RlsRevision); body = string.Format(Label.Get("email.body.response-reject"), rqsvalue, releaseDTO.MtrCode, releaseDTO.RlsVersion, releaseDTO.RlsRevision, releaseUrl, rspDTO.ResponseAccount.CcnEmail, rspDTO.ResponseAccount.CcnUsername, rspDTO.ResponseAccount.CcnName); break; } List <string> allEmails = new List <string>(); allEmails.AddRange(getEmailAddresses(recipients)); if (allEmails.Count == 0) { return; } foreach (string person in allEmails) { email.Bcc.Add(person); } sendMail(email, Configuration_BSO.GetCustomConfig("title"), subject, body); email.Dispose(); }
/// <summary> /// Execute /// </summary> /// <returns></returns> protected override bool Execute() { Analytic_ADO ado = new Analytic_ADO(Ado); ADO_readerOutput outputSummary = ado.ReadEnvironmentLanguage(DTO, SamAccountName); if (outputSummary.hasData) { Response.data = FormatData(outputSummary.data); return(true); } return(false); }
/// <summary> /// Execute /// </summary> /// <returns></returns> protected override bool Execute() { Navigation_ADO adoNav = new Navigation_ADO(Ado); //If we're cacheing, we only want the cache to live until the next scheduled release goes live //Also, if there is a next release before the scheduled cache expiry time, then we won't trust the cache var nextRelease = adoNav.ReadNextLiveDate(DateTime.Now); DateTime nextReleaseDate = default; if (nextRelease.hasData) { if (!nextRelease.data[0].NextRelease.Equals(DBNull.Value)) { nextReleaseDate = Convert.ToDateTime(nextRelease.data[0].NextRelease); } } //Read the cached value for this if it's available but only if there isn't a next release before the cache expiry time MemCachedD_Value cache = MemCacheD.Get_BSO <dynamic>("PxStat.System.Navigation", "Navigation_API", "Read", DTO); if (cache.hasData && nextReleaseDate >= cache.expiresAt) { Response.data = cache.data; return(true); } //No cache available, so read from the database and cache that result ADO_readerOutput result = adoNav.Read(DTO); if (result.hasData) { List <dynamic> formattedOutput = formatOutput(result.data); if (nextRelease != null) { if (nextRelease.hasData) { if (!nextRelease.data[0].NextRelease.Equals(DBNull.Value)) { nextReleaseDate = Convert.ToDateTime(nextRelease.data[0].NextRelease); } } } Response.data = formattedOutput; MemCacheD.Store_BSO <dynamic>("PxStat.System.Navigation", "Navigation_API", "Read", DTO, Response.data, nextReleaseDate, Resources.Constants.C_CAS_NAVIGATION_READ); return(true); } return(false); }
/// <summary> /// Execute /// </summary> /// <returns></returns> protected override bool Execute() { Analytic_ADO ado = new Analytic_ADO(Ado); ADO_readerOutput outputSummary = ado.ReadTimeline(DTO); if (outputSummary.hasData) { Response.data = outputSummary.data; return(true); } return(false); }
protected override bool Execute() { if (!ReCAPTCHA.Validate(DTO.Captcha)) { Response.error = Label.Get("error.authentication"); return(false); } Login_BSO lBso = new Login_BSO(Ado); Account_ADO aAdo = new Account_ADO(); ADO_readerOutput responseUser = aAdo.Read(Ado, DTO.CcnEmail); //If this is an AD user using their email as an identifier then we must get their details from AD if (!responseUser.hasData) { ActiveDirectory_ADO adAdo = new ActiveDirectory_ADO(); var adResult = adAdo.GetAdSpecificDataForEmail(DTO.CcnEmail); if (adResult == null) { Response.error = Label.Get("error.authentication"); return(false); } //Check if AD local access is allowed if (!Configuration_BSO.GetCustomConfig(ConfigType.global, "security.adOpenAccess") && adResult != null) { Response.error = Label.Get("error.authentication"); return(false); } DTO.CcnUsername = adResult.CcnUsername; } else { DTO.CcnUsername = responseUser.data[0].CcnUsername; } var response = lBso.Update2FA(DTO); if (response != null) { Response.data = response; return(true); } Response.error = Label.Get("error.authentication"); return(false); }
/// <summary> /// Reads account based on account name /// </summary> /// <param name="ado"></param> /// <param name="CcnUsername"></param> /// <returns></returns> internal ADO_readerOutput Read(ADO ado, string CcnUsername) { List <ADO_inputParams> paramList = new List <ADO_inputParams>(); paramList.Add(new ADO_inputParams() { name = "@CcnUsername", value = CcnUsername }); ADO_readerOutput output = ado.ExecuteReaderProcedure("Security_Account_Read", paramList); return(output); }