@cyco77/pptb-user-security-utility 0.7.1 β†’ 0.7.2

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
@@ -1,12 +1,8 @@
1
1
  # User & Team Security Documentation Generator
2
2
 
3
- <p align="center">
4
- <img src="https://raw.githubusercontent.com/cyco77/pptb-user-security-utility/HEAD/icon/user-team-security_small.png" alt="User & Team Security Logo">
5
- </p>
3
+ ![User & Team Security](https://raw.githubusercontent.com/cyco77/pptb-user-security-utility/HEAD/icon/user-team-security_small.png)
6
4
 
7
- <p align="center">
8
- A Power Platform Toolbox (PPTB) tool for viewing and documenting Dynamics 365 user and team security configurations. This tool provides an intuitive interface to explore security roles, team memberships, and export documentation in multiple formats.
9
- </p>
5
+ A Power Platform Toolbox (PPTB) tool for viewing and documenting Dynamics 365 user and team security configurations. This tool provides an intuitive interface to explore security roles, team memberships, and export documentation in multiple formats.
10
6
 
11
7
  ## Screenshots
12
8
 
@@ -53,537 +49,6 @@
53
49
  - πŸ“’ **Visual Notifications** - Toast notifications for successful exports and errors
54
50
  - 🎨 **Theme Support** - Automatic light/dark theme switching based on PPTB settings
55
51
 
56
- ### Technical Stack
57
-
58
- ```
59
- - βœ… user-security-utility/
60
- β”œβ”€β”€ src/
61
- β”‚ β”œβ”€β”€ components/
62
- β”‚ β”‚ β”œβ”€β”€ DataGridView.tsx # Data grid for users/teams with selection
63
- β”‚ β”‚ β”œβ”€β”€ Filter.tsx # Entity type, status, user type, and business unit filtering
64
- β”‚ β”‚ β”œβ”€β”€ Overview.tsx # Main container component with export functionality
65
- β”‚ β”‚ └── SecurityRolesPanel.tsx # Side panel displaying roles and team memberships
66
- β”‚ β”œβ”€β”€ hooks/
67
- β”‚ β”‚ β”œβ”€β”€ useConnection.ts # Dataverse connection management
68
- β”‚ β”‚ β”œβ”€β”€ useToolboxAPI.ts # Toolbox API hook
69
- β”‚ β”‚ └── useToolboxEvents.ts # PPTB event subscription
70
- β”‚ β”œβ”€β”€ services/
71
- β”‚ β”‚ β”œβ”€β”€ dataverseService.ts # Dataverse API queries for users, teams, and roles
72
- β”‚ β”‚ └── loggerService.ts # Centralized logging singleton
73
- β”‚ β”œβ”€β”€ types/
74
- β”‚ β”‚ β”œβ”€β”€ systemUser.ts # System user type definitions
75
- β”‚ β”‚ β”œβ”€β”€ team.ts # Team type definitions
76
- β”‚ β”‚ β”œβ”€β”€ securityRole.ts # Security role type definitions
77
- β”‚ β”‚ └── queue.ts # Queue type definitions
78
- β”‚ β”œβ”€β”€ App.tsx # Main application component
79
- β”‚ β”œβ”€β”€ main.tsx # Entry point
80
- β”‚ └── index.css # Global styling
81
- β”œβ”€β”€ icon/ # Application icons
82
- β”œβ”€β”€ screenshots/ # Screenshots for documentationep data to models
83
- β”œβ”€β”€ index.html
84
- β”œβ”€β”€ package.json
85
- β”œβ”€β”€ tsconfig.json
86
- └── vite.config.ts
87
-
88
- ```
89
-
90
- ## Installation
91
-
92
- ### Prerequisites
93
-
94
- - Node.js >= 18.0.0
95
- - npm oruser-security-utility
96
- - Power Platform Toolbox installed
97
-
98
- ### Setup
99
-
100
- 1. Clone the repository:
101
-
102
- ```bash
103
- git clone <repository-url>
104
- cd pptb-plugin-documentation-generator
105
- ```
106
-
107
- 2. Install dependencies:
108
-
109
- ```bash
110
- npm install
111
- ```
112
-
113
- ## Development
114
-
115
- ### Development Server
116
-
117
- Start development server with HMR:
118
-
119
- ```bash
120
- npm run dev
121
- ```
122
-
123
- The tool will be available at `http://localhost:5173`
124
-
125
- ### Watch Mode
126
-
127
- Build the tool in watch mode for continuous updates:
128
-
129
- ```bash
130
- npm run watch
131
- ```
132
-
133
- ### Production Build
134
-
135
- Build the optimized production version:
136
-
137
- ```bash
138
- npm run build
139
- ```
140
-
141
- The output will be in the `dist/` directory.
142
-
143
- ### Preview Build
144
-
145
- Preview the production build locally:
146
-
147
- ```bash
148
- npm run preview
149
- ```
150
-
151
- ## Usage
152
-
153
- ### In Power Platform Toolbox
154
-
155
- 1. Build the tool:
156
-
157
- ```bash
158
- npm run build
159
- ```
160
-
161
- 2. Package the tool (creates npm-shrinkwrap.json):
162
- tool to view users and teams
163
-
164
- ### User Interface
165
-
166
- #### Filter Section
167
-
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
173
-
174
- #### Export Buttons (Users only)
175
-
176
- - **Export to CSV**: Downloads a matrix-style CSV where:
177
- - Rows represent users
178
- - Columns represent security roles, team memberships, and queue memberships
179
- - 'X' marks indicate assignments
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
183
- - **Copy as Markdown**: Copies detailed report to clipboard with:
184
- - Hierarchical structure per user
185
- - Security roles with managed status and business unit
186
- - Team memberships with type and default indicators
187
- - Queue memberships with queue type information
188
-
189
- #### Data Grid
190
-
191
- - Click any row to select and view details
192
- - Selected row is highlighted
193
- - Click column headers to sort (default: sorted by name)
194
- - Drag column borders to resize
195
- - Hover over cells for full text tooltips
196
- - Supports both System Users and Teams views
197
- - Column sizing is reset when switching between entity types
198
-
199
- #### Security Details Panel
200
-
201
- Appears on the right when a user or team is selected:
202
-
203
- - **Header**: Shows user/team name
204
- - **Security Roles Section**: Lists all directly assigned security roles with:
205
- - Role name
206
- - "Managed" badge for managed roles
207
- - Business unit information
208
- - **Team Memberships Section** (Users only): Lists all team memberships with:
209
- - Team name
210
- - Team type (Owner/Access)
211
- - "Default" badge for default teams
212
- - Business unit information
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
223
-
224
- #### Evensystem users
225
-
226
- const users = await window.dataverseAPI.queryData(
227
- "systemusers?$select=systemuserid,fullname,domainname,isdisabled,applicationid&$expand=businessunitid($select=businessunitid,name)&$orderby=fullname"
228
- );
229
-
230
- // Query teams
231
- const teams = await window.dataverseAPI.queryData(
232
- "teams?$select=teamid,name,teamtype,isdefault&$expand=businessunitid($select=businessunitid,name)&$orderby=name"
233
- );
234
-
235
- // Query security roles for a user
236
- const roles = await window.dataverseAPI.queryData(
237
- `systemusers(${userId})/systemuserroles_association?$select=roleid,name,ismanaged&$expand=businessunitid($select=businessunitid,name)`
238
- );
239
-
240
- // Query teams for a user
241
- const userTeams = await window.dataverseAPI.queryData(
242
- `systemusers(${userId})/teammembership_association?$select=teamid,name,teamtype,isdefault&$expand=businessunitid($select=businessunitid,name)
243
- The tool demonstrates various Power Platform Toolbox and Dataverse API features:
244
-
245
- ### Connection Management
246
-
247
- ```typescript
248
- // Get current connection
249
- const connection = await window.toolboxAPI.getConnection();
250
- console.log(connection.connectionUrl);
251
-
252
- // Listen for connection changes
253
- window.toUser security data has been exported to CSV successfully."ata with new connection
254
- }
255
- });
256
- ```
257
-
258
- ### Dataverse Queries
259
-
260
- ```typescript
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"
264
- );
265
-
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`
289
- );
290
- ```
291
-
292
- ### Notifications
293
-
294
- ```typescript
295
- // Success notification
296
- await window.toolboxAPI.utils.showNotification({
297
- title: "Export Successful",
298
- body: "User security data has been exported to CSV successfully.",
299
- type: "success",
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",
307
- });
308
- ```
309
-
310
- ### File Operations
311
-
312
- ```typescript
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
- );
319
-
320
- // Copy to clipboard
321
- await window.toolboxAPI.utils.copyToClipboard(markdownContent);
322
- ```
323
-
324
- ### Theme Management
325
-
326
- ```typescript
327
- // Get current theme
328
- const theme = await window.toolboxAPI.utils.getCurrentTheme();
329
- // Returns 'light' or 'dark'
330
-
331
- // Listen for theme changes
332
- window.toolboxAPI.onToolboxEvent((event) => {
333
- if (event === "settings:updated") {
334
- updateThemeBasedOnSettings();
335
- }
336
- });
337
- ```
338
-
339
- ### EveToolboxAPI\*\*: Provides access to Toolbox API utilities
340
-
341
- ### Services
342
-
343
- - **loggerService**: Singleton service for centralized logging
344
-
345
- - Methods: `info()`, `success()`, `warning()`, `error()`
346
- - Eliminates prop drilling for logging across components
347
-
348
- - **dataverseService**: Handles all Dataverse API queries
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`
352
- - Maps raw API responses to typed models
353
-
354
- ### Components
355
-
356
- - **Overview**: Main container with state management for filtering, selection, and export
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
372
-
373
- ### Export Features
374
-
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`)
378
- - Marks assignments with 'X'
379
- - Includes user metadata (name, domain, business unit, status)
380
- - Progress indicator during export
381
- - **Markdown Export**: Generates hierarchical documentation
382
- - Section per user with full details
383
- - Nested lists for security roles, team memberships, and queue memberships
384
- - Includes metadata like managed status, team types, queue types
385
- - Copies to clipboard with success notification
386
-
387
- ## Architecture
388
-
389
- ### Custom Hooks
390
-
391
- - **useConnection**: Manages Dataverse connection state and refresh logic
392
- - **useToolboxEvents**: Subscribes to PPTB events and handles callbacks
393
- - **useToolboxAPI**: Provides access to Toolbox API utilities
394
-
395
- ## Data Models
396
-
397
- ### SystemUser
398
-
399
- ```typescript
400
- {
401
- systemuserid: string;
402
- fullname: string;
403
- domainname: string;
404
- businessunitid?: {
405
- businessunitid: string;
406
- name: string;
407
- };
408
- isdisabled: boolean;
409
- applicationid: string | null; // Populated for application users
410
- }
411
- ```
412
-
413
- ### Team
414
-
415
- ```typescript
416
- {
417
- teamid: string;
418
- name: string;
419
- teamtype: number; // 0 = Owner, 1 = Access
420
- businessunitid?: {
421
- businessunitid: string;
422
- name: string;
423
- };
424
- isdefault: boolean;
425
- }
426
- ```
427
-
428
- ### SecurityRole
429
-
430
- ```typescript
431
- {
432
- roleid: string;
433
- name: string;
434
- businessunitid?: {
435
- businessunitid: string;
436
- name: string;
437
- };
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
- ```
451
-
452
- Full TypeScript coverage with:
453
-
454
- - Interface definitions for all data models
455
- - Type-safe API responses
456
- - Strongly typed component props
457
- - PPTB API types from `@pptb/types` package
458
-
459
- ## Configuration
460
-
461
- ### Vite Build Configuration
462
-
463
- The tool uses a custom Vite configuration for PPTB compatibility:
464
-
465
- - **IIFE format**: Bundles as Immediately Invoked Function Expression for iframe compatibility
466
- - **Single bundle**: Uses `inlineDynamicImports` to avoid module loading issues with file:// URLs
467
- - **HTML transformation**: Custom plugin removes `type="module"` and moves scripts to end of body
468
- - **Chunk size limit**: Set to 1000 kB to accommodate Fluent UI bundle size
469
-
470
- ## Data Models
471
-
472
- ### PluginAssembly
473
-
474
- ```typescript
475
- {
476
- pluginassemblyid: string;
477
- name: string;
478
- version: string;
479
- }
480
- ```
481
-
482
- ### PluginAssemblyStep
483
-
484
- ```typescript
485
- {
486
- id: string;
487
- name: string;
488
- sdkMessage: string;
489
- mode: string; // Sync/Async
490
- stage: string; // PreValidation/PreOperation/PostOperation
491
- rank: number; // Execution order
492
- eventHandler: string; // Full type name
493
- filteringattributes: string;
494
- }
495
- ```
496
-
497
- ## Troubleshooting
498
-
499
- ### Build Issues
500
-
501
- If you encounter chunk size warnings:
502
-
503
- - The tool uses IIFE format which requires a single bundle
504
- - Chunk size limit is configured in `vite.config.ts`
505
- - This is expected for Fluent UI components
506
-
507
- ### Connection Issues
508
-
509
- - Ensure you're connected to a Dataverse environment in PPTB
510
- - Check the Event Log for connection-related errors
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
520
-
521
- ### Theme Not Updating
522
-
523
- - The tool automatically syncs with PPTB theme settings
524
- - Check console for theme update events
525
- - Verify PPTB version supports theme API
526
-
527
- ## Contributing
528
-
529
- Contributions are welcome! Please:
530
-
531
- 1. Fork the repository
532
- 2. Create a feature branch
533
- 3. Make your changes with appropriate TypeScript types
534
- 4. Test the build process
535
- 5. Submit a pull request
536
-
537
- ### GitHub Actions
538
-
539
- The project includes automated CI/CD workflows:
540
-
541
- #### CI Workflow (`.github/workflows/ci.yml`)
542
-
543
- Runs on every push and pull request to `main` and `develop` branches:
544
-
545
- - **Build and Test**:
546
-
547
- - Tests on Node.js 18.x and 20.x
548
- - TypeScript type checking
549
- - Build verification
550
- - Uploads build artifacts
551
-
552
- - **Lint Check**:
553
-
554
- - Runs ESLint if configured
555
- - Validates code quality
556
-
557
- - **Security Audit**:
558
-
559
- - Checks for npm package vulnerabilities
560
- - Fails on critical vulnerabilities
561
- - Warns on high-severity issues
562
-
563
- - **Package Validation**:
564
- - Validates package.json structure
565
- - Creates npm-shrinkwrap.json
566
- - Verifies all required fields
567
-
568
- #### Release Workflow (`.github/workflows/release.yml`)
569
-
570
- Triggered when pushing a version tag (e.g., `v1.0.0`):
571
-
572
- - Builds the project
573
- - Creates distribution packages (tar.gz and zip)
574
- - Creates GitHub release with auto-generated notes
575
- - Attaches build artifacts to release
576
-
577
- **To create a release:**
578
-
579
- ```bash
580
- # Update version in package.json
581
- npm version patch # or minor, major
582
-
583
- # Push with tags
584
- git push origin main --tags
585
- ```
586
-
587
52
  ## License
588
53
 
589
54
  MIT - See LICENSE file for details
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@cyco77/pptb-user-security-utility",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@cyco77/pptb-user-security-utility",
9
- "version": "0.7.1",
9
+ "version": "0.7.2",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@fluentui/react-components": "^9.72.7",
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@cyco77/pptb-user-security-utility",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "displayName": "User & Team Security Documentation Generator",
5
5
  "description": "A Power Platform Toolbox tool to show user & team security easily.",
6
6
  "main": "index.html",
7
+ "icon": "icon/user-team-security.svg",
7
8
  "author": "Lars Hildebrandt",
8
9
  "contributors": [
9
10
  {