Skip to content

A free open source IT asset/license management system

Rename ConfigurableAdapter to SyncAdapter

snipe0cb528758ecc
diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php
index 2b30fcdcd5..73dbe1308a 100644
--- a/app/Http/Controllers/SettingsController.php
+++ b/app/Http/Controllers/SettingsController.php
@@ -1338,7 +1338,7 @@ class SettingsController extends Controller
}
$adapter = $instance->adapter();
- if ($adapter === null || ! $adapter instanceof \App\SyncAdapters\Support\ConfigurableAdapter) {
+ if ($adapter === null || ! $adapter instanceof \App\SyncAdapters\SyncAdapter) {
abort(404);
}
@@ -1389,7 +1389,7 @@ class SettingsController extends Controller
}
$adapter = $instance->adapter();
- if ($adapter === null || ! $adapter instanceof \App\SyncAdapters\Support\ConfigurableAdapter) {
+ if ($adapter === null || ! $adapter instanceof \App\SyncAdapters\SyncAdapter) {
abort(404);
}
diff --git a/app/Models/SyncAdapterInstance.php b/app/Models/SyncAdapterInstance.php
index 6a6db0668f..3e3e1d3fcc 100644
--- a/app/Models/SyncAdapterInstance.php
+++ b/app/Models/SyncAdapterInstance.php
@@ -3,7 +3,7 @@
namespace App\Models;
use App\SyncAdapters\AdapterRegistry;
-use App\SyncAdapters\HostInventoryAdapter;
+use App\SyncAdapters\SyncAdapter;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
@@ -54,7 +54,7 @@ class SyncAdapterInstance extends Model
* type is not registered (which shouldn't normally happen but can if
* an adapter class is removed while instances still reference it).
*/
- public function adapter(): ?HostInventoryAdapter
+ public function adapter(): ?SyncAdapter
{
return AdapterRegistry::hydrate($this);
}
diff --git a/app/SyncAdapters/AdapterRegistry.php b/app/SyncAdapters/AdapterRegistry.php
index 725d469892..17fb7461fa 100644
--- a/app/SyncAdapters/AdapterRegistry.php
+++ b/app/SyncAdapters/AdapterRegistry.php
@@ -34,7 +34,7 @@ use App\SyncAdapters\Zentral\ZentralAdapter;
class AdapterRegistry
{
/**
- * @var array<string, class-string<HostInventoryAdapter>>
+ * @var array<string, class-string<SyncAdapter>>
*/
private const TYPES = [
'fleet' => FleetAdapter::class,
@@ -62,7 +62,7 @@ class AdapterRegistry
* (which can happen if an adapter class was removed but instances
* still reference it).
*/
- public static function hydrate(SyncAdapterInstance $instance): ?HostInventoryAdapter
+ public static function hydrate(SyncAdapterInstance $instance): ?SyncAdapter
{
$class = self::TYPES[$instance->adapter_type] ?? null;
if ($class === null) {
@@ -76,7 +76,7 @@ class AdapterRegistry
* Load every configured instance and hydrate it as a live adapter.
* Instances whose adapter_type isn't registered are skipped.
*
- * @return array<int, HostInventoryAdapter>
+ * @return array<int, SyncAdapter>
*/
public static function allInstances(): array
{
diff --git a/app/SyncAdapters/Addigy/AddigyAdapter.php b/app/SyncAdapters/Addigy/AddigyAdapter.php
index c37bdaf14d..62fdd05809 100644
--- a/app/SyncAdapters/Addigy/AddigyAdapter.php
+++ b/app/SyncAdapters/Addigy/AddigyAdapter.php
@@ -3,7 +3,7 @@
namespace App\SyncAdapters\Addigy;
use App\SyncAdapters\HostInventoryRecord;
-use App\SyncAdapters\Support\ConfigurableAdapter;
+use App\SyncAdapters\SyncAdapter;
use Carbon\Carbon;
use Illuminate\Support\Arr;
@@ -12,7 +12,7 @@ use Illuminate\Support\Arr;
* normalizes it into HostInventoryRecord objects. Uses Addigy's
* client-id + client-secret header pair (not bearer-token auth).
*/
-class AddigyAdapter extends ConfigurableAdapter
+class AddigyAdapter extends SyncAdapter
{
public static function typeLabel(): string
{
diff --git a/app/SyncAdapters/AppleBusinessManager/AppleBusinessManagerAdapter.php b/app/SyncAdapters/AppleBusinessManager/AppleBusinessManagerAdapter.php
index c374cabefb..4df8366ac7 100644
--- a/app/SyncAdapters/AppleBusinessManager/AppleBusinessManagerAdapter.php
+++ b/app/SyncAdapters/AppleBusinessManager/AppleBusinessManagerAdapter.php
@@ -4,7 +4,7 @@ namespace App\SyncAdapters\AppleBusinessManager;
use App\Models\AssetModel;
use App\SyncAdapters\HostInventoryRecord;
-use App\SyncAdapters\Support\ConfigurableAdapter;
+use App\SyncAdapters\SyncAdapter;
use Carbon\Carbon;
use Illuminate\Support\Arr;
@@ -32,7 +32,7 @@ use Illuminate\Support\Arr;
* Push: not implemented. Apple's write endpoints (device metadata,
* MDM server assignment) are outside Snipe-IT's authoritative scope.
*/
-class AppleBusinessManagerAdapter extends ConfigurableAdapter
+class AppleBusinessManagerAdapter extends SyncAdapter
{
/**
* Apple's fixed productFamily enum -> friendly display name.
diff --git a/app/SyncAdapters/CustomHttp/CustomHttpAdapter.php b/app/SyncAdapters/CustomHttp/CustomHttpAdapter.php
index 9f4145815b..4783a79a9b 100644
--- a/app/SyncAdapters/CustomHttp/CustomHttpAdapter.php
+++ b/app/SyncAdapters/CustomHttp/CustomHttpAdapter.php
@@ -5,7 +5,7 @@ namespace App\SyncAdapters\CustomHttp;
use App\Models\Asset;
use App\SyncAdapters\HostInventoryRecord;
use App\SyncAdapters\PushableAdapter;
-use App\SyncAdapters\Support\ConfigurableAdapter;
+use App\SyncAdapters\SyncAdapter;
use Carbon\Carbon;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Http;
@@ -19,7 +19,7 @@ use Illuminate\Support\Facades\Log;
* generic pull() walks the response, extracts values by dot-path,
* and yields normalized records the framework can save.
*/
-class CustomHttpAdapter extends ConfigurableAdapter implements PushableAdapter
+class CustomHttpAdapter extends SyncAdapter implements PushableAdapter
{
/**
* Cap on pagination loop iterations, to keep a misconfigured
diff --git a/app/SyncAdapters/Fleet/FleetAdapter.php b/app/SyncAdapters/Fleet/FleetAdapter.php
index dbf49b4245..2926348d22 100644
--- a/app/SyncAdapters/Fleet/FleetAdapter.php
+++ b/app/SyncAdapters/Fleet/FleetAdapter.php
@@ -3,7 +3,7 @@
namespace App\SyncAdapters\Fleet;
use App\SyncAdapters\HostInventoryRecord;
-use App\SyncAdapters\Support\ConfigurableAdapter;
+use App\SyncAdapters\SyncAdapter;
use Carbon\Carbon;
use Illuminate\Support\Arr;
@@ -19,7 +19,7 @@ use Illuminate\Support\Arr;
* semantic mismatch. Revisit if Fleet exposes per-host Custom
* Attributes on a future release.
*/
-class FleetAdapter extends ConfigurableAdapter
+class FleetAdapter extends SyncAdapter
{
public static function typeLabel(): string
{
diff --git a/app/SyncAdapters/HostInventoryAdapter.php b/app/SyncAdapters/HostInventoryAdapter.php
deleted file mode 100644
index 17a480e740..0000000000
--- a/app/SyncAdapters/HostInventoryAdapter.php
+++ /dev/null
@@ -1,115 +0,0 @@
-<?php
-
-namespace App\SyncAdapters;
-
-use App\Models\SyncAdapterInstance;
-use Carbon\CarbonInterface;
-use Illuminate\Http\Request;
-
-/**
- * Contract every host-inventory sync adapter implements. An adapter is
- * always constructed against a specific SyncAdapterInstance so multiple
- * instances of the same adapter TYPE (two Fleet installs, one Fleet +
- * one Kandji, etc.) each get their own credentials, own settings tab,
- * own asset_external_sources.source value.
- *
- * The asset-side upsert code is shared across adapters
- * (SyncHostFromAdapter action). Adapters also own their own settings
- * view partial and save handler so the generic /admin/adapters page
- * can render every instance's section without the controller knowing
- * anything vendor-specific.
- */
-interface HostInventoryAdapter
-{
- /**
- * Bind the adapter to the given instance. Every adapter subclass
- * accepts a SyncAdapterInstance in its constructor via this contract
- * so AdapterRegistry::hydrate() can build one uniformly.
- */
- public function __construct(SyncAdapterInstance $instance);
-
- /**
- * The instance's slug. Used as the `source` value in
- * asset_external_sources and as the route parameter for the sync
- * trigger. Example: 'fleet-prod', 'jamf-staging', 'kandji'.
- */
- public function name(): string;
-
- /**
- * Human-readable name shown on the settings-page tab. Pulled from
- * the instance's `label` column, which is user-editable per instance.
- */
- public function label(): string;
-
- /**
- * Whether this instance is configured, active, and available to run.
- * Adapters check their required credentials, the instance's `active`
- * flag, and any adapter-specific readiness here.
- */
- public function isEnabled(): bool;
-
- /**
- * Whether this instance's `active` toggle is on. Distinct from
- * isEnabled(), which also requires config to be present. The blade
- * uses this to render the checkbox state.
- */
- public function isActive(): bool;
-
- /**
- * Three-state readiness for the settings-page tab indicator:
- * 'active' (will sync), 'partial' (turned on but missing config),
- * 'inactive' (toggle off). Drives the green/yellow/red dot and
- * the sort order on the shared adapters page.
- */
- public function readinessStatus(): string;
-
- /**
- * Whether this instance is a shipped built-in (undeletable). The
- * blade uses this to hide the delete control.
- */
- public function isBuiltIn(): bool;
-
- /**
- * Validation rules the controller runs against the save request
- * BEFORE handing it to saveConfig. Adapters declare their own
- * required fields + SSRF guards here (e.g. the ExternalUrl rule on
- * the URL field to block loopback / RFC-1918 / metadata targets).
- *
- * @return array<string, array<int, mixed>>
- */
- public function validationRules(): array;
-
- /**
- * Persist this instance's settings from a save request. The generic
- * postAdapters controller iterates the registered instances and
- * calls this for the one whose slug matches the form's hidden
- * `adapter` input. Keeps every adapter's config-storage details
- * inside the adapter class instead of leaking into shared
- * controller code.
- */
- public function saveConfig(Request $request): void;
-
- /**
- * Pull the current host inventory from the vendor. Returns a
- * generator so adapters can page through large inventories without
- * buffering everything in memory.
- *
- * @return iterable<HostInventoryRecord>
- */
- public function pull(): iterable;
-
- /**
- * When the last sync ran, or null if this instance has never been
- * synced. Written by both the interactive Sync Now button and the
- * CLI command so the settings page can surface the most recent
- * outcome regardless of trigger source.
- */
- public function lastSyncedAt(): ?CarbonInterface;
-
- /**
- * Human-readable summary of the last sync's outcome (e.g.
- * "Sync complete. Synced 847 host(s), 3 error(s).") or null if
- * this instance has never been synced.
- */
- public function lastSyncResult(): ?string;
-}
diff --git a/app/SyncAdapters/Intune/IntuneAdapter.php b/app/SyncAdapters/Intune/IntuneAdapter.php
index 50c295dc7c..fd4df06032 100644
--- a/app/SyncAdapters/Intune/IntuneAdapter.php
+++ b/app/SyncAdapters/Intune/IntuneAdapter.php
@@ -5,7 +5,7 @@ namespace App\SyncAdapters\Intune;
use App\Models\Asset;
use App\SyncAdapters\HostInventoryRecord;
use App\SyncAdapters\PushableAdapter;
-use App\SyncAdapters\Support\ConfigurableAdapter;
+use App\SyncAdapters\SyncAdapter;
use Carbon\Carbon;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Log;
@@ -28,7 +28,7 @@ use Illuminate\Support\Facades\Log;
* so admins can audit which Azure app registration a Snipe-IT instance
* is talking to without a decrypt step. Only client_secret is encrypted.
*/
-class IntuneAdapter extends ConfigurableAdapter implements PushableAdapter
+class IntuneAdapter extends SyncAdapter implements PushableAdapter
{
public static function typeLabel(): string
{
diff --git a/app/SyncAdapters/Jamf/JamfAdapter.php b/app/SyncAdapters/Jamf/JamfAdapter.php
index 2820df315e..2b4e100452 100644
--- a/app/SyncAdapters/Jamf/JamfAdapter.php
+++ b/app/SyncAdapters/Jamf/JamfAdapter.php
@@ -5,7 +5,7 @@ namespace App\SyncAdapters\Jamf;
use App\Models\Asset;
use App\SyncAdapters\HostInventoryRecord;
use App\SyncAdapters\PushableAdapter;
-use App\SyncAdapters\Support\ConfigurableAdapter;
+use App\SyncAdapters\SyncAdapter;
use Carbon\Carbon;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Log;
@@ -17,7 +17,7 @@ use Illuminate\Support\Facades\Log;
* Snipe-IT-authoritative fields (asset_tag today) back to Jamf via
* the /api/v1/computers-inventory-detail/{id} PATCH endpoint.
*/
-class JamfAdapter extends ConfigurableAdapter implements PushableAdapter
+class JamfAdapter extends SyncAdapter implements PushableAdapter
{
public static function typeLabel(): string
{
diff --git a/app/SyncAdapters/JamfSchool/JamfSchoolAdapter.php b/app/SyncAdapters/JamfSchool/JamfSchoolAdapter.php
index ae958ba3a4..562a6a8b3e 100644
--- a/app/SyncAdapters/JamfSchool/JamfSchoolAdapter.php
+++ b/app/SyncAdapters/JamfSchool/JamfSchoolAdapter.php
@@ -3,7 +3,7 @@
namespace App\SyncAdapters\JamfSchool;
use App\SyncAdapters\HostInventoryRecord;
-use App\SyncAdapters\Support\ConfigurableAdapter;
+use App\SyncAdapters\SyncAdapter;
use Carbon\Carbon;
use Illuminate\Support\Arr;
@@ -14,7 +14,7 @@ use Illuminate\Support\Arr;
* API, separate auth model (HTTP Basic with Network ID + API Key), so
* separate adapter.
*/
-class JamfSchoolAdapter extends ConfigurableAdapter
+class JamfSchoolAdapter extends SyncAdapter
{
public static function typeLabel(): string
{
diff --git a/app/SyncAdapters/JumpCloud/JumpCloudAdapter.php b/app/SyncAdapters/JumpCloud/JumpCloudAdapter.php
index 6554453198..a54ae978f5 100644
--- a/app/SyncAdapters/JumpCloud/JumpCloudAdapter.php
+++ b/app/SyncAdapters/JumpCloud/JumpCloudAdapter.php
@@ -3,7 +3,7 @@
namespace App\SyncAdapters\JumpCloud;
use App\SyncAdapters\HostInventoryRecord;
-use App\SyncAdapters\Support\ConfigurableAdapter;
+use App\SyncAdapters\SyncAdapter;
use Carbon\Carbon;
use Illuminate\Support\Arr;
@@ -13,7 +13,7 @@ use Illuminate\Support\Arr;
* Auth uses the tenant's static API key in the x-api-key header, not
* a bearer token.
*/
-class JumpCloudAdapter extends ConfigurableAdapter
+class JumpCloudAdapter extends SyncAdapter
{
public static function typeLabel(): string
{
diff --git a/app/SyncAdapters/Kandji/KandjiAdapter.php b/app/SyncAdapters/Kandji/KandjiAdapter.php
index 86bd0c3001..112db2c4f8 100644
--- a/app/SyncAdapters/Kandji/KandjiAdapter.php
+++ b/app/SyncAdapters/Kandji/KandjiAdapter.php
@@ -5,7 +5,7 @@ namespace App\SyncAdapters\Kandji;
use App\Models\Asset;
use App\SyncAdapters\HostInventoryRecord;
use App\SyncAdapters\PushableAdapter;
-use App\SyncAdapters\Support\ConfigurableAdapter;
+use App\SyncAdapters\SyncAdapter;
use Carbon\Carbon;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Log;
@@ -16,7 +16,7 @@ use Illuminate\Support\Facades\Log;
* objects. Also pushes Snipe-IT-authoritative fields back to Kandji
* (asset_tag today) when the admin marks the mapping row as 'push'.
*/
-class KandjiAdapter extends ConfigurableAdapter implements PushableAdapter
+class KandjiAdapter extends SyncAdapter implements PushableAdapter
{
public static function typeLabel(): string
{
diff --git a/app/SyncAdapters/KaseyaVsa10/KaseyaVsa10Adapter.php b/app/SyncAdapters/KaseyaVsa10/KaseyaVsa10Adapter.php
index a500249070..da955df476 100644
--- a/app/SyncAdapters/KaseyaVsa10/KaseyaVsa10Adapter.php
+++ b/app/SyncAdapters/KaseyaVsa10/KaseyaVsa10Adapter.php
@@ -3,7 +3,7 @@
namespace App\SyncAdapters\KaseyaVsa10;
use App\SyncAdapters\HostInventoryRecord;
-use App\SyncAdapters\Support\ConfigurableAdapter;
+use App\SyncAdapters\SyncAdapter;
use Carbon\Carbon;
use Illuminate\Support\Arr;
@@ -33,7 +33,7 @@ use Illuminate\Support\Arr;
* both are candidates for a later push implementation once we have
* a real tenant to validate the update-endpoint shape.
*/
-class KaseyaVsa10Adapter extends ConfigurableAdapter
+class KaseyaVsa10Adapter extends SyncAdapter
{
public static function typeLabel(): string
{
diff --git a/app/SyncAdapters/MerakiSystemsManager/MerakiSystemsManagerAdapter.php b/app/SyncAdapters/MerakiSystemsManager/MerakiSystemsManagerAdapter.php
index 2237256c46..4d1be3a8fa 100644
--- a/app/SyncAdapters/MerakiSystemsManager/MerakiSystemsManagerAdapter.php
+++ b/app/SyncAdapters/MerakiSystemsManager/MerakiSystemsManagerAdapter.php
@@ -2,7 +2,7 @@
namespace App\SyncAdapters\MerakiSystemsManager;
-use App\SyncAdapters\Support\ConfigurableAdapter;
+use App\SyncAdapters\SyncAdapter;
/**
* Cisco Meraki Systems Manager adapter. STUB, registration + settings-
@@ -17,7 +17,7 @@ use App\SyncAdapters\Support\ConfigurableAdapter;
* schema config rather than being discovered per-sync so admins can
* pin a specific org when the account owns several.
*/
-class MerakiSystemsManagerAdapter extends ConfigurableAdapter
+class MerakiSystemsManagerAdapter extends SyncAdapter
{
public static function typeLabel(): string
{
diff --git a/app/SyncAdapters/Mosyle/MosyleAdapter.php b/app/SyncAdapters/Mosyle/MosyleAdapter.php
index 9b54ddeeaf..69cd8eb36d 100644
--- a/app/SyncAdapters/Mosyle/MosyleAdapter.php
+++ b/app/SyncAdapters/Mosyle/MosyleAdapter.php
@@ -5,7 +5,7 @@ namespace App\SyncAdapters\Mosyle;
use App\Models\Asset;
use App\SyncAdapters\HostInventoryRecord;
use App\SyncAdapters\PushableAdapter;
-use App\SyncAdapters\Support\ConfigurableAdapter;
+use App\SyncAdapters\SyncAdapter;
use Carbon\Carbon;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Log;
@@ -18,7 +18,7 @@ use Illuminate\Support\Facades\Log;
* authoritative asset_tag back via Mosyle's serial-number-scoped
* set_asset_tag operation.
*/
-class MosyleAdapter extends ConfigurableAdapter implements PushableAdapter
+class MosyleAdapter extends SyncAdapter implements PushableAdapter
{
public static function typeLabel(): string
{
diff --git a/app/SyncAdapters/NinjaOne/NinjaOneAdapter.php b/app/SyncAdapters/NinjaOne/NinjaOneAdapter.php
index 425d818e76..8b6f0c36e4 100644
--- a/app/SyncAdapters/NinjaOne/NinjaOneAdapter.php
+++ b/app/SyncAdapters/NinjaOne/NinjaOneAdapter.php
@@ -5,7 +5,7 @@ namespace App\SyncAdapters\NinjaOne;
use App\Models\Asset;
use App\SyncAdapters\HostInventoryRecord;
use App\SyncAdapters\PushableAdapter;
-use App\SyncAdapters\Support\ConfigurableAdapter;
+use App\SyncAdapters\SyncAdapter;
use Carbon\Carbon;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Log;
@@ -31,7 +31,7 @@ use Illuminate\Support\Facades\Log;
* the admin puts in the "Asset Tag Custom Field Name" schema slot. If
* empty, push silently no-ops (nothing to write to).
*/
-class NinjaOneAdapter extends ConfigurableAdapter implements PushableAdapter
+class NinjaOneAdapter extends SyncAdapter implements PushableAdapter
{
public static function typeLabel(): string
{
diff --git a/app/SyncAdapters/Osctrl/OsctrlAdapter.php b/app/SyncAdapters/Osctrl/OsctrlAdapter.php
index e6d4f8a828..d92f892dbe 100644
--- a/app/SyncAdapters/Osctrl/OsctrlAdapter.php
+++ b/app/SyncAdapters/Osctrl/OsctrlAdapter.php
@@ -3,7 +3,7 @@
namespace App\SyncAdapters\Osctrl;
use App\SyncAdapters\HostInventoryRecord;
-use App\SyncAdapters\Support\ConfigurableAdapter;
+use App\SyncAdapters\SyncAdapter;
use Carbon\Carbon;
use Illuminate\Support\Arr;
@@ -16,7 +16,7 @@ use Illuminate\Support\Arr;
* one of them. Set up a second sync-adapter instance per environment
* when a single osctrl install serves multiple.
*/
-class OsctrlAdapter extends ConfigurableAdapter
+class OsctrlAdapter extends SyncAdapter
{
public static function typeLabel(): string
{
diff --git a/app/SyncAdapters/PushableAdapter.php b/app/SyncAdapters/PushableAdapter.php
index c0561a4307..9d9e4a7723 100644
--- a/app/SyncAdapters/PushableAdapter.php
+++ b/app/SyncAdapters/PushableAdapter.php
@@ -8,10 +8,10 @@ use App\Models\Asset;
* Marker + contract for adapters that support pushing Snipe-IT-owned
* field values back to the vendor (Snipe-IT asset_tag -> vendor
* asset_tag, Snipe-IT notes -> vendor notes, etc.). Kept separate
- * from HostInventoryAdapter so pull-only vendors (osctrl, Zentral,
+ * from SyncAdapter so pull-only vendors (osctrl, Zentral,
* UniFi) don't have to stub anything.
*
- * Adapters that implement this ALSO implement HostInventoryAdapter
+ * Adapters that implement this ALSO implement SyncAdapter
* in practice — the two directions share credentials, base URL, and
* asset identity (asset_external_sources.external_id). The interfaces
* stay separate so an adapter can be pull-only, push-only, or both.
@@ -49,7 +49,7 @@ interface PushableAdapter
* - Resolving the vendor-side external_id from the asset's
* asset_external_sources row scoped to this adapter's instance
* - Filtering the field set to those directed 'push' via
- * ConfigurableAdapter::directionFor()
+ * SyncAdapter::directionFor()
* - Serializing each field into the vendor's expected shape
* - Sending the write call
*
diff --git a/app/SyncAdapters/Support/ConfigurableAdapter.php b/app/SyncAdapters/SyncAdapter.php
similarity index 99%
rename from app/SyncAdapters/Support/ConfigurableAdapter.php
rename to app/SyncAdapters/SyncAdapter.php
index f839068e8e..491859c1e9 100644
--- a/app/SyncAdapters/Support/ConfigurableAdapter.php
+++ b/app/SyncAdapters/SyncAdapter.php
@@ -1,11 +1,12 @@
<?php
-namespace App\SyncAdapters\Support;
+namespace App\SyncAdapters;
use App\Models\SyncAdapterConfig;
use App\Models\SyncAdapterInstance;
use App\Rules\ExternalUrl;
-use App\SyncAdapters\HostInventoryAdapter;
+use App\SyncAdapters\Support\MappingTargets;
+use App\SyncAdapters\Support\NotesComposer;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Crypt;
@@ -39,7 +40,7 @@ use Illuminate\Support\Facades\Crypt;
* - AWS SigV4 (still three text/password fields plus a region)
* - Basic auth (still two fields, no new type)
*/
-abstract class ConfigurableAdapter implements HostInventoryAdapter
+abstract class SyncAdapter
{
public function __construct(protected readonly SyncAdapterInstance $instance) {}
@@ -740,7 +741,7 @@ abstract class ConfigurableAdapter implements HostInventoryAdapter
return '';
}
- return \App\SyncAdapters\Support\NotesComposer::compose($asset, $template);
+ return NotesComposer::compose($asset, $template);
}
/**
diff --git a/app/SyncAdapters/SyncHostFromAdapter.php b/app/SyncAdapters/SyncHostFromAdapter.php
index df95f419c0..4ddaf5d761 100644
--- a/app/SyncAdapters/SyncHostFromAdapter.php
+++ b/app/SyncAdapters/SyncHostFromAdapter.php
@@ -11,7 +11,7 @@ use App\Models\Statuslabel;
use App\Models\SyncAdapterConfig;
use App\Models\SyncAdapterInstance;
use App\Models\User;
-use App\SyncAdapters\Support\ConfigurableAdapter;
+use App\SyncAdapters\SyncAdapter;
use App\SyncAdapters\Support\MappingTargets;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
@@ -154,7 +154,7 @@ class SyncHostFromAdapter
if ($target === 'skip') {
continue;
}
- if ($adapterForDirection instanceof ConfigurableAdapter
+ if ($adapterForDirection instanceof SyncAdapter
&& ! in_array($adapterForDirection->directionFor($field), ['pull', 'both'], true)) {
continue;
}
@@ -192,7 +192,7 @@ class SyncHostFromAdapter
return;
}
$adapter = $instance->adapter();
- if (! $adapter instanceof ConfigurableAdapter) {
+ if (! $adapter instanceof SyncAdapter) {
return;
}
@@ -258,7 +258,7 @@ class SyncHostFromAdapter
$logsHeartbeats = false;
if ($instance !== null) {
$adapter = $instance->adapter();
- if ($adapter instanceof ConfigurableAdapter) {
+ if ($adapter instanceof SyncAdapter) {
$logsHeartbeats = $adapter->logsHeartbeats();
}
}
@@ -378,7 +378,7 @@ class SyncHostFromAdapter
// Adapter-specific extra fields, if the adapter declares any.
$adapter = $instance->adapter();
- if ($adapter instanceof ConfigurableAdapter) {
+ if ($adapter instanceof SyncAdapter) {
foreach (array_keys($adapter->extraFields()) as $extraKey) {
$stored = SyncAdapterConfig::get($instance->id, 'mapping.'.$extraKey);
if ($stored !== null) {
@@ -499,7 +499,7 @@ class SyncHostFromAdapter
{
if ($instance !== null) {
$adapter = $instance->adapter();
- if ($adapter instanceof ConfigurableAdapter) {
+ if ($adapter instanceof SyncAdapter) {
$configuredId = $adapter->defaultStatusId();
if ($configuredId !== null && Statuslabel::whereKey($configuredId)->exists()) {
return $configuredId;
@@ -527,13 +527,13 @@ class SyncHostFromAdapter
* Group mappings let one adapter instance sync devices from a
* multi-tenant vendor (Kandji, Fleet, Jamf) into per-customer
* Snipe-IT companies without needing one adapter instance per
- * company. See ConfigurableAdapter::groupMappings().
+ * company. See SyncAdapter::groupMappings().
*/
private static function resolveCompanyId(HostInventoryRecord $record, ?SyncAdapterInstance $instance): ?int
{
if ($instance !== null && $record->vendorGroupId !== null && $record->vendorGroupId !== '') {
$adapter = $instance->adapter();
- if ($adapter instanceof ConfigurableAdapter && $adapter->supportsGroupScoping()) {
+ if ($adapter instanceof SyncAdapter && $adapter->supportsGroupScoping()) {
$mapped = $adapter->companyForVendorGroup($record->vendorGroupId);
if ($mapped !== null) {
return $mapped;
@@ -553,13 +553,13 @@ class SyncHostFromAdapter
*
* The pattern lets admins force a stable per-vendor tag scheme
* (KANDJI-{serial}, FLEET-{external_id}, etc.) so re-imported
- * assets keep their tag across reinstalls. See ConfigurableAdapter
+ * assets keep their tag across reinstalls. See SyncAdapter
* -> assetTagPattern() for the storage side.
*/
private static function resolveAssetTag(HostInventoryRecord $record, ?SyncAdapterInstance $instance): string
{
$adapter = $instance?->adapter();
- if ($adapter instanceof ConfigurableAdapter) {
+ if ($adapter instanceof SyncAdapter) {
$pattern = $adapter->assetTagPattern();
if ($pattern !== null) {
$rendered = self::renderAssetTagPattern($pattern, $record);
@@ -805,7 +805,7 @@ class SyncHostFromAdapter
if ($instance !== null) {
$adapter = $instance->adapter();
- if ($adapter instanceof ConfigurableAdapter) {
+ if ($adapter instanceof SyncAdapter) {
$configuredId = $adapter->defaultCategoryId();
if ($configuredId !== null && Category::whereKey($configuredId)->exists()) {
return $configuredId;
@@ -832,7 +832,7 @@ class SyncHostFromAdapter
return null;
}
$adapter = $instance->adapter();
- if (! $adapter instanceof ConfigurableAdapter) {
+ if (! $adapter instanceof SyncAdapter) {
return null;
}
$id = $adapter->categoryIdForRecord($record);
@@ -856,7 +856,7 @@ class SyncHostFromAdapter
}
$adapter = $instance->adapter();
- if (! $adapter instanceof ConfigurableAdapter) {
+ if (! $adapter instanceof SyncAdapter) {
return;
}
@@ -971,7 +971,7 @@ class SyncHostFromAdapter
private static function applyUserAssignment(
Asset $asset,
User $user,
- ConfigurableAdapter $adapter,
+ SyncAdapter $adapter,
SyncAdapterInstance $instance,
): void {
if ((int) $asset->assigned_to === (int) $user->id
diff --git a/app/SyncAdapters/Unifi/UnifiAdapter.php b/app/SyncAdapters/Unifi/UnifiAdapter.php
index 2154de4c64..33ab55ff9c 100644
--- a/app/SyncAdapters/Unifi/UnifiAdapter.php
+++ b/app/SyncAdapters/Unifi/UnifiAdapter.php
@@ -3,7 +3,7 @@
namespace App\SyncAdapters\Unifi;
use App\SyncAdapters\HostInventoryRecord;
-use App\SyncAdapters\Support\ConfigurableAdapter;
+use App\SyncAdapters\SyncAdapter;
use Carbon\Carbon;
use Illuminate\Support\Arr;
@@ -23,7 +23,7 @@ use Illuminate\Support\Arr;
* sync-adapter instance per site (each with its own tab under
* Settings -> Sync Adapters).
*/
-class UnifiAdapter extends ConfigurableAdapter
+class UnifiAdapter extends SyncAdapter
{
public static function typeLabel(): string
{
diff --git a/app/SyncAdapters/WorkspaceOne/WorkspaceOneAdapter.php b/app/SyncAdapters/WorkspaceOne/WorkspaceOneAdapter.php
index 2014ed4dca..e6492bb0e4 100644
--- a/app/SyncAdapters/WorkspaceOne/WorkspaceOneAdapter.php
+++ b/app/SyncAdapters/WorkspaceOne/WorkspaceOneAdapter.php
@@ -5,7 +5,7 @@ namespace App\SyncAdapters\WorkspaceOne;
use App\Models\Asset;
use App\SyncAdapters\HostInventoryRecord;
use App\SyncAdapters\PushableAdapter;
-use App\SyncAdapters\Support\ConfigurableAdapter;
+use App\SyncAdapters\SyncAdapter;
use Carbon\Carbon;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Log;
@@ -34,7 +34,7 @@ use Illuminate\Support\Facades\Log;
* sibling with a different schema is the right shape rather than
* making this schema conditional on auth mode.
*/
-class WorkspaceOneAdapter extends ConfigurableAdapter implements PushableAdapter
+class WorkspaceOneAdapter extends SyncAdapter implements PushableAdapter
{
public static function typeLabel(): string
{
diff --git a/app/SyncAdapters/Zentral/ZentralAdapter.php b/app/SyncAdapters/Zentral/ZentralAdapter.php
index ef6adaab20..34d7eee8b9 100644
--- a/app/SyncAdapters/Zentral/ZentralAdapter.php
+++ b/app/SyncAdapters/Zentral/ZentralAdapter.php
@@ -3,7 +3,7 @@
namespace App\SyncAdapters\Zentral;
use App\SyncAdapters\HostInventoryRecord;
-use App\SyncAdapters\Support\ConfigurableAdapter;
+use App\SyncAdapters\SyncAdapter;
use Carbon\Carbon;
use Illuminate\Support\Arr;
@@ -12,7 +12,7 @@ use Illuminate\Support\Arr;
* from every Zentral source module: Munki, Santa, MDM, Osquery, etc.)
* and normalizes it into HostInventoryRecord objects.
*/
-class ZentralAdapter extends ConfigurableAdapter
+class ZentralAdapter extends SyncAdapter
{
public static function typeLabel(): string
{
diff --git a/database/migrations/2026_09_16_120000_add_source_asset_id_unique_to_asset_external_sources.php b/database/migrations/2026_09_16_120000_add_source_asset_id_unique_to_asset_external_sources.php
new file mode 100644
index 0000000000..f9b56b47cc
--- /dev/null
+++ b/database/migrations/2026_09_16_120000_add_source_asset_id_unique_to_asset_external_sources.php
@@ -0,0 +1,22 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+ public function up(): void
+ {
+ Schema::table('asset_external_sources', function (Blueprint $table) {
+ $table->unique(['source', 'asset_id'], 'aes_source_asset_id_unique');
+ });
+ }
+
+ public function down(): void
+ {
+ Schema::table('asset_external_sources', function (Blueprint $table) {
+ $table->dropUnique('aes_source_asset_id_unique');
+ });
+ }
+};
diff --git a/tests/Feature/SyncAdapters/Intune/IntuneSettingsPageTest.php b/tests/Feature/SyncAdapters/Intune/IntuneSettingsPageTest.php
index b3df0992cb..7b86993810 100644
--- a/tests/Feature/SyncAdapters/Intune/IntuneSettingsPageTest.php
+++ b/tests/Feature/SyncAdapters/Intune/IntuneSettingsPageTest.php
@@ -14,7 +14,7 @@ use Tests\TestCase;
* Smoke coverage for the Intune adapter's registration + settings-page
* presence. Intune's schema mixes non-secret fields (tenant_id,
* client_id) with a secret field (client_secret), so this test proves
- * the ConfigurableAdapter base's per-schema encryption dispatch works:
+ * the SyncAdapter base's per-schema encryption dispatch works:
* secrets get encrypted at rest, plain-text fields stay plain. pull()
* is still a stub so no sync coverage.
*/
diff --git a/tests/Feature/SyncAdapters/NewBuiltInAdaptersRenderTest.php b/tests/Feature/SyncAdapters/NewBuiltInAdaptersRenderTest.php
index 2ca582f68e..035c066a9c 100644
--- a/tests/Feature/SyncAdapters/NewBuiltInAdaptersRenderTest.php
+++ b/tests/Feature/SyncAdapters/NewBuiltInAdaptersRenderTest.php
@@ -8,7 +8,7 @@ use Tests\TestCase;
/**
* Smoke coverage for the three newest built-in adapters (Mosyle, Meraki
* Systems Manager, Omnissa Workspace ONE). Each is a schema-only
- * declaration on top of ConfigurableAdapter. the storage / save /
+ * declaration on top of SyncAdapter. the storage / save /
* encryption cycle is already covered by FleetSettingsPageTest,
* AddigySettingsPageTest, and IntuneSettingsPageTest for the three
* distinct schema shapes (single-secret, key-pair, mixed). This test