diff --git a/spfx/src/webparts/siteAdmin/SiteAdminWebPart.manifest.json b/spfx/src/webparts/siteAdmin/SiteAdminWebPart.manifest.json index 3efd464..0e6072d 100644 --- a/spfx/src/webparts/siteAdmin/SiteAdminWebPart.manifest.json +++ b/spfx/src/webparts/siteAdmin/SiteAdminWebPart.manifest.json @@ -36,6 +36,7 @@ "DisableSensitivityLabelOverride": false, "MaxStorage": 25, "MaxStorageDescription": "The max threshold has been met.", + "ReportsDLPFileExt": "csv doc docx dot dotx pdf pot potx pps ppsx ppt pptx txt xls xlsx xlt xltx", "ReportsDocSearchFileExt": "csv doc docx dot dotx pdf pot potx pps ppsx ppt pptx txt xls xlsx xlt xltx", "ReportsDocSearchKeywords": "phi pii ssn", "SiteAttestation": false, diff --git a/spfx/src/webparts/siteAdmin/SiteAdminWebPart.ts b/spfx/src/webparts/siteAdmin/SiteAdminWebPart.ts index ef3f1c1..10fd040 100644 --- a/spfx/src/webparts/siteAdmin/SiteAdminWebPart.ts +++ b/spfx/src/webparts/siteAdmin/SiteAdminWebPart.ts @@ -40,6 +40,7 @@ export interface ISiteAdminWebPartProps { MaxStorage: number; MaxStorageDescription: string; ReportsDocRententionYears: string; + ReportsDLPFileExt: string; ReportsDocSearchFileExt: string; ReportsDocSearchKeywords: string; SiteAttestation: boolean; @@ -138,6 +139,7 @@ declare const SiteAdmin: { siteAttestationText?: string; reportProps?: { docRententionYears?: string; + dlpFileExt?: string; docSearchFileExt?: string; docSearchKeywords?: string; } @@ -222,6 +224,7 @@ export default class SiteAdminWebPart extends BaseClientSideWebPart { let counter = 0; @@ -162,33 +172,50 @@ export class DLP { // Parse the items and create the batch job items.results.forEach(item => { - // Increment the counter - batchRequests++; - - // Create a batch request to get the dlp policy on this item - list.Items(item.Id).GetDlpPolicyTip().batch(result => { - // Ensure a policy exists - if (typeof (result["GetDlpPolicyTip"]) === "undefined") { - // Parse the conditions - result.MatchedConditionDescriptions.results.forEach(condition => { - // Append the data - this._items.push({ - AppliedActionsText: result.AppliedActionsText, - Author: item["Author"]?.Title, - ConditionDescription: condition, - FileExtension: item["File_x0020_Type"], - FileName: item["FileLeafRef"], - GeneralText: result.GeneralText, - LastProcessedTime: result.LastProcessedTime, - ListId: lib.Id, - ListTitle: lib.Title, - Path: item["FileRef"], - WebId: webId, - WebUrl: webUrl + let analyzeFile = true; + + // See if the file extensions are provided + if (fileExtensions) { + // Default the flag + analyzeFile = false + + // Loop through the file extensions + fileExtensions.forEach(fileExt => { + // Set the flag if there is match + if (fileExt.toLowerCase() == item["File_x0020_Type"]?.toLowerCase()) { analyzeFile = true; } + }); + } + + // See if we are analyzing this file + if (analyzeFile) { + // Increment the counter + batchRequests++; + + // Create a batch request to get the dlp policy on this item + list.Items(item.Id).GetDlpPolicyTip().batch(result => { + // Ensure a policy exists + if (typeof (result["GetDlpPolicyTip"]) === "undefined") { + // Parse the conditions + result.MatchedConditionDescriptions.results.forEach(condition => { + // Append the data + this._items.push({ + AppliedActionsText: result.AppliedActionsText, + Author: item["Author"]?.Title, + ConditionDescription: condition, + FileExtension: item["File_x0020_Type"], + FileName: item["FileLeafRef"], + GeneralText: result.GeneralText, + LastProcessedTime: result.LastProcessedTime, + ListId: lib.Id, + ListTitle: lib.Title, + Path: item["FileRef"], + WebId: webId, + WebUrl: webUrl + }); }); - }); - } - }); + } + }); + } }); // Update the dialog @@ -203,7 +230,7 @@ export class DLP { } // Renders the search summary - private static renderSummary(el: HTMLElement, auditOnly: boolean, onClose: () => void) { + private static renderSummary(el: HTMLElement, auditOnly: boolean, showSearch?: boolean, onClose?: () => void) { // Render the summary new Dashboard({ el, @@ -328,6 +355,9 @@ export class DLP { LoadingDialog.setBody("Loading the libraries..."); LoadingDialog.show(); + // Get the file extensions + let fileExtensions: string[] = values["FileTypes"] ? values["FileTypes"].trim().split(' ') : []; + // Parse the webs let counter = 0; Helper.Executor(DataSource.SiteItems, siteItem => { @@ -358,7 +388,7 @@ export class DLP { LoadingDialog.setBody("Loading the files for the libraries..."); // Analyze the libraries - this.analyzeLibraries(siteItem.value, siteItem.text, libs.results).then(resolve); + this.analyzeLibraries(siteItem.value, siteItem.text, libs.results, fileExtensions).then(resolve); }); }); }).then(() => { @@ -366,7 +396,7 @@ export class DLP { while (el.firstChild) { el.removeChild(el.firstChild); } // Render the summary - this.renderSummary(el, auditOnly, onClose); + this.renderSummary(el, auditOnly, true, onClose); // Hide the loading dialog LoadingDialog.hide(); diff --git a/src/tabs/lists.ts b/src/tabs/lists.ts index 7542740..b46c9fb 100644 --- a/src/tabs/lists.ts +++ b/src/tabs/lists.ts @@ -230,7 +230,7 @@ export class ListsTab { el.innerHTML = ` Name: ${item.ListName}
- Type: ${item.ListTemplate} + Type: ${item.ListTemplate || ""} `; } }, @@ -548,7 +548,7 @@ export class ListsTab { { name: "SearchAll", type: Components.FormControlTypes.Switch, - label: "Search All Sub-Webs?", + label: "Search All Sub-Sites?", description: "Select this option to search all webs in this site.", value: true, onChange: (item => { diff --git a/src/tabs/reports.ts b/src/tabs/reports.ts index e992622..6a47b79 100644 --- a/src/tabs/reports.ts +++ b/src/tabs/reports.ts @@ -6,6 +6,7 @@ import { ISearchProps } from "./searchProp"; // Report Properties export interface IReportProps { + dlpFileExt?: string; docRententionYears?: string; docSearchFileExt?: string; docSearchKeywords?: string; @@ -138,7 +139,7 @@ export class ReportsTab { // Add the controls switch (selectedReport) { case ReportTypes.DLP: - form.appendControls(Reports.DLP.getFormFields()); + form.appendControls(Reports.DLP.getFormFields(this._reportProps?.dlpFileExt)); break; case ReportTypes.DocRetention: form.appendControls(Reports.DocRetention.getFormFields(this._reportProps.docRententionYears));