From ea7ed80ed0f5de3fff1b7d208548e323730b01ab Mon Sep 17 00:00:00 2001 From: Shamal Faily Date: Tue, 12 Jan 2021 14:37:23 -0800 Subject: [PATCH] Fix #603 --- cairis/sql/procs.sql | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cairis/sql/procs.sql b/cairis/sql/procs.sql index 91aa70b76..d30e2af0f 100755 --- a/cairis/sql/procs.sql +++ b/cairis/sql/procs.sql @@ -6079,7 +6079,7 @@ begin union select -1,e.name,concat('Concerns usecase ',t.name),'usecaseconcern',0,'Association','1','','','1','Association',0,'asset',a.name,concat('Concerns use case ',t.name) from usecase_asset tc, usecase t, environment_asset ea, asset a, environment e where ea.environment_id = environmentId and ea.environment_id = tc.environment_id and ea.asset_id = tc.asset_id and tc.usecase_id = t.id and tc.asset_id = ea.asset_id and tc.asset_id = a.id and ea.environment_id = e.id union - select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,concat('Is a ',r.name) rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, asset_tag at, tag t where p.id = pr.persona_id and pr.environment_id = environmentId and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id; + select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,concat('Is a ',r.name) rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, task_persona tp, task_asset ta, asset_tag at, tag t where p.id = pr.persona_id and pr.environment_id = environmentId and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id and pr.environment_id = tp.environment_id and pr.persona_id = tp.persona_id and tp.environment_id = ta.environment_id and tp.task_id = ta.task_id; else select a.id,e.name,ha.name,'asset',a.head_navigation,hat.name,hm.name,a.head_role_name,a.tail_role_name,tm.name,tat.name,a.tail_navigation,'asset',ta.name,a.rationale rationale from classassociation a, environment e, asset ha, multiplicity_type hm, association_type hat, association_type tat, multiplicity_type tm, asset ta where a.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and a.environment_id = e.id and a.head_id = ha.id and a.head_multiplicity_id = hm.id and a.head_association_type_id = hat.id and a.tail_association_type_id = tat.id and a.tail_multiplicity_id = tm.id and a.tail_id = ta.id union @@ -6109,7 +6109,7 @@ begin union select -1,e.name,va.name,'asset',1,'Dependency','1','<<safeguards>>','','1','Association',0,'asset',ma.name,'' rationale from asset ma, asset va, environment e, component_threat_target ctt, asset_threat at where ma.id = ctt.asset_id and ctt.threat_id = at.threat_id and at.asset_id = va.id and ctt.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and at.environment_id = environmentId and at.environment_id = e.id union - select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,concat('Is a ',r.name) rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, asset_tag at, tag t where p.id = pr.persona_id and pr.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id; + select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,concat('Is a ',r.name) rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, task_persona tp, task_asset ta, asset_tag at, tag t where p.id = pr.persona_id and pr.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id and pr.environment_id = tp.environment_id and pr.persona_id = tp.persona_id and tp.environment_id = ta.environment_id and tp.task_id = ta.task_id; end if; end // @@ -6143,7 +6143,7 @@ begin union select -1,e.name,sa.name,'asset',0,'Association',tmt.name,ca.link,'',smt.name,'Association',0,'asset',ta.name,'' rationale from task_concernassociation ca, asset sa, multiplicity_type smt, asset ta, multiplicity_type tmt, environment e where ca.environment_id = environmentId and ca.source_id = sa.id and ca.target_id = ta.id and ca.source_multiplicity_id = smt.id and ca.target_multiplicity_id = tmt.id and ca.environment_id = e.id union - select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,'' rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, asset_tag at, tag t where p.id = pr.persona_id and pr.environment_id = environmentId and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id; + select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,'' rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, task_persona tp, task_asset ta, asset_tag at, tag t where p.id = pr.persona_id and pr.environment_id = environmentId and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id and pr.environment_id = tp.environment_id and pr.persona_id = tp.persona_id and tp.environment_id = ta.environment_id and tp.task_id = ta.task_id; else select a.id,e.name,ha.name,'asset',a.head_navigation,hat.name,hm.name,a.head_role_name,a.tail_role_name,tm.name,tat.name,a.tail_navigation,'asset',ta.name,'' rationale from classassociation a, environment e, asset ha, multiplicity_type hm, association_type hat, association_type tat, multiplicity_type tm, asset ta where a.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and a.environment_id = e.id and a.head_id = ha.id and a.head_multiplicity_id = hm.id and a.head_association_type_id = hat.id and a.tail_association_type_id = tat.id and a.tail_multiplicity_id = tm.id and a.tail_id = ta.id union @@ -6169,7 +6169,7 @@ begin union select -1,e.name,sa.name,'asset',0,'Association',tmt.name,ca.link,'',smt.name,'Association',0,'asset',ta.name,'' rationale from task_concernassociation ca, asset sa, multiplicity_type smt, asset ta, multiplicity_type tmt, environment e where ca.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and ca.source_id = sa.id and ca.target_id = ta.id and ca.source_multiplicity_id = smt.id and ca.target_multiplicity_id = tmt.id and ca.environment_id = e.id union - select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,'' rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, asset_tag at, tag t where p.id = pr.persona_id and pr.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id; + select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,'' rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, task_persona tp, asset_tag at, task_asset ta, tag t where p.id = pr.persona_id and pr.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id and pr.environment_id = tp.environment_id and pr.persona_id = tp.persona_id and tp.environment_id = ta.environment_id and tp.task_id = ta.task_id; end if; end // @@ -12650,7 +12650,7 @@ begin union select -1,he.name,ha.name,'asset',0,hat.name,hm.name,a.head_role_name,a.tail_role_name,tm.name,tat.name,0,'asset',ta.name,concat('Concerns Security Pattern ',sp.name) rationale from securitypattern_classassociation a, environment he, environment te, asset ha, template_asset hta, multiplicity_type hm, association_type hat, association_type tat, multiplicity_type tm, asset ta, template_asset tta, environment_asset hea, environment_asset tea, securitypattern_asset_template_asset hata, securitypattern_asset_template_asset tata,securitypattern sp where a.tail_id = assetId and hea.environment_id = environmentId and hea.environment_id = tea.environment_id and hea.environment_id = he.id and tea.environment_id = te.id and hea.asset_id = ha.id and tea.asset_id = ta.id and a.head_id = hta.id and a.head_multiplicity_id = hm.id and a.head_association_type_id = hat.id and a.tail_association_type_id = tat.id and a.tail_multiplicity_id = tm.id and a.tail_id = tta.id and ha.id = hata.asset_id and hata.template_asset_id = hta.id and hata.pattern_id = sp.id and ta.id = tata.asset_id and tata.template_asset_id = tta.id and tata.pattern_id = sp.id and a.pattern_id = sp.id union - select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,concat('Is a ',r.name) rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, asset_tag at, tag t where a.id = assetId and p.id = pr.persona_id and pr.environment_id = environmentId and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id; + select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,concat('Is a ',r.name) rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, task_persona tp, task_asset ta, asset_tag at, tag t where a.id = assetId and p.id = pr.persona_id and pr.environment_id = environmentId and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id and pr.environment_id = tp.environment_id and pr.persona_id = tp.persona_id and tp.environment_id = ta.environment_id and tp.task_id = ta.task_id; else insert into temp_classtree(id,environment,head_name,head_dim,head_nav,head_assoc,head_mult,head_role,tail_role,tail_mult,tail_assoc,tail_nav,tail_dim,tail_name,rationale) select a.id,e.name,ha.name,'asset',a.head_navigation,hat.name,hm.name,a.head_role_name,a.tail_role_name,tm.name,tat.name,a.tail_navigation,'asset',ta.name,a.rationale rationale from classassociation a, environment e, asset ha, multiplicity_type hm, association_type hat, association_type tat, multiplicity_type tm, asset ta where a.head_id = assetId and a.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and a.environment_id = e.id and a.head_id = ha.id and a.head_multiplicity_id = hm.id and a.head_association_type_id = hat.id and a.tail_association_type_id = tat.id and a.tail_multiplicity_id = tm.id and a.tail_id = ta.id @@ -12679,7 +12679,7 @@ begin union select -1,he.name,ha.name,'asset',0,hat.name,hm.name,a.head_role_name,a.tail_role_name,tm.name,tat.name,0,'asset',ta.name,concat('Concerns Security Pattern ',sp.name) rationale from securitypattern_classassociation a, environment he, environment te, asset ha, template_asset hta, multiplicity_type hm, association_type hat, association_type tat, multiplicity_type tm, asset ta, template_asset tta, environment_asset hea, environment_asset tea, securitypattern_asset_template_asset hata, securitypattern_asset_template_asset tata,securitypattern sp where a.tail_id = assetId and hea.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and hea.environment_id = tea.environment_id and hea.environment_id = he.id and tea.environment_id = te.id and hea.asset_id = ha.id and tea.asset_id = ta.id and a.head_id = hta.id and a.head_multiplicity_id = hm.id and a.head_association_type_id = hat.id and a.tail_association_type_id = tat.id and a.tail_multiplicity_id = tm.id and a.tail_id = tta.id and ha.id = hata.asset_id and hata.template_asset_id = hta.id and hata.pattern_id = sp.id and ta.id = tata.asset_id and tata.template_asset_id = tta.id and tata.pattern_id = sp.id and a.pattern_id = sp.id union - select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,concat('Is a ',r.name) rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, asset_tag at, tag t where a.id = assetId and p.id = pr.persona_id and pr.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id; + select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,concat('Is a ',r.name) rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, task_persona tp, task_asset ta, asset_tag at, tag t where a.id = assetId and p.id = pr.persona_id and pr.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id and pr.environment_id = tp.environment_id and pr.persona_id = tp.persona_id and tp.environment_id = ta.environment_id and tp.task_id = ta.task_id; end if; select id,environment,head_name,head_dim,head_nav,head_assoc,head_mult,head_role,tail_role,tail_mult,tail_assoc,tail_nav,tail_dim,tail_name,rationale from temp_classtree; @@ -12725,7 +12725,7 @@ begin union select -1,e.name,sa.name,'asset',0,'Association',tmt.name,ca.link,'',smt.name,'Association',0,'asset',ta.name,'' rationale from task_concernassociation ca, asset sa, environment_asset sea, multiplicity_type smt, asset ta, environment_asset tea, multiplicity_type tmt, environment e where ca.environment_id = environmentId and ca.source_id = sa.id and ca.target_id = ta.id and ca.source_multiplicity_id = smt.id and ca.target_multiplicity_id = tmt.id and ca.environment_id = e.id and sa.id = sea.asset_id and sea.environment_id = ca.environment_id and ta.id = assetId and ta.id = tea.asset_id and tea.environment_id = ca.environment_id union - select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,concat('Is a ',r.name) rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, asset_tag at, tag t where a.id = assetId and p.id = pr.persona_id and pr.environment_id = environmentId and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id; + select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,concat('Is a ',r.name) rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, task_persona tp, task_asset ta, asset_tag at, tag t where a.id = assetId and p.id = pr.persona_id and pr.environment_id = environmentId and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id and pr.environment_id = tp.environment_id and pr.persona_id = tp.persona_id and tp.environment_id = ta.environment_id and tp.task_id = ta.task_id; else insert into temp_classtree(id,environment,head_name,head_dim,head_nav,head_assoc,head_mult,head_role,tail_role,tail_mult,tail_assoc,tail_nav,tail_dim,tail_name,rationale) select a.id,e.name,ha.name,'asset',a.head_navigation,hat.name,hm.name,a.head_role_name,a.tail_role_name,tm.name,tat.name,a.tail_navigation,'asset',ta.name,'' rationale from classassociation a, environment e, asset ha, multiplicity_type hm, association_type hat, association_type tat, multiplicity_type tm, asset ta, environment_asset hea, environment_asset tea where a.head_id = assetId and a.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and a.environment_id = e.id and a.head_id = ha.id and a.head_multiplicity_id = hm.id and a.head_association_type_id = hat.id and a.tail_association_type_id = tat.id and a.tail_multiplicity_id = tm.id and a.tail_id = ta.id and ha.id = hea.asset_id and hea.environment_id = a.environment_id and ta.id = tea.asset_id and tea.environment_id = a.environment_id @@ -12746,7 +12746,7 @@ begin union select -1,e.name,sa.name,'asset',0,'Association',tmt.name,ca.link,'',smt.name,'Association',0,'asset',ta.name,'' rationale from task_concernassociation ca, asset sa, environment_asset sea, multiplicity_type smt, asset ta, environment_asset tea, multiplicity_type tmt, environment e where ca.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and ca.source_id = sa.id and ca.target_id = ta.id and ca.source_multiplicity_id = smt.id and ca.target_multiplicity_id = tmt.id and ca.environment_id = e.id and sa.id = sea.asset_id and sea.environment_id = ca.environment_id and ta.id = assetId and ta.id = tea.asset_id and tea.environment_id = ca.environment_id union - select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,concat('Is a ',r.name) rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, asset_tag at, tag t where a.id = assetId and p.id = pr.persona_id and pr.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id; + select -1,e.name,p.name,'persona',0,'Association','1','','','1','Inheritance',0,'asset', a.name,concat('Is a ',r.name) rationale from persona p, asset a, environment e, role r, environment_asset ea, persona_role pr, task_persona tp, task_asset ta, asset_tag at, tag t where a.id = assetId and p.id = pr.persona_id and pr.environment_id in (select environment_id from composite_environment where composite_environment_id = environmentId) and pr.environment_id = ea.environment_id and pr.role_id = r.id and r.name = substr(t.name,6) and ea.asset_id = at.asset_id and at.tag_id = t.id and ea.asset_id = a.id and pr.environment_id = tp.environment_id and pr.persona_id = tp.persona_id and tp.environment_id = ta.environment_id and tp.task_id = ta.task_id; end if; select id,environment,head_name,head_dim,head_nav,head_assoc,head_mult,head_role,tail_role,tail_mult,tail_assoc,tail_nav,tail_dim,tail_name,rationale from temp_classtree; end