Skip to content

Commit

Permalink
hotfix: role copy
Browse files Browse the repository at this point in the history
  • Loading branch information
getrebuild committed Apr 1, 2024
1 parent c05f113 commit efcb801
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/java/com/rebuild/core/privileges/RoleService.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,14 @@ public void updateWithCopyTo(ID fromRole, ID[] toRoles) {
Application.getSqlExecutor().execute(dsql);

// 2.复制
Record base = EntityHelper.forNew(EntityHelper.RolePrivileges, UserContextHolder.getUser());
base.setID("roleId", to);
for (Record p : fromPrivileges) {
Record clone = p.clone();
clone.setID("roleId", to);
pm.save(clone);
Record c = base.clone();
c.setString("definition", p.getString("definition"));
c.setInt("entity", p.getInt("entity"));
c.setString("zeroKey", p.getString("zeroKey"));
pm.save(c);
}

// 3.刷新
Expand Down

0 comments on commit efcb801

Please sign in to comment.