Skip to content

Commit e7ac223

Browse files
committed
fix: 删除用户接口(deleteUser) 不允许删除 root 分组的用户
1 parent 6008216 commit e7ac223

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

app/config/code-message.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ module.exports = {
5656
10076: '邮箱已被使用,请重新填入新的邮箱',
5757
10077: '不可将用户分配给不存在的分组',
5858
10078: '不可修改root用户的分组',
59-
10079: 'root分组和guest分组的用户不可删除',
59+
10079: 'root分组的用户不可删除',
6060
10080: '请求方法不允许',
6161
10100: '刷新令牌获取失败',
6262
10110: '{name}大小不能超过{size}字节',

app/dao/admin.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,13 @@ class AdminDao {
102102
code: 10021
103103
});
104104
}
105-
const rootOrGuest = await UserGroupModel.findOne({
105+
const root = await UserGroupModel.findOne({
106106
where: {
107-
group_id: {
108-
[Op.in]: [GroupLevel.Root, GroupLevel.Guest]
109-
},
107+
group_id: GroupLevel.Root,
110108
user_id: id
111109
}
112110
})
113-
if (rootOrGuest) {
111+
if (root) {
114112
throw new Forbidden({
115113
code: 10079
116114
})

0 commit comments

Comments
 (0)