Skip to content

Commit

Permalink
Cleaned up TODO's
Browse files Browse the repository at this point in the history
  • Loading branch information
inlguy committed Oct 2, 2023
1 parent e7d67eb commit c9ae1cb
Show file tree
Hide file tree
Showing 23 changed files with 29 additions and 201 deletions.
4 changes: 4 additions & 0 deletions CSETWebApi/CSETWebCore.AutoResponder/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,17 @@ public void ProcessEmails()
{

ExcelProcess excel = new ExcelProcess();
#pragma warning disable CS8604 // Possible null reference argument.
string path = excel.BuildSheet(_context, configuration.GetValue<string>("ExcelWorkBookPassword"));

foreach(var email in configuration.GetSection("Notifications:Weekly").GetChildren())
{

_emailHelper.SendWeekly(path,
email.GetValue<string>("email"),
email.GetValue<string>("FirstName"),
email.GetValue<string>("LastName"));
#pragma warning restore CS8604 // Possible null reference argument.
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//
//
////////////////////////////////
using CSETWebCore.Business.Aggregation;
using CSETWebCore.DataLayer.Model;
using CSETWebCore.Interfaces;
using CSETWebCore.Interfaces.Assessment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@ where ac.FirstName.Contains(searchParms.FirstName)

/// <summary>
/// Connects an existing USER to an existing ASSESSMENT for the specified role.
/// TODO: Enforce no duplicates - a user should only be connected once.
/// If a new role is supplied, update the existing ASSESSMENT_CONTACTS role.
/// </summary>
public ContactDetail AddContactToAssessment(int assessmentId, int userId, int roleid, bool invited)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ public int SaveDemographics(Demographics demographics)

dbDemographics.OrganizationType = demographics.OrganizationType == 0 ? null : demographics.OrganizationType;
dbDemographics.OrganizationName = demographics.OrganizationName;
// TODO: dbDemographics.OrgPointOfContact = demographics.OrgPointOfContact == 0 ? null : demographics.OrgPointOfContact;


_context.DEMOGRAPHICS.Update(dbDemographics);
_context.SaveChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ public List<mxGraphModelRootObject> ProcessDiagramEdges(StringReader stream, int
return edges;
}

//TODO check to see if this is still the same

/// <summary>
///
/// </summary>
Expand All @@ -501,16 +501,6 @@ public LayerVisibility getLayerVisibility(string drawIoId, int assessment_id)
//get the parent id
var lm = new LayerManager(_context, assessment_id);
var list = lm.GetLastLayer(drawIoId);

//Dictionary<string, LayerVisibility> allItems = list.ToDictionary(x => x.DrawIo_id, x => x);
//LayerVisibility layer = new LayerVisibility();
//LayerVisibility lastLayer = new LayerVisibility();
//while (!string.IsNullOrEmpty(drawIoId) && allItems.TryGetValue(drawIoId, out layer))
//{
// lastLayer = layer;
// drawIoId = layer.Parent_DrawIo_id;
//}

return list;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ public bool IsFirewall { get
public bool IsIDSOrIPS {
get
{
//TODO if this is an MSC
//look to see if the MSC contains
//an ips or ids
return this.Component_Symbol_Id == Constants.Constants.IDS_TYPE || this.Component_Symbol_Id == Constants.Constants.IPS_TYPE;

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ public FrameworkResponse GetFrameworks(int assessmentId)

// get any existing answers for this assessment
var answers = _context.FRAMEWORK_TIER_TYPE_ANSWER.Where(ans => ans.Assessment_Id == assessmentId);
// TODO: If we add a 'sequence' column to this table, we can sort the sections
// because they appear in a different order in CSET 8.1. Does the order even matter?


foreach (FRAMEWORK_TIER_TYPE ftt in _context.FRAMEWORK_TIER_TYPE.ToList())
{
FrameworkTierType f = new FrameworkTierType()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,6 @@ public void AddCustomQuestion(SetQuestion request)
NEW_QUESTION q = new NEW_QUESTION
{
Simple_Question = request.CustomQuestionText,

// TODO: std_ref + std_ref_number must be unique
Std_Ref = request.SetName,
Std_Ref_Number = newStdRefNum,

Expand Down Expand Up @@ -1562,8 +1560,6 @@ public Requirement UpdateRequirement(Requirement parms)

/// <summary>
/// Removes the NEW_REQUIREMENT record from the set.
///
/// TODO: Actually delete the NEW_REQUIREMENT record?
/// </summary>
/// <param name="parms"></param>
public void RemoveRequirement(Requirement parms)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,7 @@ public int FindingCount
}


/// <summary>
/// TODO: Do we need to deal with Requirements Mode??
/// <summary>
/// </summary>
private String categoryAndQuesitonNumber;
public String CategoryAndQuestionNumber
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,10 +545,7 @@ public string DetermineQuestionType(bool is_requirement, bool is_component, bool

/// <summary>
/// Returns the number of questions that are relevant for the selected standards
/// when in REQUIREMENTS mode.
///
/// TODO: This query is a copy of the one above. Find a way to have a single copy of the query
/// that can be used for full queries or counts or whatever.
/// when in REQUIREMENTS mode.
/// </summary>
/// <returns></returns>
public int NumberOfRequirements()
Expand All @@ -572,8 +569,6 @@ where SetNames.Contains(rs.Set_Name)
///
/// The query differs whether a single or multiple standards are selected.
///
/// TODO: These queries are copies of the ones above. Find a way to have a single instance of each query
/// that can be used for both full data queries and counts in an efficient way.
/// </summary>
/// <returns></returns>
public int NumberOfQuestions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ from b in _context.VIEW_QUESTIONS_STATUS.Where(x => x.Answer_Id == a.Answer_Id).

var maturityDomains = new List<MatAnsweredQuestionDomain>();

// ToDo: Refactor the following stucture of loops
foreach (var domain in questionGrouping.SubGroupings)
{
var newDomain = new MatAnsweredQuestionDomain()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private double GetOverallSALWeight(List<GEN_SAL_WEIGHTS> weights)
//currently selected items can be retrieved from the database
double weight = 0;
foreach (GEN_SAL_WEIGHTS mapping in weights)
{ // TODO: probably better to iterate through the children on the page but dictionary works for now.
{
weight += (double)mapping.Weight;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,7 @@ public StandardModeEnum StandardMode
get { return standardMode; }
set { standardMode = value; }
}
public StandardModeEnum GetRecommendedMode()
{
//TODO: Implement

return StandardModeEnum.Question;
}


private LevelManager levelManager;
private STANDARD_SELECTION standard = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ public UserCreateResponse CreateUser(UserDetail userDetail, CSETContext tmpConte

throw;
}

//TODO: Add logging
Console.WriteLine(ex);
NLog.LogManager.GetCurrentClassLogger().Error(ex);
tmpContext.USERS.Remove(u);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace CSETWebCore.Business.Maturity.Tests
[TestClass()]
public class MaturityBusinessTests
{
private CSETContext context;
private CSETContext? context;

[TestInitialize()]
public void Initialize()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,16 @@ public void TestUpgrade()
string clientCode = "Test";
string appCode = "Test";
DbManager manager = new DbManager(new Version("12.0.3.2"), clientCode, appCode);

//manager.ForceCloseAndDetach(DbManager.localdb2019_ConnectionString, "TestWeb");
//manager.AttachTest("TestWeb", testdb, testlog);

#pragma warning disable IDE0090 // Use 'new(...)'
#pragma warning disable CS8602 // Dereference of a possibly null reference.
VersionUpgrader upgrader = new VersionUpgrader(Assembly.GetAssembly(typeof(DbManager)).Location);
#pragma warning restore CS8602 // Dereference of a possibly null reference.
#pragma warning restore IDE0090 // Use 'new(...)'

manager.SetupDb();

upgrader.UpgradeOnly(new Version("12.0.3.2"), "data source=(localdb)\\mssqllocaldb;initial catalog=TestWeb;persist security info=True;Integrated Security=SSPI;MultipleActiveResultSets=True");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ namespace CSETWebCore.DatabaseManager.Tests
[TestClass()]
public class ImportExportTests
{
private CSETContext context;
private TokenManager tokenManager;
private LocalInstallationHelper localHelper;
private PasswordHash passwordHash;
private IConfiguration config;
private CSETContext? context;
private TokenManager? tokenManager;
private LocalInstallationHelper? localHelper;
private PasswordHash? passwordHash;
private IConfiguration? config;

[TestInitialize()]
public void Initialize()
Expand Down Expand Up @@ -78,18 +78,17 @@ public void ImportAllAssessmentsTest()
public void ExportAllAssessmentsTest()
{
//setup a copy file
//setup a destination file
string clientCode = "DHS";
string appCode = "CSET";

//setup a destination file
UserAuthentication userAuth = new UserAuthentication(passwordHash, null, localHelper, tokenManager, null, config, context);
Login login = new Login { Email = null, Password = null, TzOffset = "300", Scope = "CSET" };

string loginToken = userAuth.AuthenticateStandalone(login, tokenManager).Token;

#pragma warning disable CS8602 // Dereference of a possibly null reference.
var assessments = context.ASSESSMENTS.Select(x => x.Assessment_Id).AsEnumerable();
#pragma warning restore CS8602 // Dereference of a possibly null reference.

for( int i=0; i<assessments.Count(); i++ )
for ( int i=0; i<assessments.Count(); i++ )
{
int assess_Id = assessments.ElementAt(i);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,10 +588,6 @@ join cm in _context.CSF_MAPPING on mq.Mat_Question_Id equals cm.Question_Id
reff.SetAttributeValue("question-title", ab.mq.Question_Title);
node.Element("References").Add(reff);
}
else
{
var stop = 1;
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,47 +41,12 @@ public AssessmentImportController(ITokenManager token, CSETContext context, IAss
_assessmentUtil = assessmentUtil;
}


/// <summary>
/// Gets the path to the Legacy CSET Import process. Checks for both dev and production versions.
/// </summary>
/// <returns></returns>
private string GetLegacyImportProcessPath()
{
var dir = new FileInfo(AppDomain.CurrentDomain.BaseDirectory).Directory;

// TODO: Problem: These paths create a dependency and should be some sort of variable for installation as well as debugging.
// Also, can the user change the installation directory? If so, this gets messed up...
var importFile = dir.Parent.Parent.Parent.Parent.FullName + "\\CSETStandAlone\\LegacyCSETImport\\Bin\\Debug\\LegacyCSETImport.exe";
var importProductionFile = Path.Combine(dir.Parent.FullName, "LegacyCSETImport.exe");

var path = string.Empty;
if (System.IO.File.Exists(importFile))
{
path = importFile;
}
else if (System.IO.File.Exists(importProductionFile))
{
path = importProductionFile;
}
return path;
}


private bool LegacyImportProcessExists()
{
var processPath = GetLegacyImportProcessPath();
var processExists = !string.IsNullOrEmpty(processPath);
return processExists;
}


[HttpGet]
// [CSETAuthorize]
[Route("api/assessment/legacy/import/installed")]
public IActionResult LegacyImportIsInstalled()
{
return Ok(LegacyImportProcessExists());
return Ok(false);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public IActionResult GetGeneralSalDescriptionsWeights()
{
int assessmentid = _token.AssessmentForUser();

//TODO: make this async
TinyMapper.Bind<GENERAL_SAL_DESCRIPTIONS, GeneralSalDescriptionsWeights>();
TinyMapper.Bind<GEN_SAL_WEIGHTS, GenSalWeights>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,13 +436,6 @@ public IActionResult GetSectionScoring()
public IActionResult ImportSurvey([FromBody] Model.Nested.CisImportRequest request)
{
var assessmentId = _tokenManager.AssessmentForUser();


// TODO: verify that the user has permission to both assessments




var biz = new CisQuestionsBusiness(_context, _assessmentUtil, assessmentId);
biz.ImportCisAnswers(request.Dest, request.Source);
return Ok();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ public IActionResult GetQuestionText([FromQuery] int modelId) {
[Route("api/getMergeData")]
public IList<Get_Merge_ConflictsResult> GetMergeAnswers([FromQuery] int id1, [FromQuery] int id2, [FromQuery] int id3, [FromQuery] int id4, [FromQuery] int id5,
[FromQuery] int id6, [FromQuery] int id7, [FromQuery] int id8, [FromQuery] int id9, [FromQuery] int id10)
{
// Todo: Add security check for authorization
// Call assessments for user on each assessment ID

// if true
{
return _context.Get_Merge_Conflicts(id1, id2, id3, id4, id5, id6, id7, id8, id9, id10);
}

Expand Down
Loading

0 comments on commit c9ae1cb

Please sign in to comment.