Cast GET parameters to int and update SQL query
GET parameters 'id' and 'group_id' are now explicitly cast to integers in NotificationGroupController for improved type safety. Also, the SQL query in NotificationGroup model now includes GROUP BY and ORDER BY clauses when filtering by user_id, ensuring results are grouped and sorted by group name.
This commit is contained in:
@@ -29,7 +29,7 @@ class NotificationGroup extends Model
|
||||
LEFT JOIN domains d ON ng.id = d.notification_group_id";
|
||||
|
||||
if ($userId && !$this->getUserModel()->isAdmin($userId)) {
|
||||
$sql .= " WHERE ng.user_id = ?";
|
||||
$sql .= " WHERE ng.user_id = ? GROUP BY ng.id ORDER BY ng.name ASC";
|
||||
$stmt = $this->db->prepare($sql);
|
||||
$stmt->execute([$userId]);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user