Files
opsxsql/backend/internal
opsx 0427b87412 fix(instance): access_mode 值 read/readonly 不一致导致「读」实例被过滤
现象:instance-groups 里给 MySQL 实例授予「只读查询」权限后,
     /queries 页面仍然选不到该实例,admin 也无法访问。

根因(枚举值前后端不一致):
  前端 CreateInstanceForm「读」按钮写入 access_mode = "read"
  后端 AccessibleInstances 只匹配 ["readwrite", "readonly"]
  → "read" 永远不命中,选了「读」的实例(MySQL)被过滤掉;
    Redis 实例是 "readwrite" 所以恰好能查,掩盖了该 bug。

修复:后端 readonly 过滤增加 "read",兼容两种历史写法:
  []string{"readwrite", "readonly", "read"}
  写过滤仍为 ["readwrite", "write"]("read" 实例正确地不能写)

验证(admin):
  GET /instances/accessible?access_type=readonly → 5 个(含 MySQL id=5, access_mode=read)
  GET /instances/accessible?access_type=write    → 4 个(MySQL 正确排除)

镜像:lghost/opsxsql:latest + v0.1 = sha256:6b1a7121da71
2026-10-26 18:30:47 +00:00
..