Skip to content

Commit

Permalink
merge with develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcus-Goectau committed Nov 1, 2023
2 parents 57451dc + f38211e commit 3698bf9
Show file tree
Hide file tree
Showing 56 changed files with 458 additions and 197 deletions.
30 changes: 24 additions & 6 deletions CSETWebApi/CSETWeb_Api/CSETWebCore.Business/Acet/AcetBusiness.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,10 @@ public static Dictionary<int, SpanishQuestionRow> buildQuestionDictionary()
{
try
{
dict.Add(item.Value.Mat_Question_Id, item.Value);
if (!dict.ContainsKey(item.Value.Mat_Question_Id))
{
dict.Add(item.Value.Mat_Question_Id, item.Value);
}
}
catch (Exception e)
{
Expand Down Expand Up @@ -285,7 +288,10 @@ public static Dictionary<int, GroupingSpanishRow> buildGroupingDictionary()
{
try
{
dict.Add(item.Value.Grouping_Id, item.Value);
if (!dict.ContainsKey(item.Value.Grouping_Id))
{
dict.Add(item.Value.Grouping_Id, item.Value);
}
}
catch (Exception e)
{
Expand Down Expand Up @@ -326,7 +332,10 @@ public static Dictionary<string, GroupingSpanishRow> buildResultsGroupingDiction
{
try
{
dict.Add(item.Value.English_Title, item.Value);
if (!dict.ContainsKey(item.Value.English_Title))
{
dict.Add(item.Value.English_Title, item.Value);
}
}
catch (Exception e)
{
Expand Down Expand Up @@ -365,7 +374,10 @@ public static Dictionary<int, IRPModel> buildIRPDictionary()
{
try
{
dict.Add(item.Value.IRP_Id, item.Value);
if (!dict.ContainsKey(item.Value.IRP_Id))
{
dict.Add(item.Value.IRP_Id, item.Value);
}
}
catch (Exception e)
{
Expand Down Expand Up @@ -403,7 +415,10 @@ public static Dictionary<int, IRPSpanishRow> buildIRPHeaderDictionary()
{
try
{
dict.Add(item.Value.IRP_Header_Id, item.Value);
if (!dict.ContainsKey(item.Value.IRP_Header_Id))
{
dict.Add(item.Value.IRP_Header_Id, item.Value);
}
}
catch (Exception e)
{
Expand Down Expand Up @@ -443,7 +458,10 @@ public static Dictionary<string, IRPSpanishRow> buildIRPDashboardDictionary()
{
try
{
dict.Add(item.Value.EnglishHeader, item.Value);
if (!dict.ContainsKey(item.Value.EnglishHeader))
{
dict.Add(item.Value.EnglishHeader, item.Value);
}
}
catch (Exception e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
//
//
////////////////////////////////
using CSETWebCore.Business.Aggregation;
using CSETWebCore.Business.Maturity;
using CSETWebCore.DataLayer.Model;
using CSETWebCore.Helpers;
using CSETWebCore.Interfaces;
using CSETWebCore.Interfaces.Assessment;
using CSETWebCore.Interfaces.Contact;
Expand Down Expand Up @@ -152,13 +154,30 @@ public void CreateIrpHeaders(int assessmentId)
_context.SaveChanges();
}

/// <summary>
/// Returns the ISE Merit submission status
/// </summary>
public Boolean? GetIseSubmission(int assessmentId)
{
var query = from i in _context.INFORMATION
where i.Id == assessmentId
select i.Ise_Submitted;

var result = query.ToList().FirstOrDefault();
return result;
}

/// <summary>
/// Updates the INFORMATION table to track ISE Merit Submissions for NCUA
/// </summary>
public void UpdateIseSubmission(int assessmentId)
{
INFORMATION information = _context.INFORMATION.FirstOrDefault(a => a.Id == assessmentId);
if (information != null)
{
information.Ise_Submitted = true;
information.Submitted_Date = DateTime.Today;
}
information.Ise_Submitted = true;
_context.SaveChanges();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -852,5 +852,15 @@ public void SaveOtherRemarks(int assessmentId, string remark)
dd.StringValue = remark;
_context.SaveChanges();
}

public void clearFirstTime(int userid, int assessment_id)
{
var us = _context.USERS.Where(x => x.UserId == userid).FirstOrDefault();
if(us != null)
{
us.IsFirstLogin = false;
_context.SaveChanges();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,19 @@
</Column>
</Table>

<Table name="DETAILS_DEMOGRAPHICS" />

<Table name="CIS_CSI_SERVICE_DEMOGRAPHICS"/>

<Table name="CIS_CSI_USER_COUNTS"/>

<Table name="CIS_CSI_SERVICE_COMPOSITION_SECONDARY_DEFINING_SYSTEMS"/>

<Table name="CIS_CSI_SERVICE_COMPOSITION"/>

<Table name="CIS_CSI_ORGANIZATION_DEMOGRAPHICS"/>


<Table name="DOCUMENT_FILE">
<Column name="CreatedTimestamp">
<Rule action="defaultDatetime" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ public void CreateResourceLibraryData()

Dictionary<int, List<PROCUREMENTLANGUAGEDATA>> dictionaryProcurementLanguageData = new Dictionary<int, List<PROCUREMENTLANGUAGEDATA>>();

TinyMapper.Bind<PROCUREMENT_LANGUAGE_DATA, PROCUREMENTLANGUAGEDATA>();

foreach (PROCUREMENT_LANGUAGE_DATA data in dbContext.PROCUREMENT_LANGUAGE_DATA.ToList())
{
List<PROCUREMENTLANGUAGEDATA> list;
Expand Down Expand Up @@ -207,6 +209,8 @@ public void CreateResourceLibraryData()

Dictionary<int, List<CATALOGRECOMMENDATIONSDATA>> dictionaryCatalogRecommendations = new Dictionary<int, List<CATALOGRECOMMENDATIONSDATA>>();

TinyMapper.Bind<CATALOG_RECOMMENDATIONS_DATA, CATALOGRECOMMENDATIONSDATA>();

foreach (CATALOG_RECOMMENDATIONS_DATA data in dbContext.CATALOG_RECOMMENDATIONS_DATA.ToList())
{
List<CATALOGRECOMMENDATIONSDATA> list;
Expand All @@ -231,7 +235,6 @@ public void CreateResourceLibraryData()
procHeadingModel.Nodes.Add(procModel);
}
}

}
catch (Exception exc)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2720,6 +2720,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.ToTable(tb => tb.HasComment("A collection of USERS records"));
entity.Property(e => e.IsActive).HasDefaultValueSql("((1))");
entity.Property(e => e.IsFirstLogin).HasDefaultValueSql("((1))");
entity.Property(e => e.Lang).HasDefaultValueSql("('en')");
entity.Property(e => e.PasswordResetRequired).HasDefaultValueSql("((1))");
entity.Property(e => e.PreventEncrypt).HasDefaultValueSql("((1))");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public partial class INFORMATION
public int? Region_Code { get; set; }

public bool? Ise_Submitted { get; set; }
public DateTime? Submitted_Date { get; set; }

[ForeignKey("Id")]
[InverseProperty("INFORMATION")]
Expand Down
3 changes: 3 additions & 0 deletions CSETWebApi/CSETWeb_Api/CSETWebCore.DataLayer/Model/USERS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public partial class USERS
[StringLength(10)]
public string Lang { get; set; }

[Required]
public bool? IsFirstLogin { get; set; }

[InverseProperty("AssessmentCreator")]
public virtual ICollection<ASSESSMENTS> ASSESSMENTS { get; set; } = new List<ASSESSMENTS>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ namespace CSETWebCore.DataLayer.Model
{
public partial class usp_Assessments_Completion_For_UserResult
{

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ public partial class usp_Assessments_For_UserResult
public bool? AltTextMissing { get; set; }
public int? UserId { get; set; }
public bool? IseSubmitted { get; set; }
public DateTime? SubmittedDate { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1409,6 +1409,7 @@
"UseLegacyPluralizer": false,
"UseManyToManyEntity": true,
"UseNoDefaultConstructor": false,
"UseNoNavigations": false,
"UseNoObjectFilter": false,
"UseNodaTime": false,
"UseNullableReferences": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ public LoginResponse Authenticate(Login login)
ResetRequired = loginUser.PasswordResetRequired ?? true,
ExportExtension = IOHelper.GetExportFileExtension(login.Scope),
ImportExtensions = IOHelper.GetImportFileExtensions(login.Scope),
LinkerTime = new BuildNumberHelper().GetLinkerTime()
LinkerTime = new BuildNumberHelper().GetLinkerTime(),
IsFirstLogin = loginUser.IsFirstLogin??false
};


Expand Down Expand Up @@ -245,7 +246,8 @@ public LoginResponse AuthenticateStandalone(Login login, ITokenManager tokenMana
UserId = userIdSO,
ExportExtension = IOHelper.GetExportFileExtension(login.Scope),
ImportExtensions = IOHelper.GetImportFileExtensions(login.Scope),
LinkerTime = new BuildNumberHelper().GetLinkerTime()
LinkerTime = new BuildNumberHelper().GetLinkerTime(),
IsFirstLogin = user.IsFirstLogin??false
};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace CSETWebCore.Interfaces.Assessment
public interface IACETAssessmentBusiness
{
int SaveAssessmentDetail(int assessmentId, AssessmentDetail assessmentDetail);
bool? GetIseSubmission(int assessmentId);
void UpdateIseSubmission(int assessmentId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ public interface IAssessmentBusiness

string GetOtherRemarks(int assessmentId);
void SaveOtherRemarks(int assessmentId, string remark);
void clearFirstTime(int userid, int assessmentId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ public class LoginResponse
public string ExportExtension { get; set; }
public string ImportExtensions { get; set; }
public string LinkerTime { get; set; }
public bool IsFirstLogin { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ public IActionResult SaveAssessmentAlias([FromBody] AliasSaveRequest req)
}

var aggreg = new AggregationBusiness(_context);
aggreg.SaveAssessmentAlias((int)aggregationID, req.aliasAssessment.AssessmentId, req.aliasAssessment.Alias, req.assessmentList);
var newAlias = aggreg.SaveAssessmentAlias((int)aggregationID, req.aliasAssessment.AssessmentId, req.aliasAssessment.Alias, req.assessmentList);

return Ok();
return Ok(newAlias);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,15 @@ public IActionResult SaveOtherRemarks([FromBody] string remark)
return Ok();
}

[HttpGet]
[Route("api/getIseSubmissionStatus")]
public IActionResult GetSubmissionStatus()
{
int assessmentId = _tokenManager.AssessmentForUser();
var result = this._acsetAssessmentBusiness.GetIseSubmission(assessmentId);
return Ok(result);
}

[HttpPost]
[Route("api/updateIseSubmissionStatus")]
public IActionResult UpdateSubmissionStatus()
Expand All @@ -443,5 +452,15 @@ public IActionResult UpdateSubmissionStatus()
this._acsetAssessmentBusiness.UpdateIseSubmission(assessmentId);
return Ok();
}

[HttpGet]
[Route("api/clearFirstTime")]
public IActionResult clearFirstTime()
{
int assessmentId = _tokenManager.AssessmentForUser();
int userid = _tokenManager.GetCurrentUserId()??0;
this._assessmentBusiness.clearFirstTime(userid,assessmentId);
return Ok();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
using System.Text.RegularExpressions;
using CSETWebCore.Model.Auth;
using CSETWebCore.Api.Models;
using NLog;

namespace CSETWebCore.Api.Controllers
{
Expand Down Expand Up @@ -243,6 +244,8 @@ public IActionResult PostRegisterUser([FromBody] CreateUser user)

if (beta)
{
LogManager.GetCurrentClassLogger().Info("CreateUser - CSET is set to 'online beta' mode - no email sent to new user");

// create the user but DO NOT send the temp password email (test/beta)
var rval = resetter.CreateUser(user, false);
if (rval)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using CSETWebCore.Interfaces.User;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using NLog;
using System.Collections.Generic;
using System.Linq;

Expand Down Expand Up @@ -90,13 +91,13 @@ public IActionResult GetUsers([FromQuery] bool? onlyInactive, [FromQuery] string
public IActionResult ChangeUserActivation(
[FromQuery] int userId, [FromQuery] bool isActive, [FromQuery] string apiKey)
{
LogManager.GetCurrentClassLogger().Info($"ChangeUserActivation: changing isActive property to {isActive}");

if (!IsApiKeyValid(apiKey))
{
return Unauthorized();
}


// set the IsActive flag on the user
var user = _context.USERS.FirstOrDefault(x => x.UserId == userId);
if (user == null)
{
Expand All @@ -118,6 +119,8 @@ public IActionResult ChangeUserActivation(
// if the user is being activated, send them a new temp password
if (isActive)
{
LogManager.GetCurrentClassLogger().Info($"ChangeUserActivation: sending temporary password email to {user.PrimaryEmail}");

var resetter = new UserAccountSecurityManager(_context, _userBusiness, _notificationBusiness, _configuration);
resetter.ResetPassword(user.PrimaryEmail, "Temporary Password", "CSET");
}
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,12 @@ export class AliasAssessmentsComponent implements OnInit {
alias: assessment.alias
},
assessmentList
).subscribe();
).subscribe((newAlias: string) => {
const a = this.aliasData.assessments.find(x => x.assessmentId == assessment.assessmentId);
if (!!a) {
a.alias = newAlias;
}
});
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class AssessmentConfigIodComponent implements OnInit {
}

changeCriticalService(evt: any) {
this.demographics.criticalServiceName = evt.target.value;
this.demographics.criticalService = evt.target.value;
this.updateDemographics();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<ng-container *ngIf="isCfEntry">
<div *transloco="let t" style="border: 2px solid #333; border-radius: .3rem; padding: 1rem">
<div class="mb-3">
{{t('cyberFlorida.convert message')}}
{{t('cyberFlorida.upgrade message')}}
</div>
<button class="btn btn-primary" (click)="convert()">{{t('buttons.convert')}}</button>
<button class="btn btn-primary" (click)="convert()">{{t('cyberFlorida.upgradeButton')}}</button>
</div>
</ng-container>
Loading

0 comments on commit 3698bf9

Please sign in to comment.