diff --git a/app/src/Lib/Traits/PluggableModelTrait.php b/app/src/Lib/Traits/PluggableModelTrait.php index b66b8bce5..5d413e979 100644 --- a/app/src/Lib/Traits/PluggableModelTrait.php +++ b/app/src/Lib/Traits/PluggableModelTrait.php @@ -142,11 +142,19 @@ protected function setPluginRelations() { // once per instantiation. $models = $this->find() - ->select('plugin') + ->select(['id', 'plugin']) ->distinct(['plugin']) ->all(); - + foreach($models as $m) { + if(empty($m->plugin) || !strstr($m->plugin, '.')) { + // This plugin is not valid. We could filter this in the find() using a + // where() clause, but checking here allows us to emit a warning. + + $this->llog('error', "Ignoring invalid plugin found in " . $this->getTable() . " record " . $m->id); + continue; + } + // In general, a model with a "plugin" field has a 1-1 relation // with the instantiated plugin configuration. eg: One instance // of a Server has exactly one SqlServer associated with it. diff --git a/app/src/Model/Table/IdentifierAssignmentsTable.php b/app/src/Model/Table/IdentifierAssignmentsTable.php index ea6ac0730..b0325c9f6 100644 --- a/app/src/Model/Table/IdentifierAssignmentsTable.php +++ b/app/src/Model/Table/IdentifierAssignmentsTable.php @@ -136,7 +136,10 @@ public function initialize(array $config): void { * Assign Identifiers for an Entity. * * @since COmanage Registry v5.0.0 -* XXX Document params + * @param string $entityType Entity Table (eg: "People") + * @param int $entityId Entity ID + * @param bool $provision Whether or not to run provisioners after assignment + * @param int $actorPersonId Person ID of Actor assigning identifiers */ public function assign( @@ -470,7 +473,7 @@ public function validationDefault(Validator $validator): Validator { ]); $validator->notEmptyString('status'); - $this->registerStringValidation($validator, $schema, 'plugin', false); + $this->registerStringValidation($validator, $schema, 'plugin', true); $validator->add('context', [ 'content' => ['rule' => ['inList', IdentifierAssignmentContextEnum::getConstValues()]] diff --git a/app/src/Model/Table/ServersTable.php b/app/src/Model/Table/ServersTable.php index 3980bb804..6f29d004c 100644 --- a/app/src/Model/Table/ServersTable.php +++ b/app/src/Model/Table/ServersTable.php @@ -162,7 +162,7 @@ public function validationDefault(Validator $validator): Validator { ]); $validator->notEmptyString('status'); - $this->registerStringValidation($validator, $schema, 'plugin', false); + $this->registerStringValidation($validator, $schema, 'plugin', true); return $validator; }