Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finished Observation Tear-out sheets in Ukrainian #3742

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"overall": "Π—Π°Π³Π°Π»ΠΎΠΌ",
"standards": "Π‘Ρ‚Π°Π½Π΄Π°Ρ€Ρ‚ΠΈ",
"default exec summ": "[UK]Cyber terrorism is a real and growing threat. Standards and guides have been developed, vetted, and widely accepted to assist with protection from cyber attacks. The Cyber Security Evaluation Tool (CSET) includes a selectable array of these standards for a tailored assessment of cyber vulnerabilities. Once the standards were selected and the resulting question sets answered, the CSET created a compliance summary, compiled variance statistics, ranked top areas of concern, and generated security recommendations.",
"default assessment name": "Нова ΠΎΡ†Ρ–Π½ΠΊΠ°"
"default assessment name": "Нова ΠΎΡ†Ρ–Π½ΠΊΠ°",
"no feedback": "НСмає Π²Ρ–Π΄Π³ΡƒΠΊΡ–Π² Ρ‰ΠΎΠ΄ΠΎ Π±ΡƒΠ΄ΡŒ-яких Π·Π°ΠΏΠΈΡ‚Π°Π½ΡŒ Ρƒ Ρ†Ρ–ΠΉ ΠΎΡ†Ρ–Π½Ρ†Ρ–"
}
Original file line number Diff line number Diff line change
Expand Up @@ -553,9 +553,8 @@ public void BuildMaturityInfoTab(MaturityQuestionInfoData info, int? userId, str
tabData.ExaminationApproach = info.MaturityQuestion.Examination_Approach;

//
var user = _context.USERS.FirstOrDefault(x => x.UserId == userId);
var ak = _context.ACCESS_KEY.FirstOrDefault(x => x.AccessKey == accessKey);
if (user?.Lang == "es" || ak?.Lang == "es")
var lang = _tokenManager.GetCurrentLanguage();
if (lang == "es")
{
Dictionary<int, SpanishQuestionRow> dictionary = AcetBusiness.buildQuestionDictionary();
var output = new SpanishQuestionRow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
//
////////////////////////////////
using CSETWebCore.Business.Acet;
using CSETWebCore.Business.Aggregation;
using CSETWebCore.Business.Maturity;
using CSETWebCore.Business.Question;
using CSETWebCore.Business.Sal;
Expand All @@ -21,16 +20,13 @@
using CSETWebCore.Model.Maturity;
using CSETWebCore.Model.Question;
using CSETWebCore.Model.Reports;
using DocumentFormat.OpenXml.EMMA;
using Microsoft.EntityFrameworkCore;
using Nelibur.ObjectMapper;
using Org.BouncyCastle.Asn1.Pkcs;
using Snickler.EFCore;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.AccessControl;


namespace CSETWebCore.Business.Reports
{
Expand All @@ -46,6 +42,12 @@ public class ReportsDataBusiness : IReportsDataBusiness

public List<int> OutOfScopeQuestions = new List<int>();

private TranslationOverlay _overlay; //private string _lang = "en";

//public string Lang { get => _lang; set => _lang = value; }




/// <summary>
/// Constructor.
Expand All @@ -60,6 +62,8 @@ public ReportsDataBusiness(CSETContext context, IAssessmentUtil assessmentUtil,
_maturityBusiness = maturityBusiness;
_questionRequirement = questionRequirement;
_tokenManager = tokenManager;

_overlay = new TranslationOverlay();
}


Expand All @@ -85,6 +89,8 @@ public List<MatRelevantAnswers> GetQuestionsList()
return new List<MatRelevantAnswers>();
}

var lang = _tokenManager.GetCurrentLanguage();

_context.FillEmptyMaturityQuestionsForAnalysis(_assessmentId);

var query = from a in _context.ANSWER
Expand Down Expand Up @@ -113,13 +119,9 @@ on a.Question_Or_Requirement_Id equals m.Mat_Question_Id
}
}

