@cyco77/pptb-user-security-utility 0.2.0 β†’ 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,28 +22,35 @@
22
22
 
23
23
  ### Core Capabilities
24
24
 
25
- - οΏ½ **User & Team Browser** - View all system users and teams in your Dynamics 365 environment
25
+ - πŸ‘₯ **User & Team Browser** - View all system users and teams in your Dynamics 365 environment
26
26
  - πŸ” **Security Role Details** - Display directly assigned security roles for users and teams
27
27
  - πŸ‘” **Team Membership** - View all team memberships for system users
28
+ - πŸ‘₯ **Team Members** - View all system users assigned to a selected team
29
+ - πŸ“¬ **Queue Memberships** - View all queue assignments for system users
28
30
  - πŸ” **Advanced Filtering**:
29
31
  - Filter by entity type (System Users / Teams)
30
32
  - Filter users by status (All / Enabled / Disabled)
31
33
  - Filter users by type (All / Users / Applications) - defaults to regular users
32
34
  - Filter by business unit
33
35
  - Real-time text search across names and domains
36
+ - Filter team members in the details panel
34
37
  - πŸ“Š **Interactive Data Grid**:
35
38
  - Single-row selection to view details
36
39
  - Sortable columns with default sorting by name
37
- - Resizable columns
40
+ - Resizable columns for both users and teams
41
+ - Tooltips on hover for full text content
38
42
  - πŸ“± **Detail Side Panel** - Displays selected user/team with:
39
- - All directly assigned security roles
40
- - Team memberships (for users)
43
+ - All directly assigned security roles with managed status indicators
44
+ - Team memberships (for users) with team type and default team badges
45
+ - Team members (for teams) with searchable/filterable list
46
+ - Queue memberships (for users) with queue type information
41
47
  - Business unit information
42
- - Managed role indicators
43
48
  - πŸ“€ **Multiple Export Formats**:
44
- - **CSV Matrix Export** - Roles and teams as columns, users as rows, 'X' marks assignments
45
- - **Markdown Export** - Copy formatted documentation to clipboard
46
- - πŸ“’ **Visual Notifications** - Toast notifications for successful exports
49
+ - **CSV Matrix Export** - Roles, teams, and queues as columns, users as rows, 'X' marks assignments
50
+ - **Markdown Export** - Copy formatted documentation to clipboard with full details
51
+ - UTF-8 encoding with BOM for proper character support (German umlauts, etc.)
52
+ - Windows-style line endings for better Excel compatibility
53
+ - πŸ“’ **Visual Notifications** - Toast notifications for successful exports and errors
47
54
  - 🎨 **Theme Support** - Automatic light/dark theme switching based on PPTB settings
48
55
 
49
56
  ### Technical Stack
@@ -66,7 +73,8 @@
66
73
  β”‚ β”œβ”€β”€ types/
67
74
  β”‚ β”‚ β”œβ”€β”€ systemUser.ts # System user type definitions
68
75
  β”‚ β”‚ β”œβ”€β”€ team.ts # Team type definitions
69
- β”‚ β”‚ └── securityRole.ts # Security role type definitions
76
+ β”‚ β”‚ β”œβ”€β”€ securityRole.ts # Security role type definitions
77
+ β”‚ β”‚ └── queue.ts # Queue type definitions
70
78
  β”‚ β”œβ”€β”€ App.tsx # Main application component
71
79
  β”‚ β”œβ”€β”€ main.tsx # Entry point
72
80
  β”‚ └── index.css # Global styling
@@ -157,30 +165,36 @@ npm run preview
157
165
 
158
166
  #### Filter Section
159
167
 
