Skip to content

Commit

Permalink
fix🐛: Repair role creation prompt empty slice found (#687)
Browse files Browse the repository at this point in the history
  • Loading branch information
wenjianzhang committed Aug 17, 2022
1 parent a585e29 commit bb65e76
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions app/admin/service/sys_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,16 @@ func (e *SysRole) Insert(c *dto.SysRoleInsertReq, cb *casbin.SyncedEnforcer) err
}
}
}

if len(polices) <= 0 {
return nil
}

_, err = cb.AddNamedPolicies("p", polices)
if err != nil {
return err
}

//if len(c.MenuIds) > 0 {
// s := SysRoleMenu{}
// s.Orm = e.Orm
// s.Log = e.Log
// err = s.ReloadRule(tx, c.RoleId, c.MenuIds)
// if err != nil {
// e.Log.Errorf("reload casbin rule error, %", err.Error())
// return err
// }
//}
return nil
}

Expand Down Expand Up @@ -182,11 +177,13 @@ func (e *SysRole) Update(c *dto.SysRoleUpdateReq, cb *casbin.SyncedEnforcer) err
}
}
}
if len(polices) <= 0 {
return nil
}
_, err = cb.AddNamedPolicies("p", polices)
if err != nil {
return err
}

return nil
}

Expand Down

0 comments on commit bb65e76

Please sign in to comment.