diff --git a/conf/app.conf b/conf/app.conf index e019b2da..0d4f56e8 100644 --- a/conf/app.conf +++ b/conf/app.conf @@ -12,4 +12,5 @@ authState = "casdoor" httpProxy = "127.0.0.1:10808" verificationCodeTimeout = 10 initScore = 2000 +logPostOnly = true oidcOrigin = "https://door.casbin.com" \ No newline at end of file diff --git a/object/record.go b/object/record.go index 199a5b74..2c54897d 100644 --- a/object/record.go +++ b/object/record.go @@ -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)