Skip to content

Commit

Permalink
Fix #580
Browse files Browse the repository at this point in the history
  • Loading branch information
failys committed Dec 9, 2020
1 parent f66f6f7 commit 8de46a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cairis/data/DimensionDAO.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def get_objects_by_names(self,table,id):

def get_objects_by_2parameters(self,table,environment):
try:
permissableDimensions = ['asset','asset_value','attacker','control','countermeasure','datastore','detection_mechanism','diagramDatastore','diagramEntity','diagramProcess','domainproperty','dfd_filter','entity','goal','misusecase','obstacle','persona', 'process', 'requirement','response','risk','role','task','task_characteristic', 'threat', 'ugm_filter','usecase', 'vulnerability','component']
permissableDimensions = ['asset','asset_value','attacker','control','countermeasure','datastore','detection_mechanism','diagramDatastore','diagramEntity','diagramProcess','domainproperty','dfd_filter','entity','goal','misusecase','obstacle','persona', 'process', 'requirement','response','risk','role','task','task_characteristic', 'threat', 'ugm_filter','usecase', 'unconnected_vulnerability','unconnected_threat','vulnerability','component']
if (table not in permissableDimensions):
raise CairisHTTPError(BAD_REQUEST,'Invalid dimension',table + ' is not a permissable dimension when specifying environment')
if (self.db_proxy.nameExists(environment,'environment') == False):
Expand Down
10 changes: 5 additions & 5 deletions cairis/sql/procs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6628,9 +6628,9 @@ begin
union
select ga.id id,e.name environment,hg.name goal_name,'obstacle' goal_dim,rt.name ref_type,tg.name subgoal_name, 'domainproperty' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from obstacledomainproperty_goalassociation ga, environment e, obstacle hg, reference_type rt, domainproperty tg where ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id
union
select ga.id id,e.name environment,hg.name goal_name,'obstacle' goal_dim,rt.name ref_type,tg.name subgoal_name, 'unconnected_vulnerability' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from obstaclevulnerability_goalassociation ga, environment e, obstacle hg, reference_type rt, vulnerability tg where ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id
select ga.id id,e.name environment,hg.name goal_name,'obstacle' goal_dim,rt.name ref_type,tg.name subgoal_name, 'vulnerability' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from obstaclevulnerability_goalassociation ga, environment e, obstacle hg, reference_type rt, vulnerability tg where ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id
union
select ga.id id,e.name environment,hg.name goal_name,'obstacle' goal_dim,rt.name ref_type,tg.name subgoal_name, 'unconnected_threat' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from obstaclethreat_goalassociation ga, environment e, obstacle hg, reference_type rt, threat tg where ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id;
select ga.id id,e.name environment,hg.name goal_name,'obstacle' goal_dim,rt.name ref_type,tg.name subgoal_name, 'threat' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from obstaclethreat_goalassociation ga, environment e, obstacle hg, reference_type rt, threat tg where ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id;
else
select id into environmentId from environment where name = environmentName limit 1;
select ga.id id,e.name environment,hg.name goal_name,'goal' goal_dim,rt.name ref_type,tg.name subgoal_name,'goal' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from goalgoal_goalassociation ga, environment e, goal hg, reference_type rt, goal tg where ga.environment_id = environmentId and ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id
Expand Down Expand Up @@ -6667,9 +6667,9 @@ begin
union
select ga.id id,e.name environment,hg.name goal_name,'obstacle' goal_dim,rt.name ref_type,tg.name subgoal_name, 'domainproperty' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from obstacledomainproperty_goalassociation ga, environment e, obstacle hg, reference_type rt, domainproperty tg where ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id and ga.environment_id = environmentId
union
select ga.id id,e.name environment,hg.name goal_name,'obstacle' goal_dim,rt.name ref_type,tg.name subgoal_name, 'unconnected_vulnerability' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from obstaclevulnerability_goalassociation ga, environment e, obstacle hg, reference_type rt, vulnerability tg where ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id and ga.environment_id = environmentId
select ga.id id,e.name environment,hg.name goal_name,'obstacle' goal_dim,rt.name ref_type,tg.name subgoal_name, 'vulnerability' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from obstaclevulnerability_goalassociation ga, environment e, obstacle hg, reference_type rt, vulnerability tg where ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id and ga.environment_id = environmentId
union
select ga.id id,e.name environment,hg.name goal_name,'obstacle' goal_dim,rt.name ref_type,tg.name subgoal_name, 'unconnected_threat' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from obstaclethreat_goalassociation ga, environment e, obstacle hg, reference_type rt, threat tg where ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id and ga.environment_id = environmentId;
select ga.id id,e.name environment,hg.name goal_name,'obstacle' goal_dim,rt.name ref_type,tg.name subgoal_name, 'threat' subgoal_dim,ga.alternative_id alternative_id,ga.rationale from obstaclethreat_goalassociation ga, environment e, obstacle hg, reference_type rt, threat tg where ga.goal_id = hg.id and ga.ref_type_id = rt.id and ga.subgoal_id = tg.id and ga.environment_id = e.id and ga.environment_id = environmentId;
end if;
end
//
Expand Down Expand Up @@ -6910,7 +6910,7 @@ begin
elseif goalDimName = 'obstacle' and subGoalDimName = 'vulnerability'
then
select id into goalId from obstacle where name = goalName;
select id into subGoalId from threat where name = subGoalName;
select id into subGoalId from vulnerability where name = subGoalName;
update obstaclevulnerability_goalassociation set environment_id = environmentId, goal_id = goalId, ref_type_id = aTypeId, subgoal_id = subGoalId,alternative_id = alternativeId, rationale = rationaleName where id = associationId;
elseif goalDimName = 'obstacle' and subGoalDimName = 'role'
then
Expand Down

0 comments on commit 8de46a8

Please sign in to comment.