Skip to content

A free open source IT asset/license management system

Add externalId support to SCIM integration

Brady Wetherington1e3281c76ccc
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 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddExternalidToUsers extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::table('users', function (Blueprint $table) {
+ $table->string('scim_externalid');
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ Schema::table('users', function (Blueprint $table) {
+ $table->dropColumn('scim_externalid');
+ });
+ }
+}