Skip to content

Commit bad6aa0

Browse files
committed
fix: fix check logic in getGroupUserPermission
member role record role id, so filter should be use _id other than name and add cache clean login when edit group permission
1 parent db1f5fb commit bad6aa0

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

server/models/group/group.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ export class Group extends TimeStamps implements Base {
290290

291291
const allRoles = member.roles;
292292
const allRolesPermission = allRoles.map((roleName) => {
293-
const p = group.roles.find((r) => r.name === roleName);
293+
const p = group.roles.find((r) => String(r._id) === roleName);
294294

295295
return p?.permissions ?? [];
296296
});

server/services/core/group/group.service.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,7 @@ class GroupService extends TcService {
897897
)
898898
.exec();
899899

900+
this.cleanGroupInfoCache(groupId);
900901
const json = await this.notifyGroupInfoUpdate(ctx, group);
901902
return json;
902903
}
@@ -936,6 +937,7 @@ class GroupService extends TcService {
936937
)
937938
.exec();
938939

940+
this.cleanGroupInfoCache(groupId);
939941
const json = await this.notifyGroupInfoUpdate(ctx, group);
940942
return json;
941943
}
@@ -968,6 +970,7 @@ class GroupService extends TcService {
968970
roleName
969971
);
970972

973+
this.cleanGroupInfoCache(groupId);
971974
const json = await this.notifyGroupInfoUpdate(ctx, group);
972975
return json;
973976
}
@@ -1000,6 +1003,8 @@ class GroupService extends TcService {
10001003
permissions
10011004
);
10021005

1006+
this.cleanGroupInfoCache(groupId);
1007+
this.cleanGroupAllUserPermissionCache(groupId);
10031008
const json = await this.notifyGroupInfoUpdate(ctx, group);
10041009
return json;
10051010
}

0 commit comments

Comments
 (0)