feat: multi-tenant user delete scope + conditional keycloak wait

- Add GET /users/{user_id}/tenant-count endpoint
- Add scope query param (current|all) to DELETE /users/{user_id}
- UserService.delete_user now supports scope='all' to deactivate/remove
  user from all tenants
- Frontend users.ts: getTenantCount(), delete() accepts scope param
- Frontend +page.svelte: async openDeleteDialog fetches tenant count,
  shows 4-button dialog when user belongs to >1 tenant
- docker-entrypoint.sh: Keycloak wait now conditional on WAIT_FOR_KEYCLOAK=1
This commit is contained in:
2026-05-04 14:17:12 -05:00
parent f241e88e21
commit 7ea8a4ba8d
5 changed files with 178 additions and 26 deletions

View File

@@ -29,8 +29,22 @@ wait_for_tcp() {
return 0
}
wait_for_tcp "${CORE_DB_HOST:-postgres-a76}" "${CORE_DB_PORT:-5432}" "PostgreSQL"
wait_for_tcp "keycloak" "8080" "Keycloak"
DB_HOST_PRIMARY="${CORE_DB_HOST:-postgres-a76}"
DB_PORT="${CORE_DB_PORT:-5432}"
if ! wait_for_tcp "$DB_HOST_PRIMARY" "$DB_PORT" "PostgreSQL"; then
# Fallback para entornos donde Docker solo registra el nombre del contenedor.
if [[ "$DB_HOST_PRIMARY" == "postgres-a76" ]]; then
wait_for_tcp "anexo76-postgres-a76" "$DB_PORT" "PostgreSQL" || true
else
echo " Continuando de todas formas..."
fi
fi
# Keycloak solo se espera si se habilita explícitamente (ej. entorno Hub completo).
if [[ "${WAIT_FOR_KEYCLOAK:-0}" == "1" ]]; then
wait_for_tcp "${KEYCLOAK_SERVICE_HOST:-keycloak}" "${KEYCLOAK_SERVICE_PORT:-8080}" "Keycloak" || true
fi
echo "Iniciando proceso: $*"
exec "$@"