mirror of
https://github.com/casdoor/casdoor.git
synced 2025-09-10 05:22:55 +08:00
Improve record's User field.
This commit is contained in:
@@ -197,7 +197,7 @@ func (c *ApiController) Login() {
|
|||||||
|
|
||||||
record := object.NewRecord(c.Ctx)
|
record := object.NewRecord(c.Ctx)
|
||||||
record.Organization = application.Organization
|
record.Organization = application.Organization
|
||||||
record.Username = user.Name
|
record.User = user.Name
|
||||||
object.AddRecord(record)
|
object.AddRecord(record)
|
||||||
}
|
}
|
||||||
} else if form.Provider != "" {
|
} else if form.Provider != "" {
|
||||||
@@ -261,7 +261,7 @@ func (c *ApiController) Login() {
|
|||||||
|
|
||||||
record := object.NewRecord(c.Ctx)
|
record := object.NewRecord(c.Ctx)
|
||||||
record.Organization = application.Organization
|
record.Organization = application.Organization
|
||||||
record.Username = user.Name
|
record.User = user.Name
|
||||||
object.AddRecord(record)
|
object.AddRecord(record)
|
||||||
} else {
|
} else {
|
||||||
// Sign up via OAuth
|
// Sign up via OAuth
|
||||||
@@ -306,7 +306,7 @@ func (c *ApiController) Login() {
|
|||||||
|
|
||||||
record := object.NewRecord(c.Ctx)
|
record := object.NewRecord(c.Ctx)
|
||||||
record.Organization = application.Organization
|
record.Organization = application.Organization
|
||||||
record.Username = user.Name
|
record.User = user.Name
|
||||||
object.AddRecord(record)
|
object.AddRecord(record)
|
||||||
}
|
}
|
||||||
//resp = &Response{Status: "ok", Msg: "", Data: res}
|
//resp = &Response{Status: "ok", Msg: "", Data: res}
|
||||||
|
@@ -27,7 +27,7 @@ type Record struct {
|
|||||||
ClientIp string `xorm:"varchar(100)" json:"clientIp"`
|
ClientIp string `xorm:"varchar(100)" json:"clientIp"`
|
||||||
Timestamp string `xorm:"varchar(100)" json:"timestamp"`
|
Timestamp string `xorm:"varchar(100)" json:"timestamp"`
|
||||||
Organization string `xorm:"varchar(100)" json:"organization"`
|
Organization string `xorm:"varchar(100)" json:"organization"`
|
||||||
Username string `xorm:"varchar(100)" json:"username"`
|
User string `xorm:"varchar(100)" json:"user"`
|
||||||
RequestUri string `xorm:"varchar(1000)" json:"requestUri"`
|
RequestUri string `xorm:"varchar(1000)" json:"requestUri"`
|
||||||
Action string `xorm:"varchar(1000)" json:"action"`
|
Action string `xorm:"varchar(1000)" json:"action"`
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,7 @@ func NewRecord(ctx *context.Context) *Record {
|
|||||||
ClientIp: ip,
|
ClientIp: ip,
|
||||||
Timestamp: util.GetCurrentTime(),
|
Timestamp: util.GetCurrentTime(),
|
||||||
RequestUri: ctx.Request.RequestURI,
|
RequestUri: ctx.Request.RequestURI,
|
||||||
Username: "",
|
User: "",
|
||||||
Organization: "",
|
Organization: "",
|
||||||
Action: action,
|
Action: action,
|
||||||
}
|
}
|
||||||
|
@@ -62,7 +62,7 @@ func RecordMessage(ctx *context.Context) {
|
|||||||
|
|
||||||
userId := getUser(ctx)
|
userId := getUser(ctx)
|
||||||
if userId != "" {
|
if userId != "" {
|
||||||
record.Organization, record.Username = util.GetOwnerAndNameFromId(userId)
|
record.Organization, record.User = util.GetOwnerAndNameFromId(userId)
|
||||||
}
|
}
|
||||||
|
|
||||||
object.AddRecord(record)
|
object.AddRecord(record)
|
||||||
|
Reference in New Issue
Block a user