From 10491749a3eb2a94386c7263b7186a7d388905b6 Mon Sep 17 00:00:00 2001 From: rschouten97 <69046642+rschouten97@users.noreply.github.com> Date: Wed, 1 Apr 2026 09:52:06 +0200 Subject: [PATCH 1/7] Update checkOnExternalSystemsAd.ps1 --- checkOnExternalSystemsAd.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/checkOnExternalSystemsAd.ps1 b/checkOnExternalSystemsAd.ps1 index 8011eec..0f1baed 100644 --- a/checkOnExternalSystemsAd.ps1 +++ b/checkOnExternalSystemsAd.ps1 @@ -206,7 +206,7 @@ try { Write-Verbose "Queried data from table [$table] for attribute [$($fieldToCheck.Name)] with cross-check. Query: $($querySelect). Returned rows: $selectRowCount" # Check property uniqueness with retention period logic - if (@($querySelectResult).count -gt 0) { + if ($selectRowCount -gt 0) { foreach ($dbRow in $querySelectResult) { # Check if the person is using the value themselves (based on correlation attribute) if ($dbRow.($correlationAttribute.systemFieldName) -eq $a.($correlationAttribute.accountFieldName)) { @@ -267,7 +267,7 @@ try { } } } - elseif (@($querySelectResult).count -eq 0) { + elseif ($selectRowCount -eq 0) { Write-Information "Property [$($fieldToCheck.Name)] with value [$fieldToCheckAccountValue] is unique." } } @@ -299,4 +299,4 @@ finally { } Write-Output ($result | ConvertTo-Json -Depth 10) -} \ No newline at end of file +} From 7712f47ed5e5f418535fc0ac108de6260ddc1dd6 Mon Sep 17 00:00:00 2001 From: rschouten97 <69046642+rschouten97@users.noreply.github.com> Date: Wed, 1 Apr 2026 15:37:24 +0200 Subject: [PATCH 2/7] Update CHANGELOG.md for version 2.0.1: Correct count check in checkOnExternalSystemsAd.ps1 for improved reliability --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9ad724..501ca59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/). +## [2.0.1] - 2026-04-01 + +### Fixed + +- Corrected count check in checkOnExternalSystemsAd.ps1 to use `$selectRowCount` variable instead of `@($querySelectResult).count` for more reliable result counting + ## [2.0.0] - 2026-01-07 This is a major release of HelloID-Conn-Prov-Target-Blacklist-SQL with significant enhancements to match the CSV blacklist connector functionality and Tools4ever V2 connector standards, plus major improvements to code maintainability, configurability, and operational transparency. From dd86b959fe41ab97a1641671ca6864f4c4f5a28f Mon Sep 17 00:00:00 2001 From: rschouten97 <69046642+rschouten97@users.noreply.github.com> Date: Tue, 7 Apr 2026 09:38:14 +0200 Subject: [PATCH 3/7] Enhance correlation attribute validation in checkOnExternalSystemsAd.ps1 for improved error handling and reliability --- checkOnExternalSystemsAd.ps1 | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/checkOnExternalSystemsAd.ps1 b/checkOnExternalSystemsAd.ps1 index 0f1baed..97caf3a 100644 --- a/checkOnExternalSystemsAd.ps1 +++ b/checkOnExternalSystemsAd.ps1 @@ -29,8 +29,14 @@ $nonUniqueFields = [System.Collections.Generic.List[PSCustomObject]]::new() # Identifies and matches persons between the account object (from HelloID) and the blacklist database # Used to determine ownership of values: does a blacklisted value belong to the current person or someone else? # Required for: Self-usage checks, retention period validation, and ownership determination +# +# IMPORTANT: The accountFieldName specified here MUST be mapped in your field mapping configuration +# for ALL operations where this uniqueness check is used (create, update, etc.). +# If this field is not mapped or is empty, the uniqueness check cannot function correctly. +# Common mistake: Mapping the field only for 'create' but using the uniqueness check for both 'create' and 'update'. +# Solution: Ensure the field is mapped for all relevant operations in your HelloID configuration. $correlationAttribute = [PSCustomObject]@{ - accountFieldName = "employeeId" # Property name in the account object received from HelloID + accountFieldName = "employeeId" # Property name in the account object received from HelloID - MUST be mapped in field mapping! systemFieldName = "employeeId" # Corresponding column name in the blacklist database table } @@ -159,6 +165,21 @@ function Invoke-SQLQuery { #endregion functions try { + # Validate that correlation attribute is mapped and has a value + if ([string]::IsNullOrEmpty($correlationAttribute.accountFieldName)) { + throw "Correlation attribute 'accountFieldName' is not configured. This is a mandatory configuration setting." + } + + if (-not ($a.PSObject.Properties.Name -contains $correlationAttribute.accountFieldName)) { + throw "Correlation attribute [$($correlationAttribute.accountFieldName)] is not present in the account object. Please ensure this field is mapped in your HelloID field mapping configuration for all operations (create, update, etc.) where this uniqueness check is used." + } + + if ([string]::IsNullOrEmpty($a.($correlationAttribute.accountFieldName))) { + throw "Correlation attribute [$($correlationAttribute.accountFieldName)] exists in the account object but has no value. Please ensure this field is properly mapped with a valid value in your HelloID field mapping configuration." + } + + Write-Information "Correlation attribute validation successful: [$($correlationAttribute.accountFieldName)] = [$($a.($correlationAttribute.accountFieldName))]" + # Query current data in database foreach ($fieldToCheck in $fieldsToCheck.PsObject.Properties | Where-Object { -not[String]::IsNullOrEmpty($_.Value.accountValue) }) { # Skip if this field is already marked as non-unique @@ -206,7 +227,7 @@ try { Write-Verbose "Queried data from table [$table] for attribute [$($fieldToCheck.Name)] with cross-check. Query: $($querySelect). Returned rows: $selectRowCount" # Check property uniqueness with retention period logic - if ($selectRowCount -gt 0) { + if (@($querySelectResult).count -gt 0) { foreach ($dbRow in $querySelectResult) { # Check if the person is using the value themselves (based on correlation attribute) if ($dbRow.($correlationAttribute.systemFieldName) -eq $a.($correlationAttribute.accountFieldName)) { @@ -267,7 +288,7 @@ try { } } } - elseif ($selectRowCount -eq 0) { + elseif (@($querySelectResult).count -eq 0) { Write-Information "Property [$($fieldToCheck.Name)] with value [$fieldToCheckAccountValue] is unique." } } @@ -299,4 +320,4 @@ finally { } Write-Output ($result | ConvertTo-Json -Depth 10) -} +} \ No newline at end of file From ca1cd5200032e4cf3aaacb8ca2d5008d87e2db77 Mon Sep 17 00:00:00 2001 From: rschouten97 <69046642+rschouten97@users.noreply.github.com> Date: Tue, 7 Apr 2026 09:57:28 +0200 Subject: [PATCH 4/7] Update README.md to include field mapping requirement for correlation attribute in uniqueness checks --- CHANGELOG.md | 4 ++++ README.md | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 501ca59..139a965 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format ## [2.0.1] - 2026-04-01 +### Changed + +- Added IMPORTANT callout in README documenting field mapping requirement for correlation attribute (`accountFieldName`) in `checkOnExternalSystemsAd.ps1` configuration, emphasizing that it must be mapped for ALL operations (create, update, etc.) where the uniqueness check is used + ### Fixed - Corrected count check in checkOnExternalSystemsAd.ps1 to use `$selectRowCount` variable instead of `@($querySelectResult).count` for more reliable result counting diff --git a/README.md b/README.md index 33b024a..a284ab9 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,13 @@ The uniqueness check script includes several configuration options that must be > > The example configuration is tailored for Active Directory. Adjust field names and cross-check logic for other target systems. +> [!IMPORTANT] +> **Field Mapping Requirement**: The `accountFieldName` specified in `$correlationAttribute` (typically `employeeId`) MUST be mapped in your HelloID field mapping configuration for ALL operations where the uniqueness check is used (create, update, etc.). If this field is not mapped or is empty, the uniqueness check cannot function correctly. +> +> **Common mistake**: Mapping the field only for 'create' but using the uniqueness check for both 'create' and 'update'. +> +> **Solution**: Ensure the correlation attribute field is mapped for all relevant operations in your HelloID field mapping configuration. The script will validate that the field exists and has a value before performing any uniqueness checks. + **Correlation Attribute Configuration** ```powershell From 9de15deaf161502218fcbcd40cb3ca17b3606d17 Mon Sep 17 00:00:00 2001 From: rschouten97 <69046642+rschouten97@users.noreply.github.com> Date: Fri, 19 Jun 2026 09:42:14 +0200 Subject: [PATCH 5/7] Update checkOnExternalSystemsAd.ps1 --- checkOnExternalSystemsAd.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/checkOnExternalSystemsAd.ps1 b/checkOnExternalSystemsAd.ps1 index 97caf3a..952e64e 100644 --- a/checkOnExternalSystemsAd.ps1 +++ b/checkOnExternalSystemsAd.ps1 @@ -227,7 +227,7 @@ try { Write-Verbose "Queried data from table [$table] for attribute [$($fieldToCheck.Name)] with cross-check. Query: $($querySelect). Returned rows: $selectRowCount" # Check property uniqueness with retention period logic - if (@($querySelectResult).count -gt 0) { + if ($selectRowCount -gt 0) { foreach ($dbRow in $querySelectResult) { # Check if the person is using the value themselves (based on correlation attribute) if ($dbRow.($correlationAttribute.systemFieldName) -eq $a.($correlationAttribute.accountFieldName)) { @@ -320,4 +320,4 @@ finally { } Write-Output ($result | ConvertTo-Json -Depth 10) -} \ No newline at end of file +} From 61c9b955cb383d07f72df45a049e8cfc319326c9 Mon Sep 17 00:00:00 2001 From: rschouten97 <69046642+rschouten97@users.noreply.github.com> Date: Fri, 19 Jun 2026 09:44:44 +0200 Subject: [PATCH 6/7] Update checkOnExternalSystemsAd.ps1 --- checkOnExternalSystemsAd.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/checkOnExternalSystemsAd.ps1 b/checkOnExternalSystemsAd.ps1 index 952e64e..a9a09f8 100644 --- a/checkOnExternalSystemsAd.ps1 +++ b/checkOnExternalSystemsAd.ps1 @@ -288,7 +288,7 @@ try { } } } - elseif (@($querySelectResult).count -eq 0) { + elseif ($selectRowCount -eq 0) { Write-Information "Property [$($fieldToCheck.Name)] with value [$fieldToCheckAccountValue] is unique." } } From a4cac6c92007b16e1a1a18c9ada24cbfbc60d305 Mon Sep 17 00:00:00 2001 From: rhouthuijzen <116062840+rhouthuijzen@users.noreply.github.com> Date: Fri, 19 Jun 2026 10:43:16 +0200 Subject: [PATCH 7/7] update CHANGELOG.md --- .github/workflows/createRelease.yaml | 84 ++------------------------ .github/workflows/verifyChangelog.yaml | 33 +--------- CHANGELOG.md | 11 ++++ 3 files changed, 19 insertions(+), 109 deletions(-) diff --git a/.github/workflows/createRelease.yaml b/.github/workflows/createRelease.yaml index 9e4ab5d..ca145dd 100644 --- a/.github/workflows/createRelease.yaml +++ b/.github/workflows/createRelease.yaml @@ -1,82 +1,8 @@ -############################## -# Workflow: Create Release -# Version: 0.0.2 -############################## - -name: Create Release - +name: Workflow caller - create release on: - workflow_dispatch: - inputs: - version: - description: 'Version number (e.g., v1.0.0). Leave blank to use the latest version from CHANGELOG.md.' - required: false pull_request: - types: - - closed - -permissions: - contents: write - + types: [closed] jobs: - create-release: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Determine Version - id: determine_version - run: | - if [ -n "${{ github.event.inputs.version }}" ]; then - VERSION="${{ github.event.inputs.version }}" - else - if [ -f CHANGELOG.md ]; then - VERSION=$(grep -oP '^## \[\K[^]]+' CHANGELOG.md | head -n 1) - if [ -z "$VERSION" ]; then - echo "No versions found in CHANGELOG.md." - exit 1 - fi - else - echo "CHANGELOG.md not found. Cannot determine version." - exit 1 - fi - fi - [[ "$VERSION" != v* ]] && VERSION="v$VERSION" - echo "VERSION=$VERSION" >> $GITHUB_ENV - echo "VERSION_NO_V=${VERSION#v}" >> $GITHUB_ENV - - - name: Extract Release Notes from CHANGELOG.md - id: extract_notes - if: ${{ github.event.inputs.version == '' }} - run: | - if [ -f CHANGELOG.md ]; then - awk '/## \['"${VERSION_NO_V}"'\]/{flag=1; next} /## \[/{flag=0} flag' CHANGELOG.md > release_notes.txt - if [ ! -s release_notes.txt ]; then - echo "No release notes found for version ${VERSION_NO_V} in CHANGELOG.md." - exit 1 - fi - else - echo "CHANGELOG.md not found in the repository." - exit 1 - fi - echo "RELEASE_NOTES<> $GITHUB_ENV - cat release_notes.txt >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV - - - name: Default Release Notes - if: ${{ github.event.inputs.version != '' }} - run: | - echo "RELEASE_NOTES=Release notes not provided for version ${VERSION}." >> $GITHUB_ENV - - - name: Debug Release Notes - run: | - echo "Extracted Release Notes:" - echo "${RELEASE_NOTES}" - - - name: Create GitHub Release - run: | - gh release create "${VERSION}" --title "${VERSION}" --notes-file release_notes.txt - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + verify-changelog: + if: github.event.pull_request.merged == true + uses: Tools4everBV/.github/.github/workflows/createRelease.yaml@main diff --git a/.github/workflows/verifyChangelog.yaml b/.github/workflows/verifyChangelog.yaml index 7496fd7..4913991 100644 --- a/.github/workflows/verifyChangelog.yaml +++ b/.github/workflows/verifyChangelog.yaml @@ -1,35 +1,8 @@ -#################################### -# Workflow: Verify CHANGELOG Updated -# Version: 0.0.1 -#################################### - -name: Verify CHANGELOG Updated - +name: Workflow caller - verify changelog updated on: pull_request: types: [opened, synchronize] jobs: - check-changelog: - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Ensure CHANGELOG.md is updated - run: | - # Fetch the base branch to compare against - git fetch origin ${{ github.base_ref }} --depth=1 - - # Compare changes between the current branch and the base branch - CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}) - - # Check if CHANGELOG.md is included in the list of changed files - if echo "$CHANGED_FILES" | grep -q 'CHANGELOG.md'; then - echo "CHANGELOG.md is updated." - else - echo "ERROR: Please update the CHANGELOG.md file with your changes." && exit 1 - fi \ No newline at end of file + verify-changelog: + uses: Tools4everBV/.github/.github/workflows/verifyChangelog.yaml@main diff --git a/CHANGELOG.md b/CHANGELOG.md index 139a965..3de1e5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/). +## [2.0.2] - 2026-04-01 + +### Changed + +- Added explicit correlation attribute validation in `checkOnExternalSystemsAd.ps1` to fail fast when `accountFieldName` is missing, not mapped in the account object, or mapped without a value +- Expanded correlation attribute guidance in `checkOnExternalSystemsAd.ps1` configuration comments and in the README with an IMPORTANT callout that the correlation field must be mapped for all operations where uniqueness checks are enabled (create, update, etc.) + +### Fixed + +- Corrected uniqueness result evaluation in `checkOnExternalSystemsAd.ps1` by using `$selectRowCount` instead of `@($querySelectResult).count`, improving reliability for SQL query result counting + ## [2.0.1] - 2026-04-01 ### Changed