Skip to content
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

应用管理中,将用户移除管理员权限后再为其添加管理员权限会报错 #5306

Open
3 tasks
enchantereye opened this issue Jan 2, 2025 · 2 comments

Comments

@enchantereye
Copy link

描述bug

简洁明了地描述一下bug

复现

通过如下步骤可以复现:

  1. 进入具体应用——管理应用——移除某一账号管理员权限
  2. 确认移除成功后选择刚刚移除的账号重新添加为管理员,点击添加报错

期望

截图

image

额外的细节和日志

  • 版本:java-1.9.2
  • 错误日志
    image
Copy link

dosubot bot commented Jan 2, 2025

@enchantereye 你好!我是Dosu,我是一个能帮你解决bug、回答问题并成为贡献者的机器人。在等待人类维护者的过程中,我会竭诚为你服务。

The "Code: 500" error you're encountering is due to a SQL constraint violation identified as "[UK_UserId_RoleId_DeletedAt]". This occurs because the UserRole table has a unique constraint on the combination of UserId, RoleId, and DeletedAt. When you remove and then re-add a user's admin permissions, if the DeletedAt field is not properly updated, it can violate this unique constraint. The system likely tries to insert a new record with the same UserId and RoleId without correctly handling the DeletedAt field, leading to a conflict with the existing unique index [1].

To resolve this, you may need to ensure that the DeletedAt field is correctly managed when re-adding a user to a role they were previously removed from. This might involve updating or clearing the DeletedAt field appropriately in the database.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@nobodyiam
Copy link
Member

The DeletedAt index constraint was added in 2.0.0, but your database schema appears to be newer than your code version (1.9.2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants