Skip to content

Commit

Permalink
Fix #160#160#160
Browse files Browse the repository at this point in the history
  • Loading branch information
failys committed Dec 8, 2017
1 parent 3694932 commit 1cd4399
Show file tree
Hide file tree
Showing 66 changed files with 2,324 additions and 1,715 deletions.
1 change: 0 additions & 1 deletion cairis/controllers/EnvironmentController.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ def put(self, name):
# endregion
def delete(self, name):
session_id = get_session_id(session, request)

dao = EnvironmentDAO(session_id)
dao.delete_environment(name=name)
dao.close()
Expand Down
2 changes: 2 additions & 0 deletions cairis/core/MySQLDatabaseProxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1369,6 +1369,8 @@ def deleteEnvironment(self,environmentId):
curs = self.conn.connection().connection.cursor()
sqlTxt = 'call delete_environment(%s)'
curs.execute(sqlTxt,[environmentId])
session = self.conn()
session.commit()
curs.close()
except _mysql_exceptions.IntegrityError as e:
exceptionText = 'Cannot remove environment due to dependent data (' + str(e) + ').'
Expand Down
14 changes: 14 additions & 0 deletions cairis/mio/MisusabilityContentHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,20 @@ def startElement(self,name,attrs):
self.theName = attrs['name']
self.theConcept = attrs['concept']
self.theObject = attrs['object']
elif name == 'grounds':
refName = attrs['reference']
refType = attrs['type']
refArtifact = ''
self.theGrounds.append((refName,'',refType))
elif name == 'warrant':
refName = attrs['reference']
refType = attrs['type']
refArtifact = ''
self.theWarrants.append((refName,'',refType))
elif name == 'rebuttal':
refName = attrs['reference']
refType = attrs['type']
refArtifact = ''
elif name == 'task_characteristic':
self.theTask = attrs['task']
self.theModalQualifier = attrs['modal_qualifier']
Expand Down
2 changes: 1 addition & 1 deletion cairis/sql/procs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11061,7 +11061,7 @@ end

create procedure getPersonaCharacteristicsSummary()
begin
select p.name,bv.name,pc.description from persona_characteristic pc, persona p, behavioural_variable bv where pc.persona_id = p.id and pc.variable_id = bv.id order by 1,2;
select p.name,bv.name,pc.description from persona_characteristic pc, persona p, behavioural_variable bv where pc.persona_id = p.id and pc.variable_id = bv.id order by 1,2,3;
end
//

Expand Down
21 changes: 13 additions & 8 deletions cairis/web/dist/css/CAIRIS.css
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ table, th, td{
display: none;
}
thead{
border-bottom: 3px black solid;
border-bottom: 3px #ddd solid;
}
.comboboxD{
visibility: hidden;
Expand Down Expand Up @@ -152,19 +152,24 @@ footer{
min-width: 200px;
}
#AssociationsAssetsOptions > th, td { /*min-width: 75px;*/ }
#assetstabsID{
width: 70%;
}
.tabs textarea{
width:100%;
}
.right{
float: right;
}
/*environmentstable*/
#theEnvironmentDictionary{
margin : 5px;

.table-striped th {
background-color: grey;
color: white;
}

.table-striped th.addRemove td.addRemove {
width: 15px;
}

