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

NEW FEATURE: Phishing Policies #226

Merged
merged 1 commit into from
Nov 9, 2021
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
76 changes: 76 additions & 0 deletions PhishPolicyList.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<main>
<header class="page-header page-header-compact page-header-light border-bottom bg-white mb-4">
<div class="container-fluid px-4">
<div class="page-header-content">
<div class="row align-items-center justify-content-between pt-3">
<div class="col-auto mb-3">
<h1 class="page-header-title">
<div class="page-header-icon"><i data-feather="user"></i></div>
Phishing Policies
</h1>
</div>
<div class="col-12 col-xl-auto mb-3">
<a class="btn btn-sm btn-light text-primary" href="index.html?page=users.html">
<i class="me-1" data-feather="users"></i>
Manage Users
</a>
<a class="btn btn-sm btn-light text-primary" href="index.html?page=users.html">
<i class="me-1" data-feather="user-plus"></i>
Manage Groups
</a>
</div>
</div>
</div>
</div>
</header>
<!-- Main page content-->
<div class="container-fluid px-4">
<div><label for="exampleDataList" class="form-label">Tenant Selector</label>
<input class="form-control" list="datalistOptions" id="exampleDataList" placeholder="Type to search..."
style="width: 50%;" oninput='onInput()'>
<datalist id="datalistOptions">
<option value="Select a tenant" text="Select a tenant">
</datalist>
</div><br>
<div class="card">
<div class="card-header">Phishing Policies</div>
<div class="card-body">
<table id="datatablesSimple">
<table cellpadding="0" cellspacing="0" class="datatable-1 table table-striped" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Phishing Threshold</th>
<th>Enabled</th>
<th>Priority</th>
<th>Excluded Domains</th>
<th>Excluded Senders</th>
<th>Last Modified</th>
</tr>
</thead>
<tbody id='AccountTable'>
</tbody>
<tfoot>
<tr>
<th>Name</th>
<th>Phishing Threshold</th>
<th>Enabled</th>
<th>Priority</th>
<th>Excluded Domains</th>
<th>Excluded Senders</th>
<th>Last Modified</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</main>
<script src="js/datatables/jquery.dataTables.js"></script>
<script src="js/tenantlist.js"></script>
<script src="js/datatables/datatablesPhishPolicies.js"></script>

</body>


