Support app user in API authentication

This commit is contained in:
Yang Luo 2023-10-15 15:20:57 +08:00
parent 1055d7781b
commit 150e3e30d5

View File

@ -96,6 +96,13 @@ func (c *ApiController) RequireSignedInUser() (*object.User, bool) {
return nil, false
}
if strings.HasPrefix(userId, "app/") {
tmpUserId := c.Input().Get("userId")
if tmpUserId != "" {
userId = tmpUserId
}
}
user, err := object.GetUser(userId)
if err != nil {
c.ResponseError(err.Error())