feat: Phase 3 FBA UI 预构建产物 + Phase 4 按钮级权限(fba_jwt + perms)(Epic #159)
This commit is contained in:
+26
-3
@@ -86,9 +86,32 @@ docker exec -it fba_postgres psql -U postgres -d fba # 进数据库
|
||||
脚本幂等:注册 iAOP 6 模块菜单(含子菜单)、创建 `engineer`/`viewer`
|
||||
角色并按 PRD 8.2 分配菜单。之后在 FBA 后台给用户分配角色即可。
|
||||
未播种时前端自动降级为本地角色过滤,菜单不会空白。
|
||||
- **Phase 3**:FBA UI(Vue3 + AntDV)构建时设置
|
||||
`VITE_GLOB_API_URL=http://<域名>/fba`,产物由 nginx 挂在 `/fba-admin/`,
|
||||
作为用户/角色/菜单管理界面。
|
||||
- **Phase 3**:FBA UI(Vue3 + AntDV)管理界面已预构建,产物在
|
||||
`deploy/fba/artifacts/fba-ui-dist.tar.gz`(构建参数 `VITE_BASE=/fba-admin/`、
|
||||
`VITE_GLOB_API_URL=http://39.101.182.167:8090/fba`)。部署:
|
||||
```bash
|
||||
cd /opt/apps/iAOP
|
||||
mkdir -p deploy/fba/fba-ui
|
||||
tar -xzf deploy/fba/artifacts/fba-ui-dist.tar.gz -C deploy/fba/fba-ui/
|
||||
# 确认 nginx 已 include 最新 nginx-fba.conf(含 /fba-admin/ 段)后 reload
|
||||
nginx -t && nginx -s reload
|
||||
```
|
||||
入口 `http://39.101.182.167:8090/fba-admin/`,用 FBA 账号登录即可管理
|
||||
用户/角色/菜单/日志。iAOP 顶栏对 admin 角色提供「系统管理」直达链接。
|
||||
若需重新构建(如换域名):改 `fba-ui/apps/web-antdv-next/.env.production`
|
||||
后 `pnpm --filter @vben/web-antdv-next build`(Vben5 monorepo,需 pnpm)。
|
||||
- **Phase 4**:业务接口按钮级权限。
|
||||
- 前端:`IAOP_SESSION.perms()` / `hasPerm(code)` 读取 FBA `/auth/codes`
|
||||
权限码(超管自动拥有全部;菜单播种时已写入 `iaop:<module>`)。
|
||||
- 后端:`core/auth/fba_jwt.py` 提供零依赖 HS256 校验器 `FbaAuth`
|
||||
(与 FBA 的 JWT 同构:claims = sub/session_uuid/exp,密钥取环境变量
|
||||
`FBA_TOKEN_SECRET_KEY`,**必须与 fba.env 的 TOKEN_SECRET_KEY 一致**)。
|
||||
业务服务内 `FbaAuth.from_env()` 返回 None 时走旧 core/auth 会话(双轨过渡)。
|
||||
按钮级校验用 `fba.require_perm(authorization, "iaop:xxx")`(回源
|
||||
`/auth/codes`,带 5 分钟内存缓存)。
|
||||
- 单元测试:`python -m unittest core.auth.tests.test_fba_jwt -v`(8 例全过)。
|
||||
- **Phase 5**:收尾。待全部 Phase 部署验收后:旧 core/auth 登录轨与
|
||||
UserStore 本地账号降级保留为演示模式;生产环境以 FBA 为唯一认证源。
|
||||
|
||||
## 注意事项
|
||||
|
||||
|
||||
Binary file not shown.
@@ -34,3 +34,33 @@ location /fba/ {
|
||||
|
||||
proxy_read_timeout 60s;
|
||||
}
|
||||
|
||||
# =============================================================================
|
||||
# Phase 3:FBA UI 静态站点(用户/角色/菜单/日志管理界面)
|
||||
#
|
||||
# 部署:将 deploy/fba/artifacts/fba-ui-dist.tar.gz 解压到
|
||||
# /opt/apps/iAOP/deploy/fba/fba-ui/(解压后应存在 fba-ui/dist/index.html)
|
||||
# tar -xzf deploy/fba/artifacts/fba-ui-dist.tar.gz -C deploy/fba/fba-ui/
|
||||
#
|
||||
# 产物构建参数(已固化在包内):
|
||||
# VITE_BASE=/fba-admin/
|
||||
# VITE_GLOB_API_URL=http://39.101.182.167:8090/fba
|
||||
# 入口:http://39.101.182.167:8090/fba-admin/
|
||||
# =============================================================================
|
||||
|
||||
location /fba-admin/ {
|
||||
alias /opt/apps/iAOP/deploy/fba/fba-ui/dist/;
|
||||
index index.html;
|
||||
|
||||
# SPA 路由回退(hash 模式下 mostly 用不到,兜底)
|
||||
try_files $uri $uri/ /fba-admin/index.html;
|
||||
|
||||
# 带 hash 的静态资源长缓存;index.html 不缓存
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|svg|woff2?)$ {
|
||||
expires 7d;
|
||||
add_header Cache-Control "public";
|
||||
}
|
||||
location = /fba-admin/index.html {
|
||||
add_header Cache-Control "no-cache";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user