feat: implement automatic synchronization for ldap users (#371)

Signed-off-by: Товарищ программист <2962928213@qq.com>
This commit is contained in:
Товарищ программист
2021-12-15 17:45:11 +08:00
committed by GitHub
parent 4ca5f4b196
commit f43d01c5c2
5 changed files with 157 additions and 6 deletions

View File

@ -151,6 +151,9 @@ func (c *ApiController) AddLdap() {
if affected {
resp.Data2 = ldap
}
if ldap.AutoSync != 0 {
object.GetLdapAutoSynchronizer().StartAutoSync(ldap.Id)
}
c.Data["json"] = resp
c.ServeJSON()
@ -172,6 +175,9 @@ func (c *ApiController) UpdateLdap() {
if affected {
resp.Data2 = ldap
}
if ldap.AutoSync != 0 {
object.GetLdapAutoSynchronizer().StartAutoSync(ldap.Id)
}
c.Data["json"] = resp
c.ServeJSON()
@ -187,6 +193,7 @@ func (c *ApiController) DeleteLdap() {
panic(err)
}
object.GetLdapAutoSynchronizer().StopAutoSync(ldap.Id)
c.Data["json"] = wrapActionResponse(object.DeleteLdap(&ldap))
c.ServeJSON()
}