diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 6e686be..9026300 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,45 +4,10 @@ - @@ -214,7 +178,8 @@ - true diff --git a/pkg/internal/http/api/accounts_api.go b/pkg/internal/http/api/accounts_api.go index 6298480..5c15d37 100644 --- a/pkg/internal/http/api/accounts_api.go +++ b/pkg/internal/http/api/accounts_api.go @@ -60,7 +60,7 @@ func getUserinfo(c *fiber.Ctx) error { First(&data).Error; err != nil { return fiber.NewError(fiber.StatusInternalServerError, err.Error()) } else { - data.PermNodes = c.Locals("permissions").(map[string]any) + data.PermNodes = user.PermNodes } var resp fiber.Map diff --git a/pkg/internal/http/exts/auth.go b/pkg/internal/http/exts/auth.go index b4d911f..a2b0e15 100644 --- a/pkg/internal/http/exts/auth.go +++ b/pkg/internal/http/exts/auth.go @@ -19,7 +19,7 @@ func EnsureGrantedPerm(c *fiber.Ctx, key string, val any) error { if err := EnsureAuthenticated(c); err != nil { return err } - perms := c.Locals("permissions").(map[string]any) + perms := c.Locals("user").(*sec.UserInfo).PermNodes if !services.HasPermNode(perms, key, val) { return fiber.NewError(fiber.StatusForbidden, fmt.Sprintf("missing permission: %s", key)) }