160
- - **Entity Type Dropdown**: Switch between System Users and Teams
161
- - **Status Filter** (Users only): All / Enabled / Disabled
162
- - **User Type Filter** (Users only): All / Users / Applications (defaults to Users)
163
- - **Business Unit Dropdown**: Filter by business unit
164
- - **Search Box**: Real-time search across user/team names, domain names, and business units
168
+ - **Entity Type Dropdown** (150px width): Switch between System Users and Teams
169
+ - **Status Filter** (150px width, Users only): All / Enabled / Disabled
170
+ - **User Type Filter** (150px width, Users only): All / Users / Applications (defaults to Users)
171
+ - **Business Unit Dropdown** (200px width): Filter by business unit
172
+ - **Search Box** (350px width): Real-time search across user/team names, domain names, and business units
165
173
 
166
174
  #### Export Buttons (Users only)
167
175
 
168
176
  - **Export to CSV**: Downloads a matrix-style CSV where:
169
177
  - Rows represent users
170
- - Columns represent security roles and team memberships
178
+ - Columns represent security roles, team memberships, and queue memberships
171
179
  - 'X' marks indicate assignments
172
180
  - Includes user details (name, domain, business unit, status)
181
+ - UTF-8 BOM encoding for proper character support
182
+ - Comma-delimited with Windows line endings
173
183
  - **Copy as Markdown**: Copies detailed report to clipboard with:
174
184
  - Hierarchical structure per user
175
185
  - Security roles with managed status and business unit
176
186
  - Team memberships with type and default indicators
187
+ - Queue memberships with queue type information
177
188
 
178
189
  #### Data Grid
179
190
 
180
191
  - Click any row to select and view details
181
192
  - Selected row is highlighted
182
193
  - Click column headers to sort (default: sorted by name)
194
+ - Drag column borders to resize
195
+ - Hover over cells for full text tooltips
183
196
  - Supports both System Users and Teams views
197
+ - Column sizing is reset when switching between entity types
184
198
 
185
199
  #### Security Details Panel
186
200
 
@@ -196,9 +210,16 @@ Appears on the right when a user or team is selected:
196
210
  - Team type (Owner/Access)
197
211
  - "Default" badge for default teams
198
212
  - Business unit information
199
- - Click column headers to sort
200
- - Drag column borders to resize
201
- - View tooltips on hover for full text content
213
+ - **Queue Memberships Section** (Users only): Lists all queue assignments with:
214
+ - Queue name
215
+ - Queue type (Private/Public/Unknown)
216
+ - **Team Members Section** (Teams only): Lists all users assigned to the team with:
217
+ - Searchable filter box
218
+ - User full name
219
+ - Domain name
220
+ - Business unit information
221
+ - "Disabled" badge for disabled users
222
+ - Alphabetically sorted by full name
202
223
 
203
224
  #### Evensystem users
204
225
 
@@ -237,39 +258,67 @@ window.toUser security data has been exported to CSV successfully."ata with new
237
258
  ### Dataverse Queries
238
259
 
239
260
  ```typescript
240
- // Query plugin assemblies
241
- const assemblies = await window.dataverseAPI.executeQuery(
242
- `pluginassemblies?$select=name,versio
243
- "user-security-export-2025-12-23.csv",
244
- csvContent
261
+ // Query system users
262
+ const users = await window.dataverseAPI.queryData(
263
+ "systemusers?$select=systemuserid,fullname,domainname,isdisabled,applicationid&$expand=businessunitid($select=businessunitid,name)&$orderby=fullname"
245
264
  );
246
265
 
