improve ModGroup to perform NOP

This commit is contained in:
Arthur Lu 2024-10-15 21:34:34 +00:00
parent ca0832a010
commit 0689ee46fd
2 changed files with 16 additions and 2 deletions

View File

@ -278,7 +278,22 @@ func (l LDAPClient) AddGroup(gid string, group Group) (int, gin.H) {
}
func (l LDAPClient) ModGroup(gid string, group Group) (int, gin.H) {
return 200, gin.H{
modifyRequest := ldap.NewModifyRequest(
fmt.Sprintf("cn=%s,%s", gid, l.groupsdn),
nil,
)
modifyRequest.Replace("cn", []string{gid})
err := l.client.Modify(modifyRequest)
if err != nil {
return http.StatusBadRequest, gin.H{
"ok": false,
"error": err,
}
}
return http.StatusOK, gin.H{
"ok": true,
"error": nil,
}

1
go.mod
View File

@ -31,7 +31,6 @@ require (
github.com/gorilla/sessions v1.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
github.com/knz/go-libedit v1.10.1 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect