Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FLIPPED-AURORA
gin-vue-admin
提交
4724cec4
G
gin-vue-admin
项目概览
FLIPPED-AURORA
/
gin-vue-admin
大约 1 年 前同步成功
通知
332
Star
18154
Fork
5505
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gin-vue-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4724cec4
编写于
2月 21, 2022
作者:
Mr.奇淼(
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
casbin结构修改为三方包内部结构,避免升级冲突。
上级
887ddae8
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
3 addition
and
19 deletion
+3
-19
server/core/server.go
server/core/server.go
+0
-1
server/initialize/router.go
server/initialize/router.go
+1
-1
server/model/system/sys_casbin.go
server/model/system/sys_casbin.go
+0
-8
server/service/system/sys_casbin.go
server/service/system/sys_casbin.go
+2
-9
未找到文件。
server/core/server.go
浏览文件 @
4724cec4
...
...
@@ -26,7 +26,6 @@ func RunWindowsServer() {
}
Router
:=
initialize
.
Routers
()
Router
.
Static
(
"/form-generator"
,
"./resource/page"
)
address
:=
fmt
.
Sprintf
(
":%d"
,
global
.
GVA_CONFIG
.
System
.
Addr
)
...
...
server/initialize/router.go
浏览文件 @
4724cec4
...
...
@@ -27,7 +27,7 @@ func Routers() *gin.Engine {
// Router.StaticFile("/", "./dist/index.html") // 前端网页入口页面
Router
.
StaticFS
(
global
.
GVA_CONFIG
.
Local
.
Path
,
http
.
Dir
(
global
.
GVA_CONFIG
.
Local
.
Path
))
// 为用户头像和文件提供静态地址
// Router.Use(middleware.LoadTls()) //
打开就能玩https了
// Router.Use(middleware.LoadTls()) //
如果需要使用https 请打开此中间件 然后前往 core/server.go 将启动模式 更变为 Router.RunTLS("端口","你的cre/pem文件","你的key文件")
global
.
GVA_LOG
.
Info
(
"use middleware logger"
)
// 跨域,如需跨域可以打开下面的注释
// Router.Use(middleware.Cors()) // 直接放行全部跨域请求
...
...
server/model/system/sys_casbin.go
已删除
100644 → 0
浏览文件 @
887ddae8
package
system
type
CasbinModel
struct
{
Ptype
string
`json:"ptype" gorm:"column:ptype"`
AuthorityId
string
`json:"rolename" gorm:"column:v0"`
Path
string
`json:"path" gorm:"column:v1"`
Method
string
`json:"method" gorm:"column:v2"`
}
server/service/system/sys_casbin.go
浏览文件 @
4724cec4
...
...
@@ -7,7 +7,6 @@ import (
"github.com/casbin/casbin/v2"
gormadapter
"github.com/casbin/gorm-adapter/v3"
"github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
"github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
_
"github.com/go-sql-driver/mysql"
)
...
...
@@ -26,13 +25,7 @@ func (casbinService *CasbinService) UpdateCasbin(authorityId string, casbinInfos
casbinService
.
ClearCasbin
(
0
,
authorityId
)
rules
:=
[][]
string
{}
for
_
,
v
:=
range
casbinInfos
{
cm
:=
system
.
CasbinModel
{
Ptype
:
"p"
,
AuthorityId
:
authorityId
,
Path
:
v
.
Path
,
Method
:
v
.
Method
,
}
rules
=
append
(
rules
,
[]
string
{
cm
.
AuthorityId
,
cm
.
Path
,
cm
.
Method
})
rules
=
append
(
rules
,
[]
string
{
authorityId
,
v
.
Path
,
v
.
Method
})
}
e
:=
casbinService
.
Casbin
()
success
,
_
:=
e
.
AddPolicies
(
rules
)
...
...
@@ -49,7 +42,7 @@ func (casbinService *CasbinService) UpdateCasbin(authorityId string, casbinInfos
//@return: error
func
(
casbinService
*
CasbinService
)
UpdateCasbinApi
(
oldPath
string
,
newPath
string
,
oldMethod
string
,
newMethod
string
)
error
{
err
:=
global
.
GVA_DB
.
Table
(
"casbin_rule"
)
.
Model
(
&
system
.
CasbinModel
{})
.
Where
(
"v1 = ? AND v2 = ?"
,
oldPath
,
oldMethod
)
.
Updates
(
map
[
string
]
interface
{}{
err
:=
global
.
GVA_DB
.
Model
(
&
gormadapter
.
CasbinRule
{})
.
Where
(
"v1 = ? AND v2 = ?"
,
oldPath
,
oldMethod
)
.
Updates
(
map
[
string
]
interface
{}{
"v1"
:
newPath
,
"v2"
:
newMethod
,
})
.
Error
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录