Add logPostOnly.

This commit is contained in:
Gucheng Wang
2021-11-09 23:32:53 +08:00
parent 102e22f2c7
commit 21f433d278
2 changed files with 18 additions and 0 deletions

View File

@ -17,10 +17,21 @@ package object
import (
"strings"
"github.com/astaxie/beego"
"github.com/astaxie/beego/context"
"github.com/casbin/casdoor/util"
)
var logPostOnly bool
func init() {
var err error
logPostOnly, err = beego.AppConfig.Bool("logPostOnly")
if err != nil {
panic(err)
}
}
type Record struct {
Id int `xorm:"int notnull pk autoincr" json:"id"`
@ -56,6 +67,12 @@ func NewRecord(ctx *context.Context) *Record {
}
func AddRecord(record *Record) bool {
if logPostOnly {
if record.Method == "GET" {
return false
}
}
record.Owner = record.Organization
errWebhook := SendWebhooks(record)