feat: per-server notification thresholds with alert on agent metrics push
This commit is contained in:
@@ -410,6 +410,28 @@ class Server
|
||||
);
|
||||
}
|
||||
|
||||
public function getAccessibleUserIds(int $serverId): array
|
||||
{
|
||||
$direct = $this->db->fetchCol(
|
||||
'SELECT user_id FROM server_user WHERE server_id = ? AND status = \'active\'',
|
||||
[$serverId]
|
||||
);
|
||||
|
||||
$team = $this->db->fetchCol(
|
||||
'SELECT DISTINCT tu.user_id FROM team_user tu
|
||||
JOIN team_server ts ON tu.team_id = ts.team_id
|
||||
WHERE ts.server_id = ? AND tu.status = \'active\' AND ts.status = \'active\'',
|
||||
[$serverId]
|
||||
);
|
||||
|
||||
$owner = $this->db->fetchCol(
|
||||
'SELECT created_by FROM servers WHERE id = ? AND status = \'active\'',
|
||||
[$serverId]
|
||||
);
|
||||
|
||||
return array_unique(array_merge($direct, $team, $owner));
|
||||
}
|
||||
|
||||
public function findByAgentKey(string $key): ?array
|
||||
{
|
||||
$server = $this->db->fetch(
|
||||
|
||||
Reference in New Issue
Block a user