mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-04-28 06:19:20 +08:00
bugfix(permission):fix no permission error when set group notification. (#3675)
* bugfix(permission):fix no permission error when set group notification. * fix(send): add temporary admin context to solve permission problem.
This commit is contained in:
@@ -1207,9 +1207,10 @@ func (s *groupServer) SetGroupInfoEx(ctx context.Context, req *pbgroup.SetGroupI
|
|||||||
log.ZWarn(ctx, "GetGroupMemberIDs is failed.", err)
|
log.ZWarn(ctx, "GetGroupMemberIDs is failed.", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
// use temp admin permission to force success.
|
||||||
|
adminCtx := mcontext.WithOpUserIDContext(ctx, s.config.Share.IMAdminUserID[0])
|
||||||
conversation.GroupAtType = &wrapperspb.Int32Value{Value: constant.GroupNotification}
|
conversation.GroupAtType = &wrapperspb.Int32Value{Value: constant.GroupNotification}
|
||||||
if err := s.conversationClient.SetConversations(ctx, resp.UserIDs, conversation); err != nil {
|
if err := s.conversationClient.SetConversations(adminCtx, resp.UserIDs, conversation); err != nil {
|
||||||
log.ZWarn(ctx, "SetConversations", err, "UserIDs", resp.UserIDs, "conversation", conversation)
|
log.ZWarn(ctx, "SetConversations", err, "UserIDs", resp.UserIDs, "conversation", conversation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,8 +87,9 @@ func (m *msgServer) setConversationAtInfo(nctx context.Context, msg *sdkws.MsgDa
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
// template admin permission for next operation
|
||||||
ctx := mcontext.NewCtx("@@@" + mcontext.GetOperationID(nctx))
|
ctx := mcontext.NewCtx("@@@" + mcontext.GetOperationID(nctx))
|
||||||
|
ctx = mcontext.WithOpUserIDContext(ctx, m.config.Share.IMAdminUserID[0])
|
||||||
var atUserID []string
|
var atUserID []string
|
||||||
|
|
||||||
conversation := &pbconversation.ConversationReq{
|
conversation := &pbconversation.ConversationReq{
|
||||||
|
|||||||
Reference in New Issue
Block a user