Conversation
… LDAP field function Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
…d for custom LDAP attrs Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
…rom contract; remove docs table Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
…not from contract entry Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes null value handling and expands AD attribute contract to support the full Set-ADUser parameter set for EnsureAttributes operations. The changes address issue #202 which reported that EnsureAttributes with Provider.AD did not allow unsetting attributes.
Changes:
- Created
Get-IdleADAttributeLDAPField.ps1for LDAP field name mapping, separating concerns between contract definition and LDAP schema names - Expanded
Get-IdleADAttributeContract.ps1to include all Set-ADUser parameters for EnsureAttributes (30+ new attributes) and added OtherAttributes container support - Fixed null value preservation in
Invoke-IdleStepEnsureAttributes.ps1using typed object arrays to prevent PowerShell from dropping null values - Enhanced
New-IdleADIdentityProvider.ps1EnsureAttribute method with proper null comparison logic and OtherAttributes container handling - Updated
New-IdleADAdapter.ps1SetUser to use contract-driven parameter detection and LDAP field names for -Clear operations; changed GetUserBy* methods to Properties='*' for full attribute retrieval - Updated tests and documentation to reflect new functionality
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/IdLE.Provider.AD/Private/Get-IdleADAttributeLDAPField.ps1 | New function mapping friendly attribute names to LDAP schema field names with RFC/MS-ADSC citations |
| src/IdLE.Provider.AD/Private/Get-IdleADAttributeContract.ps1 | Expanded EnsureAttributes contract to include 30+ Set-ADUser parameters; added OtherAttributes container support |
| src/IdLE.Provider.AD/Private/Test-IdleADAttributeContract.ps1 | Updated operation parameter to EnsureAttributes; added OtherAttributes validation; improved error messages |
| src/IdLE.Provider.AD/Private/New-IdleADAdapter.ps1 | SetUser now uses contract-driven logic to distinguish named parameters from custom LDAP attributes; GetUserBy* methods retrieve all properties |
| src/IdLE.Provider.AD/Public/New-IdleADIdentityProvider.ps1 | EnsureAttribute method handles OtherAttributes container and implements proper null-aware comparison logic |
| src/IdLE.Steps.Common/Public/Invoke-IdleStepEnsureAttributes.ps1 | Fixed null value preservation using typed object arrays for method arguments |
| tests/Providers/ADIdentityProvider.Tests.ps1 | Updated mock SetUser signature; expanded supported attributes list; added tests for null handling and OtherAttributes |
| docs/reference/providers/provider-ad.md | Added attribute handling section documenting OtherAttributes usage and null clearing for both CreateIdentity and EnsureAttributes |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8652d30791
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ssion test Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Get-IdleADAttributeLDAPField.ps1- new function mapping friendly attribute names to verified LDAP field namesGet-IdleADAttributeContract.ps1- entries define Target/Type/Required only; LDAP field enrichment loop removed; docs updatedNew-IdleADAdapter.ps1-SetUserusesGet-IdleADAttributeContractto detect named parameters, then callsGet-IdleADAttributeLDAPFielddirectly; custom LDAP attrs use-Clear/-ReplaceTest-IdleADAttributeContract.ps1- rename operation; allowOtherAttributes; update error messagesNew-IdleADIdentityProvider.ps1-EnsureAttribute: handlesOtherAttributes; throws when OtherAttributes value is not a hashtable (matches CreateIdentity strictness); fixes null comparison; passes$CurrentValueInvoke-IdleStepEnsureAttributes.ps1- fix null value preservationADIdentityProvider.Tests.ps1- tests for null clearing, new attributes, OtherAttributes; type-validation test for non-hashtable OtherAttributes in EnsureAttributeprovider-ad.md- OtherAttributes guidance; attribute table removedOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.