.table-striped tbody tr.active td {background-color: #ccc;}

table.clickable-table {
border-collapse: collapse;
}
Expand Down Expand Up @@ -243,7 +248,7 @@ select#theType {
min-width: 10px;
}
.fa-plus{
color: green;
color: white;
}
.fa-minus{
color: red;
Expand Down
4 changes: 4 additions & 0 deletions cairis/web/dist/js/cairis/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ function viewAsset(assetName) {
appendAssetInterface(aInt);
});
$('#editAssetsOptionsform').loadJSON(newdata,null);
if (newdata.isCritical) {
$('#theCriticalRationale').prop("disabled",false);
}
fillAssetEnvironments(newdata.theEnvironmentProperties);
$('#editAssetsOptionsform').validator('update');
$("#theEnvironmentDictionary").find("tbody").find(".assetEnvironmentRow:first").trigger('click');
Expand Down Expand Up @@ -198,6 +201,7 @@ mainContent.on('click', ".removeAssetEnvironment", function () {


mainContent.on('click', '.assetEnvironmentRow', function(event){
$(this).closest('tr').addClass('active').siblings().removeClass('active');
var asset = JSON.parse($.session.get("Asset"));
var text = $(this).text();
$.session.set("assetEnvironmentName", text);
Expand Down
1 change: 1 addition & 0 deletions cairis/web/dist/js/cairis/attackers.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ function viewAttacker(attackerName) {

var mainContent = $("#objectViewer");
mainContent.on("click",".attackerEnvironment", function () {
$(this).closest('tr').addClass('active').siblings().removeClass('active');
clearAttackerEnvInfo();
var attacker = JSON.parse($.session.get("Attacker"));
var theEnvName = $(this).text();
Expand Down
3 changes: 2 additions & 1 deletion cairis/web/dist/js/cairis/countermeasures.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ mainContent.on("change", "#theCountermeasureCost", function() {
});

mainContent.on("click", ".countermeasuresEnvironments", function () {
$(this).closest('tr').addClass('active').siblings().removeClass('active');
clearCountermeasureEnvInfo();
var countermeasure = JSON.parse($.session.get("Countermeasure"));
var envName = $(this).text();
Expand Down Expand Up @@ -397,7 +398,7 @@ mainContent.on('click', '#chooseTargetButton', function () {
$.session.set("Countermeasure", JSON.stringify(cm));
$('#theTargets').find('tbody').find('tr:eq(' + selectedIdx + ')').find("td:eq(1)").text(target.theName);
$('#theTargets').find('tbody').find('tr:eq(' + selectedIdx + ')').find("td:eq(2)").text(target.theEffectiveness);
$('#theTargets').find('tbody').find('tr:eq(' + selectedIdx + ')').find("td:eq(2)").text(target.theRationale);
$('#theTargets').find('tbody').find('tr:eq(' + selectedIdx + ')').find("td:eq(3)").text(target.theRationale);
$('#ChooseTargetDialog').modal('hide');
}
else {
Expand Down
70 changes: 41 additions & 29 deletions cairis/web/dist/js/cairis/environments.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,25 @@ $(document).on('click', "td.environment-rows",function(){
}, 10);
});
$.each(data.theEnvironments, function (index, env) {
$("#envToEnvTable").append("<tr><td><i class='fa fa-minus'></i></td><td>" + env + "</td></tr>");
$("#envToEnvTable").append("<tr><td class='removeEnvinEnv'><i class='fa fa-minus'></i></td><td class='envInEnv'>" + env + "</td></tr>");
$("#overrideCombobox").append($("<option />").text(env));
});
if (data.theEnvironments.length > 0) {
$('#duplicateSettings').show();
}
switch (data.theDuplicateProperty) {
case "Maximise":
$("#MaximiseID").prop('checked', true);
$("#maximise").click();
$('#overrideCombobox').empty();
break;
case "Override":
$("#OverrideID").prop('checked', true);
$("#overrideCombobox").prop("disabled", false);
$("#override").click();
$('#overrideCombobox').val(data.theOverridingEnvironment);
break;
case "None":
$("#overrideCombobox").prop("disabled", false);
$("#OverrideID").prop('checked', false);
$("#MaximiseID").prop('checked', false);
$('#overrideCombobox').empty();
$("#override").prop('checked', false);
$("#maximise").prop('checked', true);
break;
}
$("#editEnvironmentOptionsform").validator('update');
Expand Down Expand Up @@ -120,15 +124,18 @@ $("#environmentMenuClick").click(function () {
});

var mainContent = $("#objectViewer");
mainContent.on('change', "#OverrideID", function () {
if($("#OverrideID").prop("checked")){
$("#overrideCombobox").prop("disabled",false);
mainContent.on('change', "#override", function () {
$("#overrideCombobox").empty();
if($("#override").prop("checked")){
$("#envToEnvTable").find("tbody").find("tr .removeEnvinEnv").each(function () {
$("#overrideCombobox").append($("<option />").text($(this).next("td").text()));
});
}
});

mainContent.on('change', "#MaximiseID", function () {
if($("#MaximiseID").prop("checked")){
$("#overrideCombobox").prop("disabled",true);
mainContent.on('change', "#maximise", function () {
if($("#maximise").prop("checked")){
$('#overrideCombobox').empty();
}
});

Expand All @@ -142,9 +149,8 @@ mainContent.on('click', ".removeEnvinEnv", function () {
}
});
if ($('#envToEnvTable').find("tbody").is(':empty')){
$("input:radio[name='duplication']").each(function(i) {
this.checked = false;
});
$("#maximise").prop("checked");
$('#duplicateSettings').hide();
}
});

Expand Down Expand Up @@ -175,7 +181,16 @@ mainContent.on("click", "#addEnvtoEnv", function () {
function addEnvToEnv() {
var text = $("#chooseEnvironmentSelect").val();
$("#envToEnvTable").append("<tr><td class='removeEnvinEnv'><i class='fa fa-minus'></i></td><td class='envInEnv'>"+ text +"</td></tr>");
$("#overrideCombobox").append("<option value='" + text + "'>" + text + "</option>");

if ($('#envToEnvTable tr').length == 1) {
$("#maximise").prop('checked', true);
}
else {
if ($("#override").prop('checked' == true)) {
$("#overrideCombobox").append("<option value='" + text + "'>" + text + "</option>");
}
}
$("#duplicateSettings").show();
$('#chooseEnvironment').modal('hide');
};

Expand Down Expand Up @@ -227,7 +242,6 @@ function fillupEnvironmentObject(env) {
$("#tensionsTable").find("td").each(function() {
var attr = $(this).find("select").attr('rationale');
if(typeof attr !== typeof undefined && attr !== false) {
var env = JSON.parse($.session.get("Environment"));
var select = $(this).find("select");
var tension = jQuery.extend(true, {}, tensionDefault);
tension.rationale = select.attr("rationale");
Expand All @@ -245,17 +259,16 @@ function fillupEnvironmentObject(env) {
envInEnv.push($(this).next("td").text());
});
env.theEnvironments = envInEnv;
env.theDuplicateProperty = $("input:radio[name ='duplication']:checked").val();
if(env.theDuplicateProperty == "" || env.theDuplicateProperty == undefined){
env.theDuplicateProperty = "None";
env.theOverridingEnvironment = $('#overrideCombobox').val();
}

var theEnvinEnvArray = [];
$("#overrideCombobox").find("option").each(function (index, option) {
theEnvinEnvArray.push($(option).text());
});
env.theEnvironments = theEnvinEnvArray;
if (env.theEnvironments.length > 0) {
if ($("#override").prop('checked') == true) {
env.theDuplicateProperty = "Override";
env.theOverridingEnvironment = $('#overrideCombobox').val();
}
else {
env.theDuplicateProperty = "Maximise";
}
}
return env;
}

Expand Down Expand Up @@ -387,4 +400,3 @@ function postEnvironment(environment, callback){
}
});
}

36 changes: 6 additions & 30 deletions cairis/web/dist/js/cairis/goals.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ $(document).on('click', "td.goal-rows", function(){

var mainContent = $("#objectViewer");
mainContent.on('click', ".goalEnvProperties", function () {
$(this).closest('tr').addClass('active').siblings().removeClass('active');
var goal = JSON.parse($.session.get("Goal"));
var name = $(this).text();
$.session.set("GoalEnvName", name);
Expand Down Expand Up @@ -675,19 +676,19 @@ function emptyGoalEnvTables(){
}

function appendGoalEnvironment(text){
$("#theGoalEnvironments").append("<tr><td class='deleteGoalEnv'><i class='fa fa-minus'></i></td><td class='goalEnvProperties'>"+ text +"</td></tr>");
$("#theGoalEnvironments").append("<tr><td class='deleteGoalEnv addRemove'><i class='fa fa-minus'></i></td><td class='goalEnvProperties'>"+ text +"</td></tr>");
}
function appendGoalGoal(goal){
$("#editgoalsGoalsTable").append('<tr class="editGoalGoalRow"><td class="deleteGoalGoal"><i class="fa fa-minus"></i></td><td class="envGoalName">'+goal[0]+'</td><td>'+goal[1]+'</td><td>'+goal[2]+'</td><td>'+goal[3]+'</td><td>'+goal[4]+'</td></tr>');
$("#editgoalsGoalsTable").append('<tr class="editGoalGoalRow addRemove"><td class="deleteGoalGoal"><i class="fa fa-minus"></i></td><td class="envGoalName">'+goal[0]+'</td><td>'+goal[1]+'</td><td>'+goal[2]+'</td><td>'+goal[3]+'</td><td>'+goal[4]+'</td></tr>');
}
function appendGoalSubGoal(subgoal){
$("#editgoalsSubgoalsTable").append('<tr class="editGoalSubGoalRow"><td class="deleteGoalSubGoal"><i class="fa fa-minus"></i></td><td class="subGoalName">'+subgoal[0]+'</td><td>'+subgoal[1]+'</td><td>'+subgoal[2]+'</td><td>'+subgoal[3]+'</td><td>'+subgoal[4]+'</td></tr>');
$("#editgoalsSubgoalsTable").append('<tr class="editGoalSubGoalRow addRemove"><td class="deleteGoalSubGoal"><i class="fa fa-minus"></i></td><td class="subGoalName">'+subgoal[0]+'</td><td>'+subgoal[1]+'</td><td>'+subgoal[2]+'</td><td>'+subgoal[3]+'</td><td>'+subgoal[4]+'</td></tr>');
}
function appendGoalConcern(concern){
$("#editgoalsConcernTable").append('<tr><td class="deleteGoalEnvConcern" value="'+ concern+'"><i class="fa fa-minus"></i></td><td class="GoalConcernName">'+concern+'</td></tr>');
$("#editgoalsConcernTable").append('<tr><td class="deleteGoalEnvConcern addRemove" value="'+ concern+'"><i class="fa fa-minus"></i></td><td class="GoalConcernName">'+concern+'</td></tr>');
}
function appendGoalConcernAssoc(assoc){
$("#editgoalsConcernassociationsTable").append('<tr><td class="deleteGoalEnvConcernAssoc"><i class="fa fa-minus"></i></td><td class="assocName editGoalConcernAssoc">'+assoc[0]+'</td><td class="assocN1">'+assoc[1]+'</td><td class="assocLink">'+assoc[2]+'</td><td class="assocN2">'+assoc[4]+'</td><td class="assocTarget">'+assoc[3]+'</td></tr>');
$("#editgoalsConcernassociationsTable").append('<tr><td class="deleteGoalEnvConcernAssoc addRemove"><i class="fa fa-minus"></i></td><td class="assocName editGoalConcernAssoc">'+assoc[0]+'</td><td class="assocN1">'+assoc[1]+'</td><td class="assocLink">'+assoc[2]+'</td><td class="assocN2">'+assoc[4]+'</td><td class="assocTarget">'+assoc[3]+'</td></tr>');
}

mainContent.on('click', '#goalCancelButton', function (e) {
Expand All @@ -696,31 +697,6 @@ mainContent.on('click', '#goalCancelButton', function (e) {
refreshMenuBreadCrumb('goal');
});

function getAllgoals(callback) {
$.ajax({
type: "GET",
dataType: "json",
accept: "application/json",
data: {
session_id: String($.session.get('sessionID'))
},
crossDomain: true,
url: serverIP + "/api/goals",
success: function (data) {
if (jQuery.isFunction(callback)) {
callback(data);
}
},
error: function (xhr, textStatus, errorThrown) {
var error = JSON.parse(xhr.responseText);
showPopup(false, String(error.message));
debugLogger(String(this.url));
debugLogger("error: " + xhr.responseText + ", textstatus: " + textStatus + ", thrown: " + errorThrown);
return null;
}
});
}

$(document).on('click', "td.deleteGoalButton", function (e) {
e.preventDefault();
var goalName = $(this).find('i').attr("value");
Expand Down
2 changes: 1 addition & 1 deletion cairis/web/dist/js/cairis/locations.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ mainContent.on('click','#addLocationLink',function() {

mainContent.on('click','td.location-link',function(){
var iRow = $(this).closest("tr");
selectedLink = iRow.find("td:eq(1)").text();
var selectedLink = iRow.find("td:eq(1)").text();
$('#addLocationLinkDialog').attr('data-selectedLink',JSON.stringify(selectedLink));
$('#addLocationLinkDialog').attr('data-selectedIndex',iRow.index());
$('#addLocationLinkDialog').modal('show');
Expand Down
4 changes: 2 additions & 2 deletions cairis/web/dist/js/cairis/obstacles.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ $(document).on('click', "td.obstacle-rows",function() {

var mainContent = $("#objectViewer");
mainContent.on('click', ".obstacleEnvProperties", function () {
$(this).closest('tr').addClass('active').siblings().removeClass('active');
var obstacle = JSON.parse($.session.get("Obstacle"));
var name = $(this).text();
$.session.set("ObstacleEnvName", name);
emptyGoalEnvTables();

clearObstacleEnvironmentPanel();
$.each(obstacle.theEnvironmentProperties, function (index, env) {
if(env.theEnvironmentName == name){
$("#theDefinition").val(env.theDefinition);
Expand Down
1 change: 1 addition & 0 deletions cairis/web/dist/js/cairis/personas.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ function viewPersona(personaName) {

var mainContent = $("#objectViewer");
mainContent.on("click",".personaEnvironment", function () {
$(this).closest('tr').addClass('active').siblings().removeClass('active');
clearPersonaEnvInfo();
var persona = JSON.parse($.session.get("Persona"));
var theEnvName = $(this).text();
Expand Down
4 changes: 2 additions & 2 deletions cairis/web/dist/js/cairis/projectSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,10 @@ function postProjectImage(imagedir, actualDir) {
}

function appendNamingConvention(name,def){
$("#editNamingConventionsTable").find("tbody").append("<tr class='editNamingConvention'><td class='removeProjectNamingConvertion' ><i class='fa fa-minus'></i></td><td class='namingConvention'>" + name + "</td><td class='theNameingDef'>"+ def + "</td></tr>");
$("#editNamingConventionsTable").find("tbody").append("<tr class='editNamingConvention'><td class='removeProjectNamingConvertion addRemove' ><i class='fa fa-minus'></i></td><td class='namingConvention'>" + name + "</td><td class='theNameingDef'>"+ def + "</td></tr>");
}
function appendContributor(con){
$("#editContributorTable").find("tbody").append("<tr class='editContributor'><td class='removeContributor' ><i class='fa fa-minus'></i></td><td class='projectContributor'>" + con.firstName + "</td><td class='conSurname'>"+ con.surname + "</td><td class='conAffliation'>"+ con.affiliation + "</td><td class='conRole'>"+ con.role +"</td></tr>");
$("#editContributorTable").find("tbody").append("<tr class='editContributor'><td class='removeContributor addRemove' ><i class='fa fa-minus'></i></td><td class='projectContributor'>" + con.firstName + "</td><td class='conSurname'>"+ con.surname + "</td><td class='conAffliation'>"+ con.affiliation + "</td><td class='conRole'>"+ con.role +"</td></tr>");
}

function editProjectRevisions(rev){
Expand Down
1 change: 1 addition & 0 deletions cairis/web/dist/js/cairis/responses.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ mainContent.on('click', ".deleteRespEnv", function () {


mainContent.on('click', ".responseEnvironment", function () {
$(this).closest('tr').addClass('active').siblings().removeClass('active');
var type = $.session.get("responseKind");
var resp = JSON.parse($.session.get("response"));
var environmentName = $(this).text();
Expand Down
Loading

0 comments on commit 1cd4399

Please sign in to comment.