Browse Source

修复给角色添加权限没有写到casbin_role表的bug

pull/89/head
zhangxin 3 years ago
parent
commit
b61f097766
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      web/models/role_menu_model.go

+ 3
- 1
web/models/role_menu_model.go View File

@ -130,7 +130,9 @@ func (rm *RoleMenu) Insert(roleId int, menuId []int) (bool, error) {
//最后一条数据 以分号结尾
sql += fmt.Sprintf("(%d,%d,'%s')", role.RoleId, menu[i].MenuId, role.RoleKey)
if menu[i].MenuType == "A" {
sql2 += fmt.Sprintf("('p','%s','%s','%s')", role.RoleKey, menu[i].Path, menu[i].Action)
sql2 += fmt.Sprintf("('p','%s','%s','%s');", role.RoleKey, menu[i].Path, menu[i].Action)
} else {
sql2 = sql2[:len(sql2)- 1]
}
} else {
sql += fmt.Sprintf("(%d,%d,'%s'),", role.RoleId, menu[i].MenuId, role.RoleKey)


Loading…
Cancel
Save