Skip to content

A free open source IT asset/license management system

Force active flag to be returned as true or false

Brady Wetherington7b12d511f8c6
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