Revert "♻️ Move models.Account to sec.UserInfo" for a better solution

This reverts commit 8fbb7960
This commit is contained in:
2024-10-31 00:17:53 +08:00
parent 69c6ac6581
commit 2fcc784bc4
35 changed files with 192 additions and 286 deletions

View File

@ -6,7 +6,6 @@ import (
"git.solsynth.dev/hydrogen/passport/pkg/internal/database"
"git.solsynth.dev/hydrogen/passport/pkg/internal/http/exts"
"git.solsynth.dev/hydrogen/passport/pkg/internal/services"
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
"github.com/gofiber/fiber/v2"
)
@ -54,7 +53,7 @@ func forceConfirmAccount(c *fiber.Ctx) error {
if err := exts.EnsureGrantedPerm(c, "AdminUserConfirmation", true); err != nil {
return err
}
operator := c.Locals("user").(*sec.UserInfo)
operator := c.Locals("user").(models.Account)
var user models.Account
if err := database.C.Where("id = ?", userId).First(&user).Error; err != nil {
@ -64,7 +63,7 @@ func forceConfirmAccount(c *fiber.Ctx) error {
if err := services.ForceConfirmAccount(user); err != nil {
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
} else {
services.AddAuditRecord(operator.ID, "user.confirm", c.IP(), c.Get(fiber.HeaderUserAgent), map[string]any{
services.AddAuditRecord(operator, "user.confirm", c.IP(), c.Get(fiber.HeaderUserAgent), map[string]any{
"user_id": user.ID,
})
}