int userId = (int)_tokenManager.GetUserId();
string accessKey = _tokenManager.GetAccessKey();
var user = _context.USERS.FirstOrDefault(x => x.UserId == userId);
var ak = _context.ACCESS_KEY.FirstOrDefault(x => x.AccessKey == accessKey);

//
if (user?.Lang == "es" || ak?.Lang == "es")
if (lang == "es")
{
responseList.ForEach(
matAns =>
Expand Down Expand Up @@ -278,6 +280,8 @@ public List<MatAnsweredQuestionDomain> GetAnsweredQuestionList()
{
List<BasicReportData.RequirementControl> controls = new List<BasicReportData.RequirementControl>();

var lang = _tokenManager.GetCurrentLanguage();


var myModel = _context.AVAILABLE_MATURITY_MODELS
.Include(x => x.model)
Expand Down Expand Up @@ -306,12 +310,8 @@ from b in _context.VIEW_QUESTIONS_STATUS.Where(x => x.Answer_Id == a.Answer_Id).

Dictionary<int, GroupingSpanishRow> dictionaryGrouping = AcetBusiness.buildGroupingDictionary();
Dictionary<int, SpanishQuestionRow> dictionaryQuestion = AcetBusiness.buildQuestionDictionary();
int userId = (int)_tokenManager.GetUserId();
string accessKey = _tokenManager.GetAccessKey();
var user = _context.USERS.FirstOrDefault(x => x.UserId == userId);
var ak = _context.ACCESS_KEY.FirstOrDefault(x => x.AccessKey == accessKey);

if (user?.Lang == "es" || ak?.Lang == "es")
if (lang == "es")
{
allGroupings.ForEach(
group =>
Expand Down Expand Up @@ -371,7 +371,7 @@ from b in _context.VIEW_QUESTIONS_STATUS.Where(x => x.Answer_Id == a.Answer_Id).
MarkForReview = question.MarkForReview
};

if (user?.Lang == "es" || ak?.Lang == "es")
if (lang == "es")
{
var output = new SpanishQuestionRow();
var temp = new SpanishQuestionRow();
Expand Down Expand Up @@ -1038,10 +1038,17 @@ public List<ComponentQuestion> GetComponentQuestions()

public List<usp_GetOverallRankedCategoriesPage_Result> GetTop5Categories()
{
var lang = _tokenManager.GetCurrentLanguage();

return _context.usp_GetOverallRankedCategoriesPage(_assessmentId).Take(5).ToList();
var categories = _context.usp_GetOverallRankedCategoriesPage(_assessmentId).Take(5).ToList();

for (var i = 0; i < categories.Count; i++)
{
var cat = categories[i];
cat.Question_Group_Heading = _overlay.GetValue("QUESTION_GROUP_HEADING", cat.QGH_Id.ToString(), lang)?.Value ?? cat.Question_Group_Heading;
}

return categories;
}


Expand Down Expand Up @@ -1218,14 +1225,30 @@ orderby h.Question_Group_Heading

public List<RankedQuestions> GetRankedQuestions()
{
var lang = _tokenManager.GetCurrentLanguage();

var rm = new Question.RequirementBusiness(_assessmentUtil, _questionRequirement, _context, _tokenManager);

List<RankedQuestions> list = new List<RankedQuestions>();
List<usp_GetRankedQuestions_Result> rankedQuestionList = _context.usp_GetRankedQuestions(_assessmentId).ToList();
foreach (usp_GetRankedQuestions_Result q in rankedQuestionList)
{

if (q.RequirementId != null)
{
var x = _overlay.GetReq((int)q.RequirementId, lang);
if (x != null)
{
q.QuestionText = x.RequirementText;
}
}



q.QuestionText = rm.ResolveParameters(q.QuestionOrRequirementID, q.AnswerID, q.QuestionText);

q.Category = _overlay.GetPropertyValue("STANDARD_CATEGORY", q.Category.ToLower(), lang) ?? q.Category;

list.Add(new RankedQuestions()
{
Answer = q.AnswerText,
Expand Down Expand Up @@ -1481,26 +1504,27 @@ from i in i1.DefaultIfEmpty()


TinyMapper.Bind<FINDING, Observations>();
Observations rfind = TinyMapper.Map<Observations>(f.b);
rfind.Observation = f.b.Summary;
rfind.ResolutionDate = f.b.Resolution_Date.ToString();
rfind.Importance = f.Value;
Observations obs = TinyMapper.Map<Observations>(f.b);
obs.Observation = f.b.Summary;
obs.ResolutionDate = f.b.Resolution_Date.ToString();
obs.Importance = f.Value;


// get the question identifier and text
GetQuestionTitleAndText(f, standardQuestions, componentQuestions, f.c.Answer_Id,
out string qid, out string qtxt);
rfind.QuestionIdentifier = qid;
rfind.QuestionText = qtxt;
obs.QuestionIdentifier = qid;
obs.QuestionText = qtxt;


var othersList = (from a in f.b.FINDING_CONTACT
join b in _context.ASSESSMENT_CONTACTS on a.Assessment_Contact_Id equals b.Assessment_Contact_Id
select FormatName(b.FirstName, b.LastName)).ToList();
rfind.OtherContacts = string.Join(",", othersList);
obs.OtherContacts = string.Join(",", othersList);

individual.Observations.Add(rfind);
individual.Observations.Add(obs);
}

return individualList;
}

Expand All @@ -1518,6 +1542,7 @@ private void GetQuestionTitleAndText(dynamic f,
{
identifier = "";
questionText = "";
var lang = _tokenManager.GetCurrentLanguage();

switch (f.c.Question_Type)
{
Expand Down Expand Up @@ -1549,15 +1574,18 @@ private void GetQuestionTitleAndText(dynamic f,
identifier = f.r.Requirement_Title;
var rb = new RequirementBusiness(_assessmentUtil, _questionRequirement, _context, _tokenManager);
questionText = rb.ResolveParameters(f.r.Requirement_Id, answerId, f.r.Requirement_Text);

// translate
questionText = _overlay.GetReq(f.r.Requirement_Id, lang)?.RequirementText ?? questionText;

return;

case "Maturity":
identifier = f.mq.Question_Title;
questionText = f.mq.Question_Text;
//
var user = _context.USERS.FirstOrDefault(x => x.UserId == _tokenManager.GetUserId());
var ak = _context.ACCESS_KEY.FirstOrDefault(x => x.AccessKey == _tokenManager.GetAccessKey());
if (user?.Lang == "es" || ak?.Lang == "es")

if (lang == "es")
{
Dictionary<int, SpanishQuestionRow> dictionary = AcetBusiness.buildQuestionDictionary();
var output = new SpanishQuestionRow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace CSETWebCore.DataLayer.Model
public partial class usp_GetOverallRankedCategoriesPage_Result
{
public string Question_Group_Heading { get; set; }
public int QGH_Id { get; set; }
public int qc { get; set; }
public int cr { get; set; }
public int Total { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,25 @@ public partial class usp_GetRankedQuestions_Result
public string Category { get; set; }
public Nullable<long> Rank { get; set; }
public string QuestionText { get; set; }

/// <summary>
/// The ID of the related question. Null if this is a requirement.
/// </summary>
public Nullable<int> QuestionId { get; set; }

/// <summary>
/// The ID of the related requirement. Null if this is a question.
/// </summary>
public Nullable<int> RequirementId { get; set; }

/// <summary>
/// The question or requirement that the answer is tied to
/// </summary>
public int QuestionOrRequirementID { get; set; }
public int AnswerID { get; set; }

public string AnswerText { get; set; }
public string Level { get; set; }
public string QuestionRef { get; set; }
public int QuestionOrRequirementID { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace CSETWebCore.Interfaces.Reports
public interface IReportsDataBusiness
{
void SetReportsAssessmentId(int assessmentId);

List<MatRelevantAnswers> GetMaturityDeficiencies();
List<MatRelevantAnswers> GetCommentsList();
List<MatRelevantAnswers> GetMarkedForReviewList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ public IActionResult GetFeedback()
int assessmentId = _tokenManager.AssessmentForUser();
_requirement.SetRequirementAssessmentId(assessmentId);

var lang = _tokenManager.GetCurrentLanguage();

FeedbackDisplayContainer FeedbackResult = new FeedbackDisplayContainer();

string AssessmentMode = GetAssessmentMode(assessmentId);
Expand Down Expand Up @@ -217,7 +219,7 @@ public IActionResult GetFeedback()

if (feedbackQuestions.Count() == 0)
{
FeedbackResult.FeedbackBody = "No feedback given for any questions in this assessment";
FeedbackResult.FeedbackBody = _overlay.GetPropertyValue("GENERIC", "no feedback", lang) ?? "No feedback given for any questions in this assessment";
}

return Ok(FeedbackResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,13 +459,13 @@ public IActionResult GetAltList()
d.Mat.Maturity_Model = null;
});


return Ok(data);
}


[HttpGet]
[Route("api/reports/discoveries")]
public IActionResult GetDiscoveries()
[Route("api/reports/observations")]
public IActionResult GetObservations()
{
int assessmentId = _token.AssessmentForUser();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-------------------------->
<div class="white-panel m-0 d-flex flex-column flex-11a oy-auto h-0 w-100">
<div class="white-panel m-0 d-flex flex-column flex-11a oy-auto h-0 w-100" *transloco="let t">

<div class="max-1200">
<app-builder-breadcrumbs></app-builder-breadcrumbs>
<h3>
Reference Document
</h3>
<label>File Name</label>
<label>{{t('extras.file name')}}</label>
<div>
{{ doc.fileName }}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-------------------------->
<div class="white-panel m-0 d-flex flex-column flex-11a oy-auto h-0 oy-auto">
<div class="white-panel m-0 d-flex flex-column flex-11a oy-auto h-0 oy-auto" *transloco="let t">

<div class="max-1200">
<app-builder-breadcrumbs></app-builder-breadcrumbs>
Expand Down Expand Up @@ -61,7 +61,7 @@ <h5>
<th></th>
<th>Title</th>
<th></th>
<th>File Name</th>
<th>{{t('extras.file name')}}</th>
<tr *ngFor="let doc of filteredDocuments">
<td class="align-top"><input type="checkbox" [(ngModel)]="doc.selected" (ngModelChange)="selectDoc(doc)"></td>
<td class="d-flex align-items-start justify-content-between flex-00a">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<table class="assessment-documents">
<tr>
<th style="width:50%;">Document Title</th>
<th style="width:40%;">File Name</th>
<th style="width:40%;">{{t('extras.file name')}}</th>
<th style="width:10%;"></th>
</tr>
<tr *ngFor="let doc of documents">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
<div class="mx-3 mt-2" *ngIf="message && message.message.length > 0">{{ message.message }}</div>
</div>

<hr class="w-100 mt-4 mb-2" *ngIf="showCisaAssessorWorkflowSwitch()" />

<div *ngIf="showCisaAssessorWorkflowSwitch()"
class="form-group d-flex align-items-center justify-content-between mt-4 mx-2">
<label for="csaToggle" class="font-weight-bold">CISA Assessor Workflow </label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-------------------------->
<div class="report-body mb-5">
<div class="report-body mb-5" *transloco="let t">

<div class="flex-container">
<div class="column mt-3">
Expand Down Expand Up @@ -151,15 +151,15 @@ <h1>Document Library</h1>
<table class="cset-table-3">
<tr>
<th>Title</th>
<th>File Name</th>
<th>{{t('extras.file name')}}</th>
</tr>
<tr *ngFor="let doc of response?.documentLibraryTable">
<td>{{doc.documentTitle}}</td>
<td>{{doc.fileName}}</td>
</tr>
<tr *ngIf="(response?.documentLibraryTable?.length ?? 0) === 0">
<td></td>
<td>There are no documents to display</td>
<td>{{t('extras.no documents to display')}}</td>
</tr>
</table>
</div>
Expand Down
Loading
Loading