From 1e3281c76ccce1bf1e9bc74d6b29f0dac7ff5cc2 Mon Sep 17 00:00:00 2001 From: Brady Wetherington Date: Tue, 25 Oct 2022 14:19:01 -0700 Subject: [PATCH 1/2] Add externalId support to SCIM integration --- app/Models/SnipeSCIMConfig.php | 3 ++ ...2_10_25_193823_add_externalid_to_users.php | 32 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 database/migrations/2022_10_25_193823_add_externalid_to_users.php diff --git a/app/Models/SnipeSCIMConfig.php b/app/Models/SnipeSCIMConfig.php index 4c13dc4ed7..221bf7d2e9 100644 --- a/app/Models/SnipeSCIMConfig.php +++ b/app/Models/SnipeSCIMConfig.php @@ -41,6 +41,9 @@ class SnipeSCIMConfig extends \ArieTimmerman\Laravel\SCIMServer\SCIMConfig } ); + $config['validations'][$core.'externalId'] = 'string'; // not required, but supported mostly just for Okta + $mappings['externalId'] = AttributeMapping::eloquent('scim_externalid'); + $config['validations'][$core.'emails'] = 'nullable|array'; // emails are not required in Snipe-IT... $config['validations'][$core.'emails.*.value'] = 'email'; // ...(had to remove the recommended 'required' here) diff --git a/database/migrations/2022_10_25_193823_add_externalid_to_users.php b/database/migrations/2022_10_25_193823_add_externalid_to_users.php new file mode 100644 index 0000000000..5f11e5946b --- /dev/null +++ b/database/migrations/2022_10_25_193823_add_externalid_to_users.php @@ -0,0 +1,32 @@ +string('scim_externalid'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('scim_externalid'); + }); + } +} From cd385e0865c85b9d558b23b10fc5505458ae2ad7 Mon Sep 17 00:00:00 2001 From: Brady Wetherington Date: Tue, 25 Oct 2022 14:38:19 -0700 Subject: [PATCH 2/2] Set scim_externalid to nullable, default null --- .../migrations/2022_10_25_193823_add_externalid_to_users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/migrations/2022_10_25_193823_add_externalid_to_users.php b/database/migrations/2022_10_25_193823_add_externalid_to_users.php index 5f11e5946b..2e9caca40e 100644 --- a/database/migrations/2022_10_25_193823_add_externalid_to_users.php +++ b/database/migrations/2022_10_25_193823_add_externalid_to_users.php @@ -14,7 +14,7 @@ class AddExternalidToUsers extends Migration public function up() { Schema::table('users', function (Blueprint $table) { - $table->string('scim_externalid'); + $table->string('scim_externalid')->nullable()->default(null); }); }