Skip to content

Commit

Permalink
fix: Fix casbin mod and menu data
Browse files Browse the repository at this point in the history
  • Loading branch information
LyricTian committed Nov 14, 2023
1 parent 24a13c3 commit 3175278
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 223 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

NOW = $(shell date -u '+%Y%m%d%I%M%S')

RELEASE_VERSION = v10.0.0
RELEASE_VERSION = v10.0.1

APP = ginadmin
SERVER_BIN = ${APP}
Expand Down
235 changes: 26 additions & 209 deletions configs/menu.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion configs/rbac_model.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ e = some(where (p.eft == allow)) # Passes auth if any of the policies allows
g = _, _

[matchers]
m = g(r.sub, p.sub) && r.sub == p.sub && keyMatch2(r.obj, p.obj) && r.act == p.act
m = g(r.sub, p.sub) && r.sub == p.sub && (keyMatch2(r.obj, p.obj) || keyMatch3(r.obj, p.obj)) && r.act == p.act
2 changes: 1 addition & 1 deletion internal/bootstrap/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func initLoggerHook(_ context.Context, cfg *logging.HookConfig) (*logging.Hook,
MaxIdleTime: cast.ToInt(cfg.Options["MaxIdleTime"]),
MaxOpenConns: cast.ToInt(cfg.Options["MaxOpenConns"]),
MaxIdleConns: cast.ToInt(cfg.Options["MaxIdleConns"]),
TablePrefix: cast.ToString(cfg.Options["TablePrefix"]),
TablePrefix: config.C.Storage.DB.TablePrefix,
})
if err != nil {
return nil, err
Expand Down
3 changes: 1 addition & 2 deletions internal/mods/sys/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"

"github.com/LyricTian/gin-admin/v10/internal/mods/sys/api"
"github.com/LyricTian/gin-admin/v10/internal/mods/sys/schema"
"github.com/gin-gonic/gin"
"gorm.io/gorm"
)
Expand All @@ -15,7 +14,7 @@ type SYS struct {
}

func (a *SYS) AutoMigrate(ctx context.Context) error {
return a.DB.AutoMigrate(new(schema.Logger))
return a.DB.AutoMigrate()
}

func (a *SYS) Init(ctx context.Context) error {
Expand Down
3 changes: 2 additions & 1 deletion internal/mods/sys/schema/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package schema
import (
"time"

"github.com/LyricTian/gin-admin/v10/internal/config"
"github.com/LyricTian/gin-admin/v10/pkg/util"
)

Expand All @@ -22,7 +23,7 @@ type Logger struct {
}

func (a *Logger) TableName() string {
return "logger"
return config.C.FormatTableName("logger")
}

// Defining the query parameters for the `Logger` struct.
Expand Down
2 changes: 1 addition & 1 deletion internal/swagger/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/swagger/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "A lightweight, flexible, elegant and full-featured RBAC scaffolding based on GIN + GORM 2.0 + Casbin 2.0 + Wire DI.",
"title": "ginadmin",
"contact": {},
"version": "v10.0.0"
"version": "v10.0.1"
},
"paths": {
"/api/v1/captcha/id": {
Expand Down
2 changes: 1 addition & 1 deletion internal/swagger/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ info:
description: A lightweight, flexible, elegant and full-featured RBAC scaffolding
based on GIN + GORM 2.0 + Casbin 2.0 + Wire DI.
title: ginadmin
version: v10.0.0
version: v10.0.1
paths:
/api/v1/captcha/id:
get:
Expand Down
10 changes: 7 additions & 3 deletions internal/swagger/v3/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"contact" : { },
"description" : "A lightweight, flexible, elegant and full-featured RBAC scaffolding based on GIN + GORM 2.0 + Casbin 2.0 + Wire DI.",
"title" : "ginadmin",
"version" : "v10.0.0"
"version" : "v10.0.1"
},
"servers" : [ {
"url" : "/"
Expand Down Expand Up @@ -379,9 +379,9 @@
"type" : "string"
}
}, {
"description" : "user ID",
"description" : "user name",
"in" : "query",
"name" : "userID",
"name" : "userName",
"schema" : {
"type" : "string"
}
Expand Down Expand Up @@ -1505,6 +1505,10 @@
"description" : "Log level",
"type" : "string"
},
"login_name" : {
"description" : "From User.Username",
"type" : "string"
},
"message" : {
"description" : "Log message",
"type" : "string"
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
)

// Usage: go build -ldflags "-X main.VERSION=x.x.x"
var VERSION = "v10.0.0"
var VERSION = "v10.0.1"

// @title ginadmin
// @version v10.0.0
// @version v10.0.1
// @description A lightweight, flexible, elegant and full-featured RBAC scaffolding based on GIN + GORM 2.0 + Casbin 2.0 + Wire DI.
// @securityDefinitions.apikey ApiKeyAuth
// @in header
Expand Down

0 comments on commit 3175278

Please sign in to comment.