hoelee 3ecee3099e feat(W1): status lifecycle (suspend/delete/resume) + shared effective-grants lib
- Extract calculateEffectiveGrants into n8n/shared/effective-grants.js
  (single source of truth), inlined at build time into W1/W2/W3 via
  gen_w*.js + inline_shared.js — removes the duplicated algorithm.
- W1 now provisions with a status branch:
  suspended/deleted -> disable AList user + clear role scopes (soft delete)
  active -> create/update user+role, RECOMPUTE desired scopes (never restore
  stale), re-enable
- Loop guard corrected: check AList user LIVE disabled state via
  GET /api/admin/user/get (sync_status alone breaks suspend->resume).
- W2/W3 rebuilt on shared lib (identical behaviour).
- Tests: test_effective_grants.js (15), test_w3_refactored.js (13),
  test_w1_lifecycle.js (23) — all green.
- Drop superseded w2-compute.js / w3-compute.js / test_w3.js.
2026-08-23 04:59:43 +08:00

AList Serve Resource — 客户文件权限与到期管理系统

在 Docker 上运行的客户数字文件交付系统:

  • AList = 文件浏览/预览/下载入口(stock image,不 fork、不嵌 custom code)
  • NocoDB = 业务授权 Source of Truth(客户/产品/授权/到期)
  • n8n = 同步器(NocoDB ↔ AList 官方 Admin API)

架构

Internet
   │
   ▼
DSM nginx (access.hoelee.com)
   │
   ▼
AList (stock, 只读挂载 NAS)
   ▲
   │ 内网 Admin API(http://alist-serve-resource:5244)
   │
n8n ──► NocoDB(授权 SOT)
  • 客户只经 AList 入口访问,默认严格 read-only(权限 bitmask 0 + Check path limit)。
  • 每个客户 = 1 个 AList User + 1 个专属 Role + 多个 path scopes,每个 scope 独立到期(规格 §8)。
  • 到期/禁用由 NocoDB + n8n 定时同步撤销,AList 不存业务授权数据。

目录结构

alist-serve-resource/
├── docker-compose.yml      # 仅 AList(stock)
├── .env.example            # 所有 secrets 模板(复制为 .env)
├── .gitignore
├── docs/
│   ├── API_INTEGRATION.md  # ★ AList API 源码级验证
│   ├── INSTALL.md
│   ├── CONFIGURATION.md
│   ├── DATABASE_SCHEMA.md
│   ├── N8N_WORKFLOWS.md
│   ├── SECURITY.md
│   ├── BACKUP_RESTORE.md
│   ├── UPGRADE.md
│   └── TROUBLESHOOTING.md
├── n8n/workflows/          # n8n workflow JSON 导出
└── scripts/                # backup/restore/healthcheck

快速开始

见 docs/INSTALL.md。

关键结论

规格文档 §11 担心的「Role scope 是否能用 API 管理」——答案是能(v3.63.0 源码级验证, 完整 Role CRUD)。无需 fork、无需 integration service。详见 docs/API_INTEGRATION.md。

与旧 alist 的区别

旧 alist 新 alist-serve-resource
镜像 xhofe/alist:v3.54.0 xhofe/alist:v3.63.0
custom.js/css 注入 有(custom made) 无(纯 stock)
入口链 nginx-limit → traefik-update → alist DSM nginx → alist(直连)
权限/到期 内嵌业务逻辑 NocoDB + n8n + 官方 API
端口 5244/5245/5246 5247
数据目录 /volume1/docker/alist /volume1/docker/alist-serve-resource
S
Description
No description provided
Readme
436 KiB
Languages
JavaScript 88.6%
Python 10.8%
Shell 0.6%