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

ldap/mad 同步插件,重新同步之前被删除部门,同步异常 #1428

Closed
neronkl opened this issue Nov 28, 2023 · 3 comments
Closed
Labels
canway 需求来源为嘉为侧 Type: bug Something isn't working

Comments

@neronkl
Copy link
Contributor

neronkl commented Nov 28, 2023

用文字描述你遇到的问题
ldap/mad 同步插件,重新同步之前被删除部门,同步异常

重现方法

ldap/mad 同步插件,部门同步异常:

  1. 首次同步成功
  2. 将某个测试部门在ad系统做删除操作, 做第二次同步
  3. 在ad系统重新启用被删除部门, 做第三次重新同步,
  4. 此时的同步会提示该部门的code异常

预期行为

重新启用的部门,同步正常

版本

  • 2.4.3 (2.5.4版本也会存在该问题)

  • 是否是企业版问题?

@neronkl
Copy link
Contributor Author

neronkl commented Nov 28, 2023

经过排查:

  1. 部门入库前,会暂且在内存中保存。
    image
  2. 写入内部前,会和当前enabled=1的部门做比对(更新/新建)
    image
    image

@neronkl
Copy link
Contributor Author

neronkl commented Nov 28, 2023

问题在于,只和enabled=1的部门做比对,而不是当前目录下的所有部门做比对。导致重新激活的部门,入库会产生异常:部门code冲突
django.db.utils.IntegrityError: (1062,"xxxxxxxx’ for key 'code"")

@neronkl neronkl added Type: bug Something isn't working canway 需求来源为嘉为侧 labels Nov 28, 2023
@nannan00
Copy link
Collaborator

参考FAQ: #429 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
canway 需求来源为嘉为侧 Type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants