Check permissions GRPC method

This commit is contained in:
2024-05-17 20:14:20 +08:00
parent 73b57164ab
commit 1e2d5e9f9d
7 changed files with 266 additions and 45 deletions

View File

@ -42,12 +42,12 @@ func authFunc(c *fiber.Ctx, overrides ...string) error {
}
rtk := c.Cookies(services.CookieRefreshKey)
if user, perms, atk, rtk, err := services.Authenticate(token, rtk, 0); err == nil {
if ctx, perms, atk, rtk, err := services.Authenticate(token, rtk, 0); err == nil {
if atk != token {
services.SetJwtCookieSet(c, atk, rtk)
}
c.Locals("permissions", perms)
c.Locals("principal", user)
c.Locals("principal", ctx.Account)
return nil
} else {
return err