⬆️ Follow the permission nodes naming guidelines

This commit is contained in:
LittleSheep 2024-07-03 23:26:57 +08:00
parent 93285e3ac1
commit 5b8eff7a42
2 changed files with 8 additions and 6 deletions

View File

@ -2,6 +2,9 @@ package api
import ( import (
"fmt" "fmt"
"strings"
"time"
"git.solsynth.dev/hydrogen/interactive/pkg/internal/database" "git.solsynth.dev/hydrogen/interactive/pkg/internal/database"
"git.solsynth.dev/hydrogen/interactive/pkg/internal/gap" "git.solsynth.dev/hydrogen/interactive/pkg/internal/gap"
"git.solsynth.dev/hydrogen/interactive/pkg/internal/models" "git.solsynth.dev/hydrogen/interactive/pkg/internal/models"
@ -10,8 +13,6 @@ import (
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/samber/lo" "github.com/samber/lo"
"strings"
"time"
) )
func getArticle(c *fiber.Ctx) error { func getArticle(c *fiber.Ctx) error {
@ -104,7 +105,7 @@ func listDraftArticle(c *fiber.Ctx) error {
} }
func createArticle(c *fiber.Ctx) error { func createArticle(c *fiber.Ctx) error {
if err := gap.H.EnsureGrantedPerm(c, "CreateArticle", true); err != nil { if err := gap.H.EnsureGrantedPerm(c, "CreateArticles", true); err != nil {
return err return err
} }
user := c.Locals("user").(models.Account) user := c.Locals("user").(models.Account)

View File

@ -2,6 +2,9 @@ package api
import ( import (
"fmt" "fmt"
"strings"
"time"
"git.solsynth.dev/hydrogen/interactive/pkg/internal/database" "git.solsynth.dev/hydrogen/interactive/pkg/internal/database"
"git.solsynth.dev/hydrogen/interactive/pkg/internal/gap" "git.solsynth.dev/hydrogen/interactive/pkg/internal/gap"
"git.solsynth.dev/hydrogen/interactive/pkg/internal/models" "git.solsynth.dev/hydrogen/interactive/pkg/internal/models"
@ -10,8 +13,6 @@ import (
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/samber/lo" "github.com/samber/lo"
"strings"
"time"
) )
func getPost(c *fiber.Ctx) error { func getPost(c *fiber.Ctx) error {
@ -105,7 +106,7 @@ func listDraftPost(c *fiber.Ctx) error {
} }
func createPost(c *fiber.Ctx) error { func createPost(c *fiber.Ctx) error {
if err := gap.H.EnsureGrantedPerm(c, "CreatePost", true); err != nil { if err := gap.H.EnsureGrantedPerm(c, "CreatePosts", true); err != nil {
return err return err
} }
user := c.Locals("user").(models.Account) user := c.Locals("user").(models.Account)