From 728ecb4b6c31a19f84a315d5e55036ff32a77a2a Mon Sep 17 00:00:00 2001 From: Brady Wetherington Date: Tue, 11 Aug 2026 16:32:19 +0100 Subject: [PATCH] Change Address parsing to better handle Okta's SCIM --- app/Models/SnipeSCIMConfig.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/app/Models/SnipeSCIMConfig.php b/app/Models/SnipeSCIMConfig.php index bb90d2c481..c1c8800c23 100644 --- a/app/Models/SnipeSCIMConfig.php +++ b/app/Models/SnipeSCIMConfig.php @@ -707,6 +707,30 @@ class SnipeSCIMConfig } throw new SCIMException("Could not handle path for update $path", 422); + } else { + // Okta hits this one for creating a user - it does a full PUT for their ID + \Log::debug("GetValuePAthFilter is null for path: $path"); + \Log::debug("GetValuePathFilter is now null and trying to set value of: " . print_r($value, true)); + // the Addresses object is a 'list' (array with numeric indices) by definition... + if (is_array($value) && array_is_list($value)) { + foreach ($value as $address) { + // we just need to check if this is a 'work' address, we don't really care about "primary => true" + if (@$address['type'] == 'work') { + foreach ($address as $key => $v) { + if (array_key_exists($key, self::$addressmap)) { + \Log::debug("Addresses: Setting " . self::$addressmap[$key] . " to '$v'"); + $object->{self::$addressmap[$key]} = $v; + } + } + } else { + //should we throw if you give us a 'home' address? I don't know. + // what if you gave us _both_ ? + } + } + } else { + \Log::debug("Unknown Address Object: " . print_r($value, true)); + throw new SCIMException("Unknown Address object of type: " . gettype($value), 422); + } } } })->withSubAttributes(