Skip to content

Commit

Permalink
check before deletion (#34094)
Browse files Browse the repository at this point in the history
  • Loading branch information
YatharthVyas committed May 23, 2021
1 parent 3c5850e commit 83faf2d
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions administrator/components/com_users/src/Model/GroupModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,18 @@ public function delete(&$pks)
}
}

// Iterate the items to check if all of them exist.
foreach ($pks as $i => $pk)
{
if (!$table->load($pk))
{
// Item is not in the table.
$this->setError($table->getError());

return false;
}
}

// Iterate the items to delete each one.
foreach ($pks as $i => $pk)
{
Expand Down Expand Up @@ -306,12 +318,6 @@ public function delete(&$pks)
Factory::getApplication()->enqueueMessage(Text::_('JERROR_CORE_DELETE_NOT_PERMITTED'), 'error');
}
}
else
{
$this->setError($table->getError());

return false;
}
}

return true;
Expand Down

0 comments on commit 83faf2d

Please sign in to comment.