mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-05-07 20:41:26 +08:00
[优化] 更新kit包
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"log"
|
||||
"pandax/apps/system/entity"
|
||||
"pandax/apps/system/services"
|
||||
"pandax/pkg/global"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
@@ -121,5 +122,6 @@ func (s *SystemApiApi) GetAllApis(rc *ginx.ReqCtx) {
|
||||
func (s *SystemApiApi) GetPolicyPathByRoleId(rc *ginx.ReqCtx) {
|
||||
roleKey := rc.GinCtx.Query("roleKey")
|
||||
tenantId := strconv.Itoa(int(rc.LoginAccount.TenantId))
|
||||
rc.ResData = casbin.GetPolicyPathByRoleId(tenantId, roleKey)
|
||||
ca := casbin.CasbinS{ModelPath: global.Conf.Casbin.ModelPath}
|
||||
rc.ResData = ca.GetPolicyPathByRoleId(tenantId, roleKey)
|
||||
}
|
||||
|
||||
@@ -88,7 +88,8 @@ func (r *RoleApi) InsertRole(rc *ginx.ReqCtx) {
|
||||
r.RoleMenuApp.Insert(insert.RoleId, role.MenuIds)
|
||||
//添加权限
|
||||
tenantId := strconv.Itoa(int(rc.LoginAccount.TenantId))
|
||||
casbin.UpdateCasbin(tenantId, role.RoleKey, role.ApiIds)
|
||||
ca := casbin.CasbinS{ModelPath: global.Conf.Casbin.ModelPath}
|
||||
ca.UpdateCasbin(tenantId, role.RoleKey, role.ApiIds)
|
||||
}
|
||||
|
||||
// @Summary 修改用户角色
|
||||
@@ -112,7 +113,8 @@ func (r *RoleApi) UpdateRole(rc *ginx.ReqCtx) {
|
||||
r.RoleMenuApp.Insert(role.RoleId, role.MenuIds)
|
||||
//修改api权限
|
||||
tenantId := strconv.Itoa(int(rc.LoginAccount.TenantId))
|
||||
casbin.UpdateCasbin(tenantId, role.RoleKey, role.ApiIds)
|
||||
ca := casbin.CasbinS{ModelPath: global.Conf.Casbin.ModelPath}
|
||||
ca.UpdateCasbin(tenantId, role.RoleKey, role.ApiIds)
|
||||
}
|
||||
|
||||
// @Summary 修改用户角色状态
|
||||
@@ -176,7 +178,8 @@ func (r *RoleApi) DeleteRole(rc *ginx.ReqCtx) {
|
||||
if len(*list) == 0 {
|
||||
delList = append(delList, rid)
|
||||
//删除角色绑定api
|
||||
casbin.ClearCasbin(0, role.RoleKey)
|
||||
ca := casbin.CasbinS{ModelPath: global.Conf.Casbin.ModelPath}
|
||||
ca.ClearCasbin(0, role.RoleKey)
|
||||
} else {
|
||||
global.Log.Info(fmt.Sprintf("role:%d 存在用户无法删除", rid))
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/kakuilan/kgo"
|
||||
"net/http"
|
||||
"pandax/pkg/middleware"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
@@ -72,7 +73,7 @@ func (s *System) ConnectWs(g *gin.Context) {
|
||||
}
|
||||
// 权限校验
|
||||
rc := ginx.NewReqCtx(g)
|
||||
if err = ginx.PermissionHandler(rc); err != nil {
|
||||
if err = middleware.PermissionHandler(rc); err != nil {
|
||||
panic(any(biz.NewBizErr("没有权限")))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user