Skip to content
Snippets Groups Projects
Verified Commit ceef3ee2 authored by Dominik František Bučík's avatar Dominik František Bučík
Browse files

fix: :bug: Fix parameters ordering and duplicate insert

Fix1 - ordering parameters in "prepareEntitiesStructure" method call -
caused using spName as spIdentifier and vice versa
Fix2 - duplicate call for inserting the login data
parent 94ef966b
No related branches found
No related tags found
1 merge request!85fix: 🐛 Fix parameters ordering and duplicate insert
...@@ -82,20 +82,6 @@ class DatabaseCommand ...@@ -82,20 +82,6 @@ class DatabaseCommand
$entities = $this->getEntities($request); $entities = $this->getEntities($request);
$userId = $this->getUserId($request); $userId = $this->getUserId($request);
$this->insertLogin($entities, $userId, $date); $this->insertLogin($entities, $userId, $date);
$ids = [];
foreach (self::TABLE_SIDES as $side => $table) {
$tableId = self::TABLE_IDS[$table];
$ids[$tableId] = $this->getEntityDbIdFromEntityIdentifier($table, $entities[$side], $tableId);
}
if (!$this->writeLogin($date, $ids, $userId)) {
Logger::error(self::DEBUG_PREFIX . 'login record has not been inserted (data \'' . json_encode([
'user' => $userId,
'ids' => $ids,
'date' => $date,
]) . '\'.');
}
} }
public function insertLoginFromApi($data, DateTime $date) public function insertLoginFromApi($data, DateTime $date)
...@@ -407,7 +393,7 @@ class DatabaseCommand ...@@ -407,7 +393,7 @@ class DatabaseCommand
return $this->prepareEntitiesStructure($idpIdentifier, $idpName, $spIdentifier, $spName); return $this->prepareEntitiesStructure($idpIdentifier, $idpName, $spIdentifier, $spName);
} }
private function prepareEntitiesStructure($idpIdentifier, $idpName, $spName, $spIdentifier): array private function prepareEntitiesStructure($idpIdentifier, $idpName, $spIdentifier, $spName): array
{ {
$entities = [ $entities = [
Config::MODE_IDP => [], Config::MODE_IDP => [],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment