From 048abab9d2cb6a47ad57a3e361bf784ba7360b40 Mon Sep 17 00:00:00 2001 From: Gunjan Datta Date: Wed, 19 Aug 2026 12:58:52 -0400 Subject: [PATCH] Updated to hide limited access items by default. Added a button to show/hide the limited access items. --- package.json | 2 +- src/reports/permissions.ts | 55 +++++++++++++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 53f8df8..4402d4d 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "adm-zip": "^0.5.18", "datatables.net": "^3.0.0", "datatables.net-bs5": "^3.0.0", - "dattatable": "^2.11.81", + "dattatable": "^2.11.83", "exceljs": "^4.4.0", "fast-xml-parser": "^5.9.3", "gd-sprest-bs": "^10.15.91", diff --git a/src/reports/permissions.ts b/src/reports/permissions.ts index cd0de15..af402a9 100644 --- a/src/reports/permissions.ts +++ b/src/reports/permissions.ts @@ -15,6 +15,7 @@ interface IPermissionItem { GroupUsersCount?: number; GroupUrl?: string; Id?: number; + IsLimitedAccess: boolean; LoginName: string; Name: string; Roles?: string[]; @@ -210,6 +211,7 @@ export class Permissions { Everyone: false, GroupIds: [], Id: role.Member.Id, + IsLimitedAccess: false, LoginName: role.Member.LoginName, Name: role.Member.Title, Roles: [], @@ -229,6 +231,7 @@ export class Permissions { Everyone: false, GroupIds: [], Id: role.Member.Id, + IsLimitedAccess: false, LoginName: role.Member.LoginName, Name: role.Member.Title, Roles: [], @@ -249,6 +252,7 @@ export class Permissions { Everyone: role.Member.Title == "Everyone", GroupIds: groupId ? [groupId] : [], Id: role.Member.Id, + IsLimitedAccess: false, LoginName: role.Member.LoginName, Name: role.Member.Title, Roles: [], @@ -266,6 +270,12 @@ export class Permissions { // Add the permission item.Roles.push(roleDef.Name); item.RoleInfo.push(roleDef.Description); + + // See if this only has limited access + if (roleDef.Name == "Limited Access" && item.Roles.length === 1) { + // Set the flag + item.IsLimitedAccess = true; + } }); // Analyze the users for this item @@ -435,6 +445,35 @@ export class Permissions { } }]; + // Show the filter button for permissions + navItems.push({ + text: "Show Limited Access", + className: "btn-outline-light ms-2", + isButton: true, + onClick: () => { + // Get the error button + let elNav = this._elDashboard.querySelector("#navigation .navbar-nav"); + + // Remove the last button + let btn = elNav.querySelector("li:nth-child(2) a"); + + // See if we are currently hiding limited access items + if (btn.textContent == "Show Limited Access") { + // Remove the filter + this._dashboard.filter(3); + + // Update the button text + btn.innerHTML = "Hide Limited Access"; + } else { + // Apply the filter + this._dashboard.filter(3, "false"); + + // Update the button text + btn.innerHTML = "Show Limited Access"; + } + } + }); + // Show the error button navItems.push({ text: "Errors", @@ -466,12 +505,19 @@ export class Permissions { table: { rows: items, onRendering: dtProps => { + // Remove the order/sort option for the action column dtProps.columnDefs.push({ - "targets": 8, + "targets": 9, "orderable": false, "searchable": false }); + // Hide the limited access column + dtProps.columnDefs.push({ + "targets": 3, + "visible": false + }); + // Order by the 1st column dtProps.order = [[0, "asc"]]; @@ -499,6 +545,10 @@ export class Permissions { name: "EEEU", title: "Has
EEEU?" }, + { + name: "IsLimitedAccess", + title: "Is
Limited Access?" + }, { name: "", title: "M365
Groups", @@ -655,6 +705,9 @@ export class Permissions { this._elSubNav.classList.remove("d-none"); this._elSubNav.classList.add("my-2"); this._elSubNav.innerHTML = `
`; + + // Hide the limited access items by default + this._dashboard.filter(3, "false"); } // Runs the report