rewrite using net/http
This commit is contained in:
1 parent
67a6cdffa3
commit
b97524d1ae
6 files changed
+236
-248
No files matched your search
+3
-4
@@ -5,7 +5,6 @@ import (
|
||||
"net/http"
|
||||
"regexp"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-ldap/ldap/v3"
|
||||
|
||||
common "access-manager-api/app/common"
|
||||
@@ -23,17 +22,17 @@ func LDAPEntryToGroup(entry *ldap.Entry) common.Group {
|
||||
return common.Group{}
|
||||
}
|
||||
|
||||
func ParseLDAPError(err error) gin.H {
|
||||
func ParseLDAPError(err error) map[string]any {
|
||||
if err != nil {
|
||||
LDAPerr := err.(*ldap.Error)
|
||||
return gin.H{
|
||||
return map[string]any{
|
||||
"ok": false,
|
||||
"code": LDAPerr.ResultCode,
|
||||
"result": ldap.LDAPResultCodeMap[LDAPerr.ResultCode],
|
||||
"message": LDAPerr.Err.Error(),
|
||||
}
|
||||
} else {
|
||||
return gin.H{
|
||||
return map[string]any{
|
||||
"ok": true,
|
||||
"code": http.StatusOK,
|
||||
"result": "OK",
|
||||
|
||||
Reference in new issue
Block a user