Skip to content

Conversation

@rschouten97
Copy link
Contributor

Major Enhancement: V2.0.0 - Align SQL Blacklist Connector with CSV Connector and V2 Standards

Summary

This PR brings the SQL blacklist connector to feature parity with the CSV blacklist connector while implementing retention period support, cross-check validation, and adherence to Tools4ever V2 connector standards.

Motivation

The SQL blacklist connector was missing several critical features present in the CSV variant, including retention period logic, cross-attribute validation, and field synchronization. Additionally, the documentation and structure didn't follow the V2 template standards.

Key Changes

🚀 New Features

  • Retention Period Support: Configurable retention period for deleted values with automatic expiration logic, allowing controlled value recycling
  • Cross-Check Validation: crossCheckOn configuration to validate uniqueness across different attribute types (e.g., checking if an email exists as a proxy address)
  • keepInSyncWith Functionality: Automatic cascading of non-unique status across related fields
  • Skip Optimization: Prevents redundant database queries once a field is marked non-unique
  • Enhanced Error Handling: New action types OtherEmployeeId and MultipleFound with detailed error messages

🔧 Core Script Improvements

  • create.ps1: Restructured with retention period logic, moved AccountReference to top, improved action calculation
  • update.ps1: Aligned with create script logic including retention period validation
  • delete.ps1: Rewritten to process per-attribute instead of bulk updates, matching CSV structure
  • checkOnExternalSystemsAd.ps1: Complete rewrite with advanced field configuration and retention awareness

📝 Configuration & Mapping

  • configuration.json: Removed invalid type field from retentionPeriod parameter
  • fieldMapping.json: Updated to match CSV structure (employeeId only for Create, attributes for Create/Update/Delete)
  • createTableBlacklist.sql: Added whenCreated, whenUpdated, whenDeleted columns with datetime2(7) precision

📚 Documentation

  • README.md: Restructured to match V2 template with use cases, supported features table, HelloID Icon URL, field mapping section, account reference explanation, and development resources
  • CHANGELOG.md: Added comprehensive changelog documenting all versions

🐛 Bug Fixes

  • Fixed SQL syntax error in SELECT queries (bracket joining issue)
  • Fixed UPDATE queries to only modify whenDeleted and whenUpdated fields
  • Fixed missing credential initialization in checkOnExternalSystemsAd.ps1
  • Fixed audit logs appearing in dryRun mode

Breaking Changes

⚠️ Configuration: The retentionPeriod parameter is now required in configuration
⚠️ Field Mapping: whenDeleted field removed from fieldMapping.json (managed internally)
⚠️ Script Behavior: Delete action now processes per-attribute; Update action logic changed to match Create

Testing Recommendations

  • Test create/update/delete lifecycle with various retention period values
  • Verify cross-check validation with conflicting proxy addresses
  • Test keepInSyncWith cascading for related fields
  • Confirm skip optimization prevents redundant queries
  • Validate retention period expiration allows value reuse
  • Test with existing database records to ensure migration compatibility

Migration Notes

For existing implementations:

  1. Add retentionPeriod to configuration (recommended: 365 days)
  2. Update createTableBlacklist.sql to add timestamp columns if upgrading from v1.0.0
  3. Remove whenDeleted from field mapping if present
  4. Update checkOnExternalSystemsAd.ps1 configuration structure

@rschouten97 rschouten97 linked an issue Dec 24, 2025 that may be closed by this pull request
@rschouten97
Copy link
Contributor Author

de auditlog is nog niet op orde. review kan wachten.

@rschouten97
Copy link
Contributor Author

ook de logging gaat nu goed en de uniquenessCheck voor AD is ook meteen gecorrigeerd.
Is weer klaar voor test en review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change format of whenDeleted to YYYY-MM-DD HH:MM:SS

2 participants