247
- // Copy to clipboard
248
- await window.toolboxAPI.utils.copyToClipboard(markdownC
249
- const steps = await window.dataverseAPI.executeQuery(
250
- `sdkmessageprocessingsteps?$select=...&$filter=...&$expand=...`
266
+ // Query teams
267
+ const teams = await window.dataverseAPI.queryData(
268
+ "teams?$select=teamid,name,teamtype,isdefault&$expand=businessunitid($select=businessunitid,name)&$orderby=name"
269
+ );
270
+
271
+ // Query security roles for a user
272
+ const roles = await window.dataverseAPI.queryData(
273
+ `systemusers(${userId})/systemuserroles_association?$select=roleid,name,ismanaged&$expand=businessunitid($select=businessunitid,name)`
274
+ );
275
+
276
+ // Query teams for a user
277
+ const userTeams = await window.dataverseAPI.queryData(
278
+ `systemusers(${userId})/teammembership_association?$select=teamid,name,teamtype,isdefault&$expand=businessunitid($select=businessunitid,name)`
279
+ );
280
+
281
+ // Query team members
282
+ const teamMembers = await window.dataverseAPI.queryData(
283
+ `teams(${teamId})/teammembership_association?$select=systemuserid,fullname,domainname,isdisabled,applicationid&$expand=businessunitid($select=businessunitid,name)`
284
+ );
285
+
286
+ // Query queues for a user
287
+ const queues = await window.dataverseAPI.queryData(
288
+ `systemusers(${userId})/queuemembership_association?$select=queueid,name,queuetypecode&$orderby=name`
251
289
  );
252
290
  ```
253
291
 
254
292
  ### Notifications
255
293
 
256
294
  ```typescript
295
+ // Success notification
257
296
  await window.toolboxAPI.utils.showNotification({
258
297
  title: "Export Successful",
259
- body: "Exported 15 plugin assembly steps",
298
+ body: "User security data has been exported to CSV successfully.",
260
299
  type: "success",
261
- duration: 3000,
300
+ });
301
+
302
+ // Error notification
303
+ await window.toolboxAPI.utils.showNotification({
304
+ title: "Error Loading Data",
305
+ body: `Failed to load data from Dataverse: ${error.message}`,
306
+ type: "error",
262
307
  });
263
308
  ```
264
309
 
265
310
  ### File Operations
266
311
 
267
312
  ```typescript
268
- // Save file
269
- await window.toolboxAPI.utils.saveFile("plugin_steps.csv", csvContent);
313
+ // Save file with UTF-8 BOM encoding
314
+ const csvContent = "\uFEFF" + csvLines.join("\r\n");
315
+ await window.toolboxAPI.utils.saveFile(
316
+ "user-security-export-2025-12-25.csv",
317
+ csvContent
318
+ );
270
319
 
271
320
  // Copy to clipboard
272
- await window.toolboxAPI.utils.copyToClipboard(content);
321
+ await window.toolboxAPI.utils.copyToClipboard(markdownContent);
273
322
  ```
274
323
 
275
324
  ### Theme Management
@@ -297,28 +346,42 @@ window.toolboxAPI.onToolboxEvent((event) => {
297
346
  - Eliminates prop drilling for logging across components
298
347
 
299
348
  - **dataverseService**: Handles all Dataverse API queries
300
- - Queries system users, teams, security roles, and team memberships
301
- - Implements paging for large data sets
349
+ - Queries system users, teams, security roles, team memberships, and queues
350
+ - Functions: `loadSystemUsers()`, `loadTeams()`, `loadSecurityRolesForUser()`, `loadSecurityRolesForTeam()`, `loadTeamsForUser()`, `loadUsersForTeam()`, `loadQueuesForUser()`
351
+ - Implements automatic paging for large data sets using `@odata.nextLink`
302
352
  - Maps raw API responses to typed models
303
353
 
304
354
  ### Components
305
355
 
306
356
  - **Overview**: Main container with state management for filtering, selection, and export
307
- - **Filter**: Provides all filtering controls (entity type, status, user type, business unit, search)
308
- - **DataGridView**: Sortable, selectable data grid using Fluent UI DataGrid with single-row selection
309
- - **SecurityRolesPanel**: Side panel displaying security roles and team memberships
357
+ - Manages loading states for roles, teams, queues, and team members
358
+ - Implements error notifications for failed API calls
359
+ - Handles CSV and Markdown export logic
360
+ - **Filter**: Provides all filtering controls with optimized dropdown widths
361
+ - Entity type (150px), status (150px), user type (150px)
362
+ - Business unit (200px), search box (350px)
363
+ - **DataGridView**: Sortable, resizable data grid using Fluent UI DataGrid
364
+ - Separate grids for users and teams with unique keys to reset column sizing
365
+ - Single-row selection mode
366
+ - Cell tooltips for full text display
367
+ - **SecurityRolesPanel**: Side panel displaying comprehensive details
368
+ - Security roles with managed badges
369
+ - Team memberships with type and default badges
370
+ - Queue memberships with type information
371
+ - Team members with searchable filter and sorted display
310
372
 
311
373
  ### Export Features
312
374
 
313
- - **CSV Export**: Creates a matrix format with users as rows and roles/teams as columns
314
- - Collects all unique roles and teams across filtered users
375
+ - **CSV Export**: Creates a matrix format with UTF-8 BOM encoding
376
+ - Collects all unique roles, teams, and queues across filtered users
377
+ - Uses comma delimiter with Windows line endings (`\r\n`)
315
378
  - Marks assignments with 'X'
316
379
  - Includes user metadata (name, domain, business unit, status)
317
380
  - Progress indicator during export
318
381
  - **Markdown Export**: Generates hierarchical documentation
319
382
  - Section per user with full details
320
- - Nested lists for security roles and team memberships
321
- - Includes metadata like managed status, team types, default indicators
383
+ - Nested lists for security roles, team memberships, and queue memberships
384
+ - Includes metadata like managed status, team types, queue types
322
385
  - Copies to clipboard with success notification
323
386
 
324
387
  ## Architecture
@@ -327,7 +390,11 @@ window.toolboxAPI.onToolboxEvent((event) => {
327
390
 
328
391
  - **useConnection**: Manages Dataverse connection state and refresh logic
329
392
  - **useToolboxEvents**: Subscribes to PPTB events and handles callbacks
330
- - \*\*SystemUser
393
+ - **useToolboxAPI**: Provides access to Toolbox API utilities
394
+
395
+ ## Data Models
396
+
397
+ ### SystemUser
331
398
 
332
399
  ```typescript
333
400
  {
@@ -360,15 +427,27 @@ window.toolboxAPI.onToolboxEvent((event) => {
360
427
 
361
428
  ### SecurityRole
362
429
 
363
- ````typescript
430
+ ```typescript
364
431
  {
365
432
  roleid: string;
366
433
  name: string;
367
434
  businessunitid?: {
368
- Verify permissions to read system user, team, and security role data
369
- - Check console logs for API errors
435
+ businessunitid: string;
436
+ name: string;
370
437
  };
371
- ismanaged: boolean
438
+ ismanaged: boolean;
439
+ }
440
+ ```
441
+
442
+ ### Queue
443
+
444
+ ```typescript
445
+ {
446
+ queueid: string;
447
+ name: string;
448
+ queuetypecode?: number; // 1 = Private, 2 = Public
449
+ }
450
+ ```
372
451
 
373
452
  Full TypeScript coverage with:
374
453
 
@@ -398,7 +477,7 @@ The tool uses a custom Vite configuration for PPTB compatibility:
398
477
  name: string;
399
478
  version: string;
400
479
  }
401
- ````
480
+ ```
402
481
 
403
482
  ### PluginAssemblyStep
404
483
 
@@ -429,7 +508,15 @@ If you encounter chunk size warnings:
429
508
 
430
509
  - Ensure you're connected to a Dataverse environment in PPTB
431
510
  - Check the Event Log for connection-related errors
432
- - Verify permissions to read plugin assembly data
511
+ - Verify permissions to read system user, team, security role, and queue data
512
+ - Error notifications will appear automatically when API calls fail
513
+
514
+ ### CSV Encoding Issues
515
+
516
+ - The tool uses UTF-8 BOM encoding for proper character support
517
+ - German umlauts (ΓΆ, Γ€, ΓΌ) and special characters should display correctly
518
+ - Uses comma delimiter with Windows line endings for Excel compatibility
519
+ - If issues persist, try opening the CSV in a text editor first to verify encoding
433
520
 
434
521
  ### Theme Not Updating
435
522