mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-11-28 23:58:26 +08:00
feat: 写入权限向后兼容, 避免其它非后台的地方写入报错
This commit is contained in:
1 parent
ce277f08c9
commit
76e4e46b57
1 file changed
+2
-1
@@ -41,7 +41,8 @@ func (p PermissionHook) Mutate(ctx context.Context, m ent.Mutation) (ent.Value,
|
||||
|
||||
perm, ok := ctx.Value(PermissionKey{}).(*domain.Permissions)
|
||||
if !ok {
|
||||
return nil, errcode.ErrPermission.Wrap(fmt.Errorf("failed to get permission"))
|
||||
// 没有权限,直接返回. 用于向后兼容
|
||||
return p.next.Mutate(ctx, m)
|
||||
}
|
||||
|
||||
if perm.IsAdmin {
|
||||
|
||||
Reference in new issue
Block a user