mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 10:58:35 +08:00
去除权限中的租户
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
||||
entity "pandax/apps/system/entity"
|
||||
services "pandax/apps/system/services"
|
||||
"pandax/pkg/global"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type SystemApiApi struct {
|
||||
@@ -61,7 +60,6 @@ func (s *SystemApiApi) GetAllApis(rc *restfulx.ReqCtx) {
|
||||
|
||||
func (s *SystemApiApi) GetPolicyPathByRoleId(rc *restfulx.ReqCtx) {
|
||||
roleKey := rc.Request.QueryParameter("roleKey")
|
||||
tenantId := strconv.Itoa(int(rc.LoginAccount.TenantId))
|
||||
ca := casbin.CasbinS{ModelPath: global.Conf.Casbin.ModelPath}
|
||||
rc.ResData = ca.GetPolicyPathByRoleId(tenantId, roleKey)
|
||||
rc.ResData = ca.GetPolicyPathByRoleId(roleKey)
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
entity "pandax/apps/system/entity"
|
||||
services "pandax/apps/system/services"
|
||||
"pandax/pkg/global"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type RoleApi struct {
|
||||
@@ -63,9 +62,8 @@ func (r *RoleApi) InsertRole(rc *restfulx.ReqCtx) {
|
||||
role.RoleId = insert.RoleId
|
||||
r.RoleMenuApp.Insert(insert.RoleId, role.MenuIds)
|
||||
//添加权限
|
||||
tenantId := strconv.Itoa(int(rc.LoginAccount.TenantId))
|
||||
ca := casbin.CasbinS{ModelPath: global.Conf.Casbin.ModelPath}
|
||||
ca.UpdateCasbin(tenantId, role.RoleKey, role.ApiIds)
|
||||
ca.UpdateCasbin(role.RoleKey, role.ApiIds)
|
||||
}
|
||||
|
||||
// UpdateRole 修改用户角色
|
||||
@@ -80,9 +78,8 @@ func (r *RoleApi) UpdateRole(rc *restfulx.ReqCtx) {
|
||||
// 添加角色菜单绑定
|
||||
r.RoleMenuApp.Insert(role.RoleId, role.MenuIds)
|
||||
//修改api权限
|
||||
tenantId := strconv.Itoa(int(rc.LoginAccount.TenantId))
|
||||
ca := casbin.CasbinS{ModelPath: global.Conf.Casbin.ModelPath}
|
||||
ca.UpdateCasbin(tenantId, role.RoleKey, role.ApiIds)
|
||||
ca.UpdateCasbin(role.RoleKey, role.ApiIds)
|
||||
}
|
||||
|
||||
// UpdateRoleStatus 修改用户角色状态
|
||||
|
||||
Reference in New Issue
Block a user