forked from salesforce/vulnreport
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add functions for import/export Vulntypes via XML
- Loading branch information
Tim Bach
committed
Oct 14, 2016
1 parent
7841882
commit 70016c4
Showing
5 changed files
with
259 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<%= erb :header_partial %> | ||
|
||
<div class="row"> | ||
<div class="col-lg-12"> | ||
<h1>VulnTypes <small>Administration</small></h1> | ||
<ol class="breadcrumb"> | ||
<li><a href="/admin/settings"><i class="fa fa-cog"></i> Vulnreport Settings</a></li> | ||
<li><a href="/admin/vulntypes"><i class="fa fa-wrench"></i> VulnTypes</a></li> | ||
<li class="active"><i class="fa fa-wrench"></i> Import</li> | ||
</ol> | ||
</div> | ||
</div><!-- /.row --> | ||
|
||
<%= erb :admin_types_nav_partial %> | ||
|
||
<div class="row"> | ||
<div class="col-lg-1"></div> | ||
<div class="col-lg-6"> | ||
<p> | ||
To import Vulntypes (exported from another Vulnreport system or provided via the <a href="https://github.com/salesforce/vulnreport" target="_blank">Vulnreport GitHub repo</a>) select the XML file to upload below. | ||
</p> | ||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="col-lg-2"></div> | ||
<div class="col-lg-3" style="text-align:center;"> | ||
<form action="/admin/vulntypes/import" method="POST" enctype="multipart/form-data"> | ||
<%=csrf_tag%> | ||
<input type="file" class="form-control" name="vt_import" placeholder="Vulntypes XML File"> | ||
<button type="submit" class="btn btn-default" style="margin-top:12px;">Import Vulntypes</button> | ||
</form> | ||
</div> | ||
</div> | ||
|
||
<%= erb :footer_partial %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<%= erb :header_partial %> | ||
|
||
<script type="text/javascript"> | ||
$(function() { | ||
$("#rt-multiselect").multiSelect({ | ||
selectableHeader: "<div class='msHeader'>Available RecordTypes</div>", | ||
selectionHeader: "<div class='msHeader'>Selected RecordTypes</div>", | ||
}); | ||
}); | ||
</script> | ||
|
||
<div class="row"> | ||
<div class="col-lg-12"> | ||
<h1>VulnTypes <small>Administration</small></h1> | ||
<ol class="breadcrumb"> | ||
<li><a href="/admin/settings"><i class="fa fa-cog"></i> Vulnreport Settings</a></li> | ||
<li><a href="/admin/vulntypes"><i class="fa fa-wrench"></i> VulnTypes</a></li> | ||
<li class="active"><i class="fa fa-wrench"></i> Import</li> | ||
</ol> | ||
</div> | ||
</div><!-- /.row --> | ||
|
||
<%= erb :admin_types_nav_partial %> | ||
|
||
<div class="row"> | ||
<div class="col-lg-1"></div> | ||
<div class="col-lg-6"> | ||
<p> | ||
Confirm which Vulntypes you'd like to import from the uploaded XML. | ||
</p> | ||
</div> | ||
</div> | ||
|
||
<form action="/admin/vulntypes/doImport" method="POST"> | ||
<%=csrf_tag%> | ||
<% @vts.each_with_index do |vt, idx| %> | ||
<div class="row" id="vt_<%=idx%>"> | ||
<div class="col-lg-1"></div> | ||
<div class="col-lg-10"> | ||
<input type="checkbox" name="vt_confirms[]" id="vt_confirm_<%=idx%>" value="<%=idx%>" checked> <%=h(vt[:name])%> | ||
<input type="hidden" name="vt_name_<%=idx%>" value="<%=h(vt[:name])%>" /> | ||
<input type="hidden" name="vt_label_<%=idx%>" value="<%=h(vt[:label])%>" /> | ||
<input type="hidden" name="vt_cwe_<%=idx%>" value="<%=h(vt[:cwe])%>" /> | ||
<input type="hidden" name="vt_priority_<%=idx%>" value="<%=h(vt[:priority])%>" /> | ||
<input type="hidden" name="vt_enabled_<%=idx%>" value="<%=h(vt[:enabled])%>" /> | ||
<input type="hidden" name="vt_html_<%=idx%>" value="<%=h(vt[:html])%>" /> | ||
</div> | ||
<div class="col-lg-1"></div> | ||
</div> | ||
<% end %> | ||
|
||
<div class="row"> | ||
<div class="col-lg-1"></div> | ||
<div class="col-lg-10"> | ||
<hr /> | ||
<h4 style="margin-top:-20px; margin-left:40px; margin-bottom:20px; color:#999;"> | ||
App Record Types | ||
<small style="font-size:6pt;">Select which Record Types imported Vulntypes should be available on</small> | ||
</h4> | ||
|
||
<div class="form-group"> | ||
<div class="col-sm-2"></div> | ||
<div class="col-sm-6"> | ||
<select multiple="multiple" id="rt-multiselect" name="rtms[]" rel="jqms"> | ||
<% @appRecordTypes.each do |rt| %> | ||
<option value="<%=rt.id%>"><%=h(rt.name)%></option> | ||
<% end %> | ||
</select> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="col-lg-1"></div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="col-lg-4"></div> | ||
<div class="col-lg-7"> | ||
<button type="submit" class="btn btn-success" style="margin:20px;">Import Vulntypes</button> | ||
</div> | ||
<div class="col-lg-1"></div> | ||
</div> | ||
</form> | ||
|
||
<%= erb :footer_partial %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters