From 7b12d511f8c6c981b51e4c810bf28c36be2c24dc Mon Sep 17 00:00:00 2001 From: Brady Wetherington Date: Thu, 23 Nov 2023 16:34:03 +0000 Subject: [PATCH] Force active flag to be returned as true or false --- app/Models/SnipeSCIMConfig.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/Models/SnipeSCIMConfig.php b/app/Models/SnipeSCIMConfig.php index 7ec25645e6..f17b5cfb61 100644 --- a/app/Models/SnipeSCIMConfig.php +++ b/app/Models/SnipeSCIMConfig.php @@ -129,8 +129,20 @@ class SnipeSCIMConfig extends \ArieTimmerman\Laravel\SCIMServer\SCIMConfig 'preferredLanguage' => AttributeMapping::eloquent('locale'), // Section 5.3.5 of [RFC7231] 'locale' => null, // see RFC5646 'timezone' => null, // see RFC6557 - 'active' => AttributeMapping::eloquent('activated'), - + 'active' => (new AttributeMapping())->setAdd( + function ($value, &$object) { + $object->activated = $value; + } + )->setReplace( + function ($value, &$object) { + $object->activated = $value; + } + )->setRead( + // this works as specified. + function (&$object) { + return (bool)$object->activated; + } + ), 'password' => AttributeMapping::eloquent('password')->disableRead(), // Multi-Valued Attributes