mirror of
https://github.com/Li4n0/revsuit.git
synced 2026-09-25 08:01:54 +08:00
feat(ldap): add ldap protocol support (#50)
Co-authored-by: tardc <[email protected]> Co-authored-by: E99p1ant <[email protected]>
This commit is contained in:
+3
-13
@@ -102,10 +102,7 @@ func ListRules(c *gin.Context) {
|
||||
}
|
||||
|
||||
db := database.DB.Model(&httpRule)
|
||||
if httpRule.Name != "" {
|
||||
db.Where("name = ?", httpRule.Name)
|
||||
}
|
||||
db.Count(&count)
|
||||
db.Where(&httpRule).Count(&count)
|
||||
|
||||
page, err := strconv.Atoi(c.Query("page"))
|
||||
if err != nil {
|
||||
@@ -139,10 +136,7 @@ func ListRules(c *gin.Context) {
|
||||
|
||||
// UpsertRules create or update http rule from user submit
|
||||
func UpsertRules(c *gin.Context) {
|
||||
var (
|
||||
httpRule Rule
|
||||
update bool
|
||||
)
|
||||
var httpRule Rule
|
||||
|
||||
if err := c.ShouldBind(&httpRule); err != nil {
|
||||
c.JSON(400, gin.H{
|
||||
@@ -153,10 +147,6 @@ func UpsertRules(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if httpRule.ID != 0 {
|
||||
update = true
|
||||
}
|
||||
|
||||
if err := httpRule.CreateOrUpdate(); err != nil {
|
||||
c.JSON(400, gin.H{
|
||||
"status": "failed",
|
||||
@@ -166,7 +156,7 @@ func UpsertRules(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if update {
|
||||
if httpRule.ID != 0 {
|
||||
log.Trace("HTTP rule[id:%d] has been updated", httpRule.ID)
|
||||
} else {
|
||||
log.Trace("HTTP rule[id:%d] has been created", httpRule.ID)
|
||||
|
||||
Reference in New Issue
Block a user