</html>
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ <h6 class="dropdown-header d-flex align-items-center">
href="index.html?page=MailboxCASList">Mailbox Client Access Settings</a>
<a class="nav-link" apilink="Messagetrace"
href="index.html?page=Messagetrace">Message Trace</a>
<a class="nav-link" apilink="PhishPolicyList"
href="index.html?page=PhishPolicyList">Phishing Policies</a>
</nav>
</div>
</section>
Expand Down
141 changes: 141 additions & 0 deletions js/datatables/datatablesPhishPolicies.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
$(document).ready(function () {
let searchParams = new URLSearchParams(window.location.search)
var TenantID = '';
if (searchParams.has('Tenantfilter')) {
TenantID = searchParams.get('Tenantfilter')
}

var todayDate = new Date().toISOString().slice(0, 10);
if(TenantID !== '') {
$('.datatable-1').dataTable(
{
language: {
paginate: {
next: '<i class="fas fa-arrow-right"></i>',
previous: '<i class="fas fa-arrow-left"></i>'
}
},
"columnDefs": [
{ "className": "dt-center", "targets": [-1] },

],
"deferRender": true,
"pageLength": 25,
responsive: true,
"ajax": {

"url": "/api/ListPhishPolicies?Tenantfilter=" + TenantID,
"dataSrc": ""
},
dom: 'fBlrtip',
buttons: [
{ extend: 'copyHtml5', className: 'btn btn-primary btn-sm' },
{ extend: 'excelHtml5', className: 'btn btn-primary btn-sm', title: 'Phishing Policies - ' + TenantID + " - " + todayDate },
{ extend: 'csvHtml5', className: 'btn btn-primary btn-sm', title: 'Phishing Policies - ' + TenantID + " - " + todayDate },
{ extend: 'pdfHtml5', className: 'btn btn-primary btn-sm', pageSize: 'A2', orientation: 'landscape', title: 'Phishing Policies - ' + TenantID + " - " + todayDate, exportOptions: {columns: [ 0,1,2,4,5 ]} },
],
"columns": [
{ "data": "Name" },
{ "data": "PhishThresholdLevel" },
{
"data": "Enabled",
"render": function (data, type, row) {
if (type === "export" || type === "sort" || type === "filter") {
if (data === true) {
return 'Enabled'
} else if (data === false) {
return 'Disabled'
} else {
return 'No Data'
}
}
if (data === true) {
return '<i class="fas fa-check-circle text-success" style="font-size:1.3rem;"></i>';
}
if (data === false) {
return '<i class="fas fa-times-circle text-danger" style="font-size:1.3rem;"></i></a>';
}
else {
return '<h5><span class="badge bg-secondary" style="font-size:1.3rem;">No Data</span></h5>';
}
}
},
{
"data": "Priority",
"render": function (data, type, row) {
if (data === null) {
return 'Default (Lowest)';
}
else
{
return data;
}
}
},
{
"data": "ExcludedDomainCount",
"render": function (data, type, row) {
if (type === "export" || type === "sort" || type === "filter") {
if (data > 0) {
return data + ' Excluded Domains - ' + row.ExcludedDomains
} else if (data === 0) {
return 'No Excluded Domains'
} else {
return 'No Data'
}
}
if (data > 0) {
//return '<h5><span class="badge bg-danger">' + data + ' Users Enabled</span></h5>'
return '<button type="button" class="btn btn-warning btn-sm" data-bs-toggle="modal" data-bs-target="#' + row.GUID + 'PhishPolicy">' + row.ExcludedDomainCount + ' Users</button><!-- Modal --><div class="modal fade" id="' + row.GUID + 'PhishPolicy" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><h5 class="modal-title" id="exampleModalLabel">Excluded Domains in Policy</h5><button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button></div><div class="modal-body"> ' + row.ExcludedDomains + '</div><div class="modal-footer"><button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button></div></div></div></div>'
}
if (data === 0) {
return '<h5><span class="badge bg-success">None</span></h5>';
}
else {
return '<h5><span class="badge bg-secondary">No Data</span></h5>'
}
}
},
{
"data": "ExcludedSenderCount",
"render": function (data, type, row) {
if (type === "export" || type === "sort" || type === "filter") {
if (data > 0) {
return data + ' Excluded Senders - ' + row.ExcludedSenders
} else if (data === 0) {
return 'No Excluded Senders'
} else {
return 'No Data'
}
}
if (data > 0) {
//return '<h5><span class="badge bg-danger">' + data + ' Users Enabled</span></h5>'
return '<button type="button" class="btn btn-warning btn-sm" data-bs-toggle="modal" data-bs-target="#' + row.GUID + 'PhishPolicy2">' + row.ExcludedSenderCount + ' Users</button><!-- Modal --><div class="modal fade" id="' + row.GUID + 'PhishPolicy2" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><h5 class="modal-title" id="exampleModalLabel">Excluded Senders in Policy</h5><button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button></div><div class="modal-body"> ' + row.ExcludedSenders + '</div><div class="modal-footer"><button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button></div></div></div></div>'
}
if (data === 0) {
return '<h5><span class="badge bg-success">None</span></h5>';
}
else {
return '<h5><span class="badge bg-secondary">No Data</span></h5>'
}
}
},
{ "data": "WhenChangedUTC" },
],
"order": [[0, "asc"]],
'columnDefs': [
{
"targets": [1, 2, 3, 4, 5], // your case first column
"className": "text-center align-middle"
}
],
}
);
}
else {
$("#AccountTable").append("<tr><td colspan='8'>Select a Tenant to get started.</td></tr>")
}

$('.dataTables_paginate').addClass("btn-group datatable-pagination");
$('.dataTables_paginate > a').wrapInner('<span />');
});