feat: implementar unauthorized_response explicit en listener

Conectar el campo unauthorized_response de FiltersCfg al shouldHandle()
del listener. Cuando está configurado como "explicit", el bot responde
con un mensaje de permisos denegados en lugar de ignorar silenciosamente.

También se añaden los campos allowed_users y unauthorized_response
(comentados como ejemplo) a los configs de assistant-bot y asistente-2.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-07 19:02:06 +00:00
parent 1a99f9c7c1
commit 7d4fa78569
3 changed files with 11 additions and 0 deletions
+2
View File
@@ -162,6 +162,8 @@ matrix:
dm_respond: true
ignore_bots: true
ignore_users: []
allowed_users: [] # vacío = sin restricción (todos pueden hablar)
unauthorized_response: silent # silent | explicit
min_power_level: 0
# ============================================
+5
View File
@@ -162,6 +162,11 @@ matrix:
dm_respond: true # responde en DMs (modo principal por ahora)
ignore_bots: true
ignore_users: []
allowed_users: [] # vacío = sin restricción (todos pueden hablar)
# allowed_users: # ejemplo con restricción:
# - "@admin:matrix-af2f3d.organic-machine.com"
# - "@enmanuel:matrix-af2f3d.organic-machine.com"
unauthorized_response: silent # silent | explicit
min_power_level: 0 # cualquiera puede hablar con el assistant
# ============================================
+4
View File
@@ -236,6 +236,10 @@ func (l *Listener) shouldHandle(evt *event.Event) bool {
}
if !allowed {
l.logger.Debug("ignoring unauthorized user", "sender", evt.Sender)
if f.UnauthorizedResponse == "explicit" {
ctx := context.Background()
_ = l.client.SendText(ctx, evt.RoomID.String(), "No tienes permisos para interactuar con este agente.")
}
return false
}
}