Features - User Management (Phase 4.1): - Database: Add user_modules table for fine-grained module permissions - Database: Add 4 user permissions (view/create/edit/delete) to role_permissions - Backend: UserService (780 lines) - CRUD with tenant isolation - Backend: UserController + UserRoutes (648 lines) - 13 API endpoints - Backend: Batch import users from Excel - Frontend: UserListPage (412 lines) - list/filter/search/pagination - Frontend: UserFormPage (341 lines) - create/edit with module config - Frontend: UserDetailPage (393 lines) - details/tenant/module management - Frontend: 3 modal components (592 lines) - import/assign/configure - API: GET/POST/PUT/DELETE /api/admin/users/* endpoints Architecture Upgrade - Module Permission System: - Backend: Add getUserModules() method in auth.service - Backend: Login API returns modules array in user object - Frontend: AuthContext adds hasModule() method - Frontend: Navigation filters modules based on user.modules - Frontend: RouteGuard checks requiredModule instead of requiredVersion - Frontend: Remove deprecated version-based permission system - UX: Only show accessible modules in navigation (clean UI) - UX: Smart redirect after login (avoid 403 for regular users) Fixes: - Fix UTF-8 encoding corruption in ~100 docs files - Fix pageSize type conversion in userService (String to Number) - Fix authUser undefined error in TopNavigation - Fix login redirect logic with role-based access check - Update Git commit guidelines v1.2 with UTF-8 safety rules Database Changes: - CREATE TABLE user_modules (user_id, tenant_id, module_code, is_enabled) - ADD UNIQUE CONSTRAINT (user_id, tenant_id, module_code) - INSERT 4 permissions + role assignments - UPDATE PUBLIC tenant with 8 module subscriptions Technical: - Backend: 5 new files (~2400 lines) - Frontend: 10 new files (~2500 lines) - Docs: 1 development record + 2 status updates + 1 guideline update - Total: ~4900 lines of code Status: User management 100% complete, module permission system operational
148 lines
3.3 KiB
YAML
148 lines
3.3 KiB
YAML
# REDCap Docker Compose 配置 - 开发环境
|
||
# 版本:v1.0
|
||
# 日期:2026-01-01
|
||
# 用途:本地开发环境(包含phpMyAdmin调试工具)
|
||
# 生产环境请使用:docker-compose.prod.yml
|
||
|
||
version: '3.8'
|
||
|
||
services:
|
||
# ========== MySQL 8.0 数据库 ==========
|
||
redcap-db:
|
||
image: mysql:8.0
|
||
container_name: redcap-mysql
|
||
restart: unless-stopped
|
||
environment:
|
||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
||
MYSQL_DATABASE: ${MYSQL_DATABASE}
|
||
MYSQL_USER: ${MYSQL_USER}
|
||
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
|
||
volumes:
|
||
# 数据持久化(Docker命名卷)
|
||
- redcap-db-data:/var/lib/mysql
|
||
ports:
|
||
# 暴露端口(可选,调试用)
|
||
- "3306:3306"
|
||
networks:
|
||
- redcap-network
|
||
command: --default-authentication-plugin=mysql_native_password
|
||
healthcheck:
|
||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${MYSQL_ROOT_PASSWORD}"]
|
||
interval: 10s
|
||
timeout: 5s
|
||
retries: 5
|
||
|
||
# ========== REDCap Web服务 (Apache + PHP 8.1 + REDCap) ==========
|
||
redcap-web:
|
||
build:
|
||
context: .
|
||
dockerfile: Dockerfile.redcap
|
||
container_name: redcap-apache
|
||
restart: unless-stopped
|
||
ports:
|
||
- "8080:80"
|
||
volumes:
|
||
# REDCap源代码(只读)
|
||
- ../redcap15.8.0/redcap:/var/www/html/redcap:ro
|
||
|
||
# 配置文件
|
||
- ./config/apache/redcap.conf:/etc/apache2/sites-available/000-default.conf:ro
|
||
- ./config/php/php.ini:/usr/local/etc/php/php.ini:ro
|
||
- ./config/database.php:/var/www/html/redcap/database.php:ro
|
||
|
||
# 持久化数据(可读写)
|
||
- redcap-edocs:/var/www/html/redcap/edocs
|
||
- redcap-modules:/var/www/html/redcap/modules
|
||
- redcap-temp:/var/www/html/redcap/temp
|
||
environment:
|
||
# 数据库连接信息
|
||
REDCAP_DB_HOST: redcap-db
|
||
REDCAP_DB_PORT: 3306
|
||
REDCAP_DB_NAME: ${MYSQL_DATABASE}
|
||
REDCAP_DB_USER: ${MYSQL_USER}
|
||
REDCAP_DB_PASS: ${MYSQL_PASSWORD}
|
||
|
||
# PHP配置
|
||
TZ: Asia/Shanghai
|
||
networks:
|
||
- redcap-network
|
||
depends_on:
|
||
redcap-db:
|
||
condition: service_healthy
|
||
healthcheck:
|
||
test: ["CMD", "curl", "-f", "http://localhost/"]
|
||
interval: 30s
|
||
timeout: 10s
|
||
retries: 3
|
||
|
||
# ========== phpMyAdmin (可选,仅开发环境) ==========
|
||
phpmyadmin:
|
||
image: phpmyadmin/phpmyadmin:latest
|
||
container_name: redcap-phpmyadmin
|
||
restart: unless-stopped
|
||
environment:
|
||
PMA_HOST: redcap-db
|
||
PMA_PORT: 3306
|
||
PMA_USER: root
|
||
PMA_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
||
UPLOAD_LIMIT: 50M
|
||
ports:
|
||
- "8081:80"
|
||
networks:
|
||
- redcap-network
|
||
depends_on:
|
||
- redcap-db
|
||
# 注意:生产环境应移除此服务(安全考虑)
|
||
|
||
# ========== 网络配置 ==========
|
||
networks:
|
||
redcap-network:
|
||
driver: bridge
|
||
name: redcap-network
|
||
|
||
# ========== 数据卷配置 ==========
|
||
volumes:
|
||
# MySQL数据(持久化)
|
||
redcap-db-data:
|
||
name: redcap-db-data
|
||
driver: local
|
||
|
||
# REDCap上传文件(持久化)
|
||
redcap-edocs:
|
||
name: redcap-edocs
|
||
driver: local
|
||
|
||
# External Modules(持久化)
|
||
redcap-modules:
|
||
name: redcap-modules
|
||
driver: local
|
||
|
||
# 临时文件(可定期清理)
|
||
redcap-temp:
|
||
name: redcap-temp
|
||
driver: local
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|