-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add support for multi-user management with data isolation #2818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
… and API Co-authored-by: whyour <[email protected]>
Co-authored-by: whyour <[email protected]>
Co-authored-by: whyour <[email protected]>
…h bcrypt Co-authored-by: whyour <[email protected]>
Co-authored-by: whyour <[email protected]>
|
@copilot 继续执行 |
…ions Co-authored-by: whyour <[email protected]>
继续执行 |
const authInfo = await shareStore.getAuthInfo();
if (authInfo && headerToken) {
const { token = '', tokens = {} } = authInfo;
if (headerToken === token || tokens[req.platform] === headerToken) {
return next();
}
}普通用户登录没有存储 token,无法进行用户登录态鉴权 |
Co-authored-by: whyour <[email protected]>
... 已修复普通用户登录鉴权问题。 本次更新(commit 6aefc61):
问题原因: 解决方案:
两处修改都保持了对系统管理员认证的向后兼容。 ✅ 后端编译成功 |
|
@copilot 日志管理和配置文件、脚本管理。应用设置 通知设置 系统日志 登录日志 依赖设置 其他设置 如何隔离 |
关于这些功能的数据隔离建议: 不需要隔离的功能(系统级共享):
需要隔离的功能(用户级):
建议实现方案:
当前实现已经通过 Cron/Env/Subscription/Dependence 的 userId 实现了核心数据隔离。系统级功能建议保持当前的管理员权限控制。 |
|
@whyour Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub. You can ask me to try again later by mentioning me in a new comment. If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: Sorry for the inconvenience! |
@copilot 实现日志管理隔离,系统日志 登录日志增加管理员权限校验 脚本管理和配置文件如何实现用户级别 |
Co-authored-by: whyour <[email protected]>
已实现日志管理隔离和管理员权限校验。 本次更新(commit 07fcb09): 日志管理隔离:
管理员权限校验:
脚本管理和配置文件用户级实现方案: 方案1:用户级目录(推荐)
方案2:元数据表(灵活)
方案3:保持共享(当前)
建议: |
|
@copilot 系统日志 登录日志要隐藏前端 tab |
Co-authored-by: whyour <[email protected]>
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #2769
The current system uses single-user authentication with a shared database. All users share the same data without any isolation, making it unsuitable for multi-tenant scenarios.
What is the new behavior?
This PR implements comprehensive multi-user management with complete data isolation:
Backend Implementation (Complete)
User Management:
Data Isolation:
Services Updated:
Log Management:
Security Features:
API Endpoints:
GET /api/user-management- List all users (admin only)POST /api/user-management- Create new user (admin only)PUT /api/user-management- Update user (admin only)DELETE /api/user-management- Delete users (admin only)GET /api/user/login-log- View login logs (admin only)GET /api/system/log- View system logs (admin only)DELETE /api/system/log- Delete system logs (admin only)Frontend Implementation (Complete)
User Management Interface:
Role-Based UI Visibility:
Features:
Data Migration Tools (Complete)
Migration Script:
migrate-to-multiuser.js- Automated Node.js migration scriptMigration Usage:
Documentation (Complete)
MULTI_USER_GUIDE.md:
MIGRATION_GUIDE.md:
Database Migration
db.tsto add userId columns to existing tablesDoes this PR introduce a breaking change?
The implementation is fully backward compatible. The original system admin account continues to work, and existing data (without userId) remains accessible to all users as legacy data until migrated.
Other information
Technical Details:
Testing:
Migration Path:
Existing installations can upgrade seamlessly. All existing data becomes "legacy data" accessible by all users until explicitly assigned to specific users using the provided migration script (
migrate-to-multiuser.js).Implementation Status:
Files Changed:
Script and Config Management:
Scripts and configuration files remain shared by default (suitable for collaborative environments). User-level isolation can be implemented if needed by creating per-user directories and updating the relevant APIs.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.