From 150e3e30d5103a88bd3ad8d026d4538709f18893 Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Sun, 15 Oct 2023 15:20:57 +0800 Subject: [PATCH] Support app user in API authentication --- controllers/util.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/controllers/util.go b/controllers/util.go index 6f8a922f..e1916354 100644 --- a/controllers/util.go +++ b/controllers/util.go @@ -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())