diff --git a/config/config.yaml b/config/config.yaml index e9db39cf1..5a9573456 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -116,8 +116,10 @@ push: android: accessID: 111 secretKey: 111 +manager: + appManagerUid: ["openIM123456","openIM654321"] + secrets: ["openIM1","openIM2"] -appmanageruid: "openIM123456" secret: tuoyun multiloginpolicy: diff --git a/src/api/chat/send_msg.go b/src/api/chat/send_msg.go index 40ce4d1fc..ede81abdd 100644 --- a/src/api/chat/send_msg.go +++ b/src/api/chat/send_msg.go @@ -66,10 +66,6 @@ func UserSendMsg(c *gin.Context) { } token := c.Request.Header.Get("token") - if !utils.VerifyToken(token, params.SendID) { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"}) - return - } log.InfoByKv("Ws call success to sendMsgReq", params.OperationID, "Parameters", params) diff --git a/src/api/friend/add_friend.go b/src/api/friend/add_friend.go index 88a4ea731..40fee7dac 100644 --- a/src/api/friend/add_friend.go +++ b/src/api/friend/add_friend.go @@ -12,9 +12,9 @@ import ( ) type paramsImportFriendReq struct { - OperationID string `json:"operationID" binding:"required"` - UID string `json:"uid" binding:"required"` - OwnerUid string `json:"ownerUid"` + OperationID string `json:"operationID" binding:"required"` + UIDList []string `json:"uidList" binding:"required"` + OwnerUid string `json:"ownerUid" binding:"required"` } type paramsAddFriend struct { @@ -36,20 +36,19 @@ func ImportFriend(c *gin.Context) { return } req := &pbFriend.ImportFriendReq{ - Uid: params.UID, + UidList: params.UIDList, OperationID: params.OperationID, OwnerUid: params.OwnerUid, Token: c.Request.Header.Get("token"), } - log.Info(req.Token, req.OperationID, "api add friend is server") RpcResp, err := client.ImportFriend(context.Background(), req) if err != nil { log.Error(req.Token, req.OperationID, "err=%s,ImportFriend failed", err) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "cImportFriend failed"}) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "cImportFriend failed" + err.Error()}) return } log.InfoByArgs("ImportFriend success,args=%s", RpcResp.String()) - resp := gin.H{"errCode": RpcResp.ErrorCode, "errMsg": RpcResp.ErrorMsg} + resp := gin.H{"errCode": RpcResp.CommonResp.ErrorCode, "errMsg": RpcResp.CommonResp.ErrorMsg, "failedUidList": RpcResp.FailedUidList} c.JSON(http.StatusOK, resp) log.InfoByArgs("ImportFriend success return,get args=%s,return args=%s", req.String(), RpcResp.String()) } diff --git a/src/api/group/group.go b/src/api/group/group.go index 5e2d6666f..1ccecfe06 100644 --- a/src/api/group/group.go +++ b/src/api/group/group.go @@ -13,7 +13,7 @@ import ( ) type InviteUserToGroupReq struct { - GroupID string `json:"groupID"` + GroupID string `json:"groupID" binding:"required"` UidList []string `json:"uidList" binding:"required"` Reason string `json:"reason"` OperationID string `json:"operationID" binding:"required"` @@ -46,6 +46,7 @@ func KickGroupMember(c *gin.Context) { OperationID: params.OperationID, GroupID: params.GroupID, Token: c.Request.Header.Get("token"), + UidListInfo: params.UidListInfo, } log.Info(req.Token, req.OperationID, "recv req: ", req.String()) diff --git a/src/api/manage/management_chat.go b/src/api/manage/management_chat.go index e57851b1d..fd9c89b27 100644 --- a/src/api/manage/management_chat.go +++ b/src/api/manage/management_chat.go @@ -103,9 +103,10 @@ func ManagementSendMsg(c *gin.Context) { } token := c.Request.Header.Get("token") - if !utils.VerifyToken(token, config.Config.AppManagerUid) { - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err,not authorized", "sendTime": 0, "MsgID": ""}) + if !utils.IsContain(params.SendID, config.Config.Manager.AppManagerUid) { + c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "not appManager", "sendTime": 0, "MsgID": ""}) return + } log.InfoByKv("Ws call success to ManagementSendMsgReq", params.OperationID, "Parameters", params) diff --git a/src/api/open_im_api.go b/src/api/open_im_api.go index 681459c70..eac0a1fa5 100644 --- a/src/api/open_im_api.go +++ b/src/api/open_im_api.go @@ -86,6 +86,7 @@ func main() { chatGroup.POST("/pull_msg", apiChat.UserPullMsg) chatGroup.POST("/send_msg", apiChat.UserSendMsg) } + //Manager managementGroup := r.Group("/manager") { managementGroup.POST("/delete_user", manage.DeleteUser) diff --git a/src/common/config/config.go b/src/common/config/config.go index 435fd694a..0a3c1ccf6 100644 --- a/src/common/config/config.go +++ b/src/common/config/config.go @@ -108,7 +108,10 @@ type config struct { } } } - + Manager struct { + AppManagerUid []string `yaml:"appManagerUid"` + Secrets []string `yaml:"secrets"` + } Kafka struct { Ws2mschat struct { Addr []string `yaml:"addr"` @@ -124,9 +127,7 @@ type config struct { MsgToPush string `yaml:"msgToPush"` } } - AppManagerUid string - Secret string - + Secret string `yaml:"secret"` MultiLoginPolicy struct { OnlyOneTerminalAccess bool `yaml:"onlyOneTerminalAccess"` MobileAndPCTerminalAccessButOtherTerminalKickEachOther bool `yaml:"mobileAndPCTerminalAccessButOtherTerminalKickEachOther"` diff --git a/src/common/constant/constant.go b/src/common/constant/constant.go index 793c66ed1..7a8f0d1ee 100644 --- a/src/common/constant/constant.go +++ b/src/common/constant/constant.go @@ -69,3 +69,5 @@ var ContentType2PushContent = map[int64]string{ Video: "[video]", File: "[file]", } + +const FriendAcceptTip = "You have successfully become friends, so start chatting" diff --git a/src/common/db/mysql_model/im_mysql_model/user_model.go b/src/common/db/mysql_model/im_mysql_model/user_model.go index 11777de18..641eb99bc 100644 --- a/src/common/db/mysql_model/im_mysql_model/user_model.go +++ b/src/common/db/mysql_model/im_mysql_model/user_model.go @@ -1,12 +1,28 @@ package im_mysql_model import ( + "Open_IM/src/common/config" "Open_IM/src/common/db" pbAuth "Open_IM/src/proto/auth" + "Open_IM/src/utils" _ "github.com/jinzhu/gorm/dialects/mysql" "time" ) +func init() { + //init managers + var pb pbAuth.UserRegisterReq + for k, v := range config.Config.Manager.AppManagerUid { + if !IsExistUser(v) { + pb.UID = v + pb.Name = "AppManager" + utils.IntToString(k+1) + err := UserRegister(&pb) + if err != nil { + panic(err) + } + } + } +} func UserRegister(pb *pbAuth.UserRegisterReq) error { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { @@ -113,3 +129,19 @@ func SelectAllUID() ([]string, error) { } return uid, nil } + +func IsExistUser(uid string) bool { + dbConn, err := db.DB.MysqlDB.DefaultGormDB() + if err != nil { + return false + } + var number int32 + err = dbConn.Raw("select count(*) from `user` where uid = ?", uid).Count(&number).Error + if err != nil { + return false + } + if number != 1 { + return false + } + return true +} diff --git a/src/proto/friend/friend.pb.go b/src/proto/friend/friend.pb.go index dc4e655f0..f20bc494d 100644 --- a/src/proto/friend/friend.pb.go +++ b/src/proto/friend/friend.pb.go @@ -35,7 +35,7 @@ func (m *CommonResp) Reset() { *m = CommonResp{} } func (m *CommonResp) String() string { return proto.CompactTextString(m) } func (*CommonResp) ProtoMessage() {} func (*CommonResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_17d6a40c7694c30a, []int{0} + return fileDescriptor_friend_05873114bd399886, []int{0} } func (m *CommonResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CommonResp.Unmarshal(m, b) @@ -82,7 +82,7 @@ func (m *GetFriendsInfoReq) Reset() { *m = GetFriendsInfoReq{} } func (m *GetFriendsInfoReq) String() string { return proto.CompactTextString(m) } func (*GetFriendsInfoReq) ProtoMessage() {} func (*GetFriendsInfoReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_17d6a40c7694c30a, []int{1} + return fileDescriptor_friend_05873114bd399886, []int{1} } func (m *GetFriendsInfoReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendsInfoReq.Unmarshal(m, b) @@ -136,7 +136,7 @@ func (m *GetFriendInfoResp) Reset() { *m = GetFriendInfoResp{} } func (m *GetFriendInfoResp) String() string { return proto.CompactTextString(m) } func (*GetFriendInfoResp) ProtoMessage() {} func (*GetFriendInfoResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_17d6a40c7694c30a, []int{2} + return fileDescriptor_friend_05873114bd399886, []int{2} } func (m *GetFriendInfoResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendInfoResp.Unmarshal(m, b) @@ -198,7 +198,7 @@ func (m *GetFriendData) Reset() { *m = GetFriendData{} } func (m *GetFriendData) String() string { return proto.CompactTextString(m) } func (*GetFriendData) ProtoMessage() {} func (*GetFriendData) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_17d6a40c7694c30a, []int{3} + return fileDescriptor_friend_05873114bd399886, []int{3} } func (m *GetFriendData) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendData.Unmarshal(m, b) @@ -309,7 +309,7 @@ func (m *AddFriendReq) Reset() { *m = AddFriendReq{} } func (m *AddFriendReq) String() string { return proto.CompactTextString(m) } func (*AddFriendReq) ProtoMessage() {} func (*AddFriendReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_17d6a40c7694c30a, []int{4} + return fileDescriptor_friend_05873114bd399886, []int{4} } func (m *AddFriendReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddFriendReq.Unmarshal(m, b) @@ -358,7 +358,7 @@ func (m *AddFriendReq) GetReqMessage() string { } type ImportFriendReq struct { - Uid string `protobuf:"bytes,1,opt,name=uid" json:"uid,omitempty"` + UidList []string `protobuf:"bytes,1,rep,name=uidList" json:"uidList,omitempty"` OperationID string `protobuf:"bytes,2,opt,name=OperationID" json:"OperationID,omitempty"` Token string `protobuf:"bytes,3,opt,name=Token" json:"Token,omitempty"` OwnerUid string `protobuf:"bytes,4,opt,name=OwnerUid" json:"OwnerUid,omitempty"` @@ -371,7 +371,7 @@ func (m *ImportFriendReq) Reset() { *m = ImportFriendReq{} } func (m *ImportFriendReq) String() string { return proto.CompactTextString(m) } func (*ImportFriendReq) ProtoMessage() {} func (*ImportFriendReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_17d6a40c7694c30a, []int{5} + return fileDescriptor_friend_05873114bd399886, []int{5} } func (m *ImportFriendReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ImportFriendReq.Unmarshal(m, b) @@ -391,11 +391,11 @@ func (m *ImportFriendReq) XXX_DiscardUnknown() { var xxx_messageInfo_ImportFriendReq proto.InternalMessageInfo -func (m *ImportFriendReq) GetUid() string { +func (m *ImportFriendReq) GetUidList() []string { if m != nil { - return m.Uid + return m.UidList } - return "" + return nil } func (m *ImportFriendReq) GetOperationID() string { @@ -419,6 +419,52 @@ func (m *ImportFriendReq) GetOwnerUid() string { return "" } +type ImportFriendResp struct { + CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` + FailedUidList []string `protobuf:"bytes,2,rep,name=failedUidList" json:"failedUidList,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImportFriendResp) Reset() { *m = ImportFriendResp{} } +func (m *ImportFriendResp) String() string { return proto.CompactTextString(m) } +func (*ImportFriendResp) ProtoMessage() {} +func (*ImportFriendResp) Descriptor() ([]byte, []int) { + return fileDescriptor_friend_05873114bd399886, []int{6} +} +func (m *ImportFriendResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ImportFriendResp.Unmarshal(m, b) +} +func (m *ImportFriendResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ImportFriendResp.Marshal(b, m, deterministic) +} +func (dst *ImportFriendResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImportFriendResp.Merge(dst, src) +} +func (m *ImportFriendResp) XXX_Size() int { + return xxx_messageInfo_ImportFriendResp.Size(m) +} +func (m *ImportFriendResp) XXX_DiscardUnknown() { + xxx_messageInfo_ImportFriendResp.DiscardUnknown(m) +} + +var xxx_messageInfo_ImportFriendResp proto.InternalMessageInfo + +func (m *ImportFriendResp) GetCommonResp() *CommonResp { + if m != nil { + return m.CommonResp + } + return nil +} + +func (m *ImportFriendResp) GetFailedUidList() []string { + if m != nil { + return m.FailedUidList + } + return nil +} + type GetFriendApplyReq struct { OperationID string `protobuf:"bytes,1,opt,name=OperationID" json:"OperationID,omitempty"` Token string `protobuf:"bytes,2,opt,name=Token" json:"Token,omitempty"` @@ -431,7 +477,7 @@ func (m *GetFriendApplyReq) Reset() { *m = GetFriendApplyReq{} } func (m *GetFriendApplyReq) String() string { return proto.CompactTextString(m) } func (*GetFriendApplyReq) ProtoMessage() {} func (*GetFriendApplyReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_17d6a40c7694c30a, []int{6} + return fileDescriptor_friend_05873114bd399886, []int{7} } func (m *GetFriendApplyReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendApplyReq.Unmarshal(m, b) @@ -478,7 +524,7 @@ func (m *GetFriendApplyResp) Reset() { *m = GetFriendApplyResp{} } func (m *GetFriendApplyResp) String() string { return proto.CompactTextString(m) } func (*GetFriendApplyResp) ProtoMessage() {} func (*GetFriendApplyResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_17d6a40c7694c30a, []int{7} + return fileDescriptor_friend_05873114bd399886, []int{8} } func (m *GetFriendApplyResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendApplyResp.Unmarshal(m, b) @@ -540,7 +586,7 @@ func (m *ApplyUserInfo) Reset() { *m = ApplyUserInfo{} } func (m *ApplyUserInfo) String() string { return proto.CompactTextString(m) } func (*ApplyUserInfo) ProtoMessage() {} func (*ApplyUserInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_17d6a40c7694c30a, []int{8} + return fileDescriptor_friend_05873114bd399886, []int{9} } func (m *ApplyUserInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ApplyUserInfo.Unmarshal(m, b) @@ -649,7 +695,7 @@ func (m *GetFriendListReq) Reset() { *m = GetFriendListReq{} } func (m *GetFriendListReq) String() string { return proto.CompactTextString(m) } func (*GetFriendListReq) ProtoMessage() {} func (*GetFriendListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_17d6a40c7694c30a, []int{9} + return fileDescriptor_friend_05873114bd399886, []int{10} } func (m *GetFriendListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendListReq.Unmarshal(m, b) @@ -696,7 +742,7 @@ func (m *GetFriendListResp) Reset() { *m = GetFriendListResp{} } func (m *GetFriendListResp) String() string { return proto.CompactTextString(m) } func (*GetFriendListResp) ProtoMessage() {} func (*GetFriendListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_17d6a40c7694c30a, []int{10} + return fileDescriptor_friend_05873114bd399886, []int{11} } func (m *GetFriendListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetFriendListResp.Unmarshal(m, b) @@ -757,7 +803,7 @@ func (m *UserInfo) Reset() { *m = UserInfo{} } func (m *UserInfo) String() string { return proto.CompactTextString(m) } func (*UserInfo) ProtoMessage() {} func (*UserInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_17d6a40c7694c30a, []int{11} + return fileDescriptor_friend_05873114bd399886, []int{12} } func (m *UserInfo) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_UserInfo.Unmarshal(m, b) @@ -861,7 +907,7 @@ func (m *AddBlacklistReq) Reset() { *m = AddBlacklistReq{} } func (m *AddBlacklistReq) String() string { return proto.CompactTextString(m) } func (*AddBlacklistReq) ProtoMessage() {} func (*AddBlacklistReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_17d6a40c7694c30a, []int{12} + return fileDescriptor_friend_05873114bd399886, []int{13} } func (m *AddBlacklistReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddBlacklistReq.Unmarshal(m, b) @@ -922,7 +968,7 @@ func (m *RemoveBlacklistReq) Reset() { *m = RemoveBlacklistReq{} } func (m *RemoveBlacklistReq) String() string { return proto.CompactTextString(m) } func (*RemoveBlacklistReq) ProtoMessage() {} func (*RemoveBlacklistReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_17d6a40c7694c30a, []int{13} + return fileDescriptor_friend_05873114bd399886, []int{14} } func (m *RemoveBlacklistReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RemoveBlacklistReq.Unmarshal(m, b) @@ -975,7 +1021,7 @@ func (m *GetBlacklistReq) Reset() { *m = GetBlacklistReq{} } func (m *GetBlacklistReq) String() string { return proto.CompactTextString(m) } func (*GetBlacklistReq) ProtoMessage() {} func (*GetBlacklistReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_17d6a40c7694c30a, []int{14} + return fileDescriptor_friend_05873114bd399886, []int{15} } func (m *GetBlacklistReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetBlacklistReq.Unmarshal(m, b) @@ -1022,7 +1068,7 @@ func (m *GetBlacklistResp) Reset() { *m = GetBlacklistResp{} } func (m *GetBlacklistResp) String() string { return proto.CompactTextString(m) } func (*GetBlacklistResp) ProtoMessage() {} func (*GetBlacklistResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_17d6a40c7694c30a, []int{15} + return fileDescriptor_friend_05873114bd399886, []int{16} } func (m *GetBlacklistResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetBlacklistResp.Unmarshal(m, b) @@ -1076,7 +1122,7 @@ func (m *IsFriendReq) Reset() { *m = IsFriendReq{} } func (m *IsFriendReq) String() string { return proto.CompactTextString(m) } func (*IsFriendReq) ProtoMessage() {} func (*IsFriendReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_17d6a40c7694c30a, []int{16} + return fileDescriptor_friend_05873114bd399886, []int{17} } func (m *IsFriendReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IsFriendReq.Unmarshal(m, b) @@ -1130,7 +1176,7 @@ func (m *IsFriendResp) Reset() { *m = IsFriendResp{} } func (m *IsFriendResp) String() string { return proto.CompactTextString(m) } func (*IsFriendResp) ProtoMessage() {} func (*IsFriendResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_17d6a40c7694c30a, []int{17} + return fileDescriptor_friend_05873114bd399886, []int{18} } func (m *IsFriendResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IsFriendResp.Unmarshal(m, b) @@ -1184,7 +1230,7 @@ func (m *IsInBlackListReq) Reset() { *m = IsInBlackListReq{} } func (m *IsInBlackListReq) String() string { return proto.CompactTextString(m) } func (*IsInBlackListReq) ProtoMessage() {} func (*IsInBlackListReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_17d6a40c7694c30a, []int{18} + return fileDescriptor_friend_05873114bd399886, []int{19} } func (m *IsInBlackListReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IsInBlackListReq.Unmarshal(m, b) @@ -1238,7 +1284,7 @@ func (m *IsInBlackListResp) Reset() { *m = IsInBlackListResp{} } func (m *IsInBlackListResp) String() string { return proto.CompactTextString(m) } func (*IsInBlackListResp) ProtoMessage() {} func (*IsInBlackListResp) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_17d6a40c7694c30a, []int{19} + return fileDescriptor_friend_05873114bd399886, []int{20} } func (m *IsInBlackListResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_IsInBlackListResp.Unmarshal(m, b) @@ -1292,7 +1338,7 @@ func (m *DeleteFriendReq) Reset() { *m = DeleteFriendReq{} } func (m *DeleteFriendReq) String() string { return proto.CompactTextString(m) } func (*DeleteFriendReq) ProtoMessage() {} func (*DeleteFriendReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_17d6a40c7694c30a, []int{20} + return fileDescriptor_friend_05873114bd399886, []int{21} } func (m *DeleteFriendReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteFriendReq.Unmarshal(m, b) @@ -1347,7 +1393,7 @@ func (m *AddFriendResponseReq) Reset() { *m = AddFriendResponseReq{} } func (m *AddFriendResponseReq) String() string { return proto.CompactTextString(m) } func (*AddFriendResponseReq) ProtoMessage() {} func (*AddFriendResponseReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_17d6a40c7694c30a, []int{21} + return fileDescriptor_friend_05873114bd399886, []int{22} } func (m *AddFriendResponseReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AddFriendResponseReq.Unmarshal(m, b) @@ -1409,7 +1455,7 @@ func (m *SetFriendCommentReq) Reset() { *m = SetFriendCommentReq{} } func (m *SetFriendCommentReq) String() string { return proto.CompactTextString(m) } func (*SetFriendCommentReq) ProtoMessage() {} func (*SetFriendCommentReq) Descriptor() ([]byte, []int) { - return fileDescriptor_friend_17d6a40c7694c30a, []int{22} + return fileDescriptor_friend_05873114bd399886, []int{23} } func (m *SetFriendCommentReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetFriendCommentReq.Unmarshal(m, b) @@ -1464,6 +1510,7 @@ func init() { proto.RegisterType((*GetFriendData)(nil), "friend.GetFriendData") proto.RegisterType((*AddFriendReq)(nil), "friend.AddFriendReq") proto.RegisterType((*ImportFriendReq)(nil), "friend.ImportFriendReq") + proto.RegisterType((*ImportFriendResp)(nil), "friend.ImportFriendResp") proto.RegisterType((*GetFriendApplyReq)(nil), "friend.GetFriendApplyReq") proto.RegisterType((*GetFriendApplyResp)(nil), "friend.GetFriendApplyResp") proto.RegisterType((*ApplyUserInfo)(nil), "friend.ApplyUserInfo") @@ -1507,7 +1554,7 @@ type FriendClient interface { DeleteFriend(ctx context.Context, in *DeleteFriendReq, opts ...grpc.CallOption) (*CommonResp, error) AddFriendResponse(ctx context.Context, in *AddFriendResponseReq, opts ...grpc.CallOption) (*CommonResp, error) SetFriendComment(ctx context.Context, in *SetFriendCommentReq, opts ...grpc.CallOption) (*CommonResp, error) - ImportFriend(ctx context.Context, in *ImportFriendReq, opts ...grpc.CallOption) (*CommonResp, error) + ImportFriend(ctx context.Context, in *ImportFriendReq, opts ...grpc.CallOption) (*ImportFriendResp, error) } type friendClient struct { @@ -1635,8 +1682,8 @@ func (c *friendClient) SetFriendComment(ctx context.Context, in *SetFriendCommen return out, nil } -func (c *friendClient) ImportFriend(ctx context.Context, in *ImportFriendReq, opts ...grpc.CallOption) (*CommonResp, error) { - out := new(CommonResp) +func (c *friendClient) ImportFriend(ctx context.Context, in *ImportFriendReq, opts ...grpc.CallOption) (*ImportFriendResp, error) { + out := new(ImportFriendResp) err := grpc.Invoke(ctx, "/friend.friend/ImportFriend", in, out, c.cc, opts...) if err != nil { return nil, err @@ -1660,7 +1707,7 @@ type FriendServer interface { DeleteFriend(context.Context, *DeleteFriendReq) (*CommonResp, error) AddFriendResponse(context.Context, *AddFriendResponseReq) (*CommonResp, error) SetFriendComment(context.Context, *SetFriendCommentReq) (*CommonResp, error) - ImportFriend(context.Context, *ImportFriendReq) (*CommonResp, error) + ImportFriend(context.Context, *ImportFriendReq) (*ImportFriendResp, error) } func RegisterFriendServer(s *grpc.Server, srv FriendServer) { @@ -1984,68 +2031,72 @@ var _Friend_serviceDesc = grpc.ServiceDesc{ Metadata: "friend/friend.proto", } -func init() { proto.RegisterFile("friend/friend.proto", fileDescriptor_friend_17d6a40c7694c30a) } +func init() { proto.RegisterFile("friend/friend.proto", fileDescriptor_friend_05873114bd399886) } -var fileDescriptor_friend_17d6a40c7694c30a = []byte{ - // 956 bytes of a gzipped FileDescriptorProto +var fileDescriptor_friend_05873114bd399886 = []byte{ + // 1011 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xcd, 0x6e, 0xdb, 0x46, - 0x10, 0x86, 0x48, 0xc9, 0x96, 0x46, 0x52, 0x24, 0xaf, 0xdd, 0x96, 0x65, 0x83, 0xc2, 0x20, 0x72, - 0x48, 0x2f, 0x29, 0x90, 0x22, 0x27, 0x9f, 0x14, 0xbb, 0x0e, 0xd8, 0x34, 0x08, 0xc0, 0xd8, 0x97, - 0x16, 0x2d, 0x40, 0x8b, 0x23, 0x86, 0x08, 0xc9, 0x65, 0xb8, 0x6c, 0x2c, 0x3f, 0x41, 0xcf, 0x7d, - 0x8e, 0xbe, 0x5c, 0x1f, 0xa1, 0xd8, 0x5d, 0x2e, 0xb9, 0xfc, 0x71, 0x1b, 0x40, 0xb1, 0x73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0x0f, 0x67, 0x01, 0x5d, 0x43, 0x83, - 0xae, 0x82, 0xb8, 0xa9, 0x41, 0xfc, 0x3e, 0xe1, 0x4c, 0x60, 0xb8, 0x89, 0xfd, 0x50, 0x60, 0x79, - 0xe4, 0x89, 0x35, 0x4f, 0x98, 0xcf, 0x43, 0xb9, 0x88, 0x12, 0x14, 0x48, 0x9e, 0x78, 0xb5, 0x82, - 0x43, 0x29, 0xaf, 0xa1, 0x34, 0x95, 0x50, 0xaa, 0x35, 0xce, 0x4f, 0xb0, 0x0c, 0x55, 0x11, 0x38, - 0xaa, 0x77, 0x29, 0x28, 0x83, 0x83, 0x96, 0xad, 0x9d, 0xea, 0xf9, 0xa8, 0xac, 0xa7, 0x29, 0xea, - 0xb9, 0x54, 0xf5, 0x6c, 0x95, 0xf2, 0x9f, 0x01, 0x8c, 0x3f, 0xa2, 0x8a, 0x66, 0x4f, 0x15, 0x8d, - 0xcf, 0x54, 0xc5, 0xdb, 0x49, 0xa9, 0x43, 0x3c, 0xd0, 0x47, 0x3c, 0xd7, 0xb0, 0x58, 0x05, 0x81, - 0x90, 0xe3, 0xb2, 0x64, 0xf7, 0xd3, 0xfe, 0xbf, 0x03, 0xf1, 0x30, 0xa1, 0x1f, 0xf0, 0x6e, 0x7c, - 0x3b, 0x2e, 0x2c, 0x5e, 0x60, 0xd1, 0x30, 0xfe, 0x51, 0x58, 0x2c, 0x74, 0x2c, 0x0a, 0xc1, 0xc9, - 0x61, 0xd9, 0x34, 0x75, 0x0f, 0x50, 0x44, 0x98, 0xba, 0xac, 0xa6, 0xe4, 0xea, 0x62, 0x03, 0xed, - 0x62, 0xb2, 0x21, 0xd7, 0x18, 0x7d, 0x40, 0x9e, 0x61, 0x43, 0x35, 0xa4, 0xd2, 0xb4, 0x03, 0x36, - 0x3b, 0x01, 0x3b, 0x01, 0xcc, 0x6a, 0x37, 0x3b, 0x85, 0x65, 0xc3, 0x98, 0xbd, 0x8d, 0xb2, 0x8b, - 0x9b, 0x4c,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92, 0xc3, 0x22, 0x65, 0xb7, 0xd7, 0xf1, 0xde, 0xd7, 0x6c, 0x7e, 0x07, + 0xe6, 0x62, 0x94, 0xbc, 0xc5, 0x8f, 0xf3, 0xb6, 0xb3, 0x82, 0xd9, 0x13, 0xcc, 0x6b, 0xc6, 0x3f, + 0xa8, 0x16, 0x73, 0xbd, 0x16, 0x49, 0x70, 0x32, 0x98, 0xd7, 0x4d, 0x7d, 0x82, 0x52, 0x44, 0x18, + 0xaf, 0xb8, 0x1a, 0x04, 0x95, 0x63, 0x3d, 0xcd, 0x31, 0x49, 0xc8, 0x35, 0x06, 0x6f, 0x51, 0x44, + 0xd8, 0x28, 0x09, 0x59, 0x6a, 0x9a, 0x80, 0xcd, 0x16, 0x60, 0xc7, 0x87, 0x89, 0x7a, 0x66, 0x27, + 0x58, 0x36, 0x0c, 0xf9, 0xcb, 0x20, 0x3d, 0xbf, 0x4e, 0x25, 0x41, 0x06, 0x6e, 0x25, 0x3b, 0x31, + 0xcc, 0x57, 0x7a, 0xd5, 0x15, 0xa3, 0x8d, 0x63, 0x2c, 0xa6, 0x41, 0x81, 0xa9, 0x14, 0x6f, 0x01, + 0x55, 0x00, 0x07, 0x8d, 0xf7, 0x76, 0x85, 0x96, 0x21, 0x4f, 0x93, 0x98, 0x4b, 0x68, 0x43, 0xb7, + 0x92, 0x9d, 0x5f, 0x61, 0x76, 0x8a, 0x21, 0xe6, 0xf8, 0x11, 0x36, 0x06, 0x27, 0x87, 0x23, 0x6d, + 0x17, 0x91, 0x2f, 0x76, 0xbf, 0x50, 0x36, 0x73, 0x43, 0x6b, 0xe6, 0xff, 0x19, 0x27, 0xf5, 0x6a, + 0xbf, 0x3e, 0x4b, 0x0f, 0x5f, 0x94, 0xad, 0xf7, 0x44, 0x36, 0x93, 0x1b, 0x61, 0x25, 0x6d, 0x58, + 0x9a, 0x4a, 0xef, 0x4e, 0x66, 0xbd, 0x3b, 0x55, 0x05, 0xdd, 0xd7, 0x0a, 0xfa, 0x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, 0xef, 0x75, 0x10, 0xf8, 0x86, 0x5c, 0x4e, 0xf4, 0x95, 0x5f, 0x01, 0x69, 0xfc, + 0x12, 0x51, 0xb1, 0x68, 0xfe, 0x42, 0x78, 0x3c, 0xfb, 0x65, 0x2a, 0x8f, 0x1e, 0xc9, 0x3f, 0x97, + 0x7b, 0xf4, 0x2b, 0xfc, 0x87, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x85, 0x59, 0x8f, 0x67, 0x9c, + 0x0f, 0x00, 0x00, } diff --git a/src/proto/friend/friend.proto b/src/proto/friend/friend.proto index 7fb864054..7cbfc8c41 100644 --- a/src/proto/friend/friend.proto +++ b/src/proto/friend/friend.proto @@ -41,14 +41,15 @@ message AddFriendReq{ message ImportFriendReq{ - string uid = 1; + repeated string uidList = 1; string OperationID = 2; string Token = 3; string OwnerUid = 4; } - - - +message ImportFriendResp{ + CommonResp commonResp = 1; + repeated string failedUidList = 2; +} message GetFriendApplyReq{ string OperationID = 1; @@ -178,5 +179,5 @@ service friend{ rpc deleteFriend(DeleteFriendReq) returns(CommonResp); rpc addFriendResponse(AddFriendResponseReq) returns(CommonResp); rpc setFriendComment(SetFriendCommentReq) returns(CommonResp); - rpc ImportFriend(ImportFriendReq) returns(CommonResp); + rpc ImportFriend(ImportFriendReq) returns(ImportFriendResp); } \ No newline at end of file diff --git a/src/rpc/chat/chat/send_msg.go b/src/rpc/chat/chat/send_msg.go index 5191e662c..21a1a7be8 100644 --- a/src/rpc/chat/chat/send_msg.go +++ b/src/rpc/chat/chat/send_msg.go @@ -41,7 +41,11 @@ type MsgCallBackResp struct { } func (rpc *rpcChat) UserSendMsg(_ context.Context, pb *pbChat.UserSendMsgReq) (*pbChat.UserSendMsgResp, error) { + replay := pbChat.UserSendMsgResp{} log.InfoByKv("sendMsg", pb.OperationID, "args", pb.String()) + if !utils.VerifyToken(pb.Token, pb.SendID) { + return returnMsg(&replay, pb, http.StatusUnauthorized, "token validate err,not authorized", "", 0) + } serverMsgID := GetMsgID(pb.SendID) pbData := pbChat.WSToMsgSvrChatMsg{} pbData.MsgFrom = pb.MsgFrom @@ -61,7 +65,6 @@ func (rpc *rpcChat) UserSendMsg(_ context.Context, pb *pbChat.UserSendMsgReq) (* pbData.OperationID = pb.OperationID pbData.Token = pb.Token pbData.SendTime = utils.GetCurrentTimestampByNano() - replay := pbChat.UserSendMsgResp{} m := MsgCallBackResp{} if config.Config.MessageCallBack.CallbackSwitch { bMsg, err := http2.Post(config.Config.MessageCallBack.CallbackUrl, MsgCallBackReq{ diff --git a/src/rpc/friend/friend/add_blacklist.go b/src/rpc/friend/friend/add_blacklist.go index 809410ce4..7efe4e226 100644 --- a/src/rpc/friend/friend/add_blacklist.go +++ b/src/rpc/friend/friend/add_blacklist.go @@ -20,9 +20,11 @@ func (s *friendServer) AddBlacklist(ctx context.Context, req *pbFriend.AddBlackl isMagagerFlag := 0 tokenUid := claims.UID - if tokenUid == config.Config.AppManagerUid { + + if utils.IsContain(tokenUid, config.Config.Manager.AppManagerUid) { isMagagerFlag = 1 } + if isMagagerFlag == 0 { err = im_mysql_model.InsertInToUserBlackList(claims.UID, req.Uid) if err != nil { diff --git a/src/rpc/friend/friend/add_friend.go b/src/rpc/friend/friend/add_friend.go index d6d081235..6fd9f4b27 100644 --- a/src/rpc/friend/friend/add_friend.go +++ b/src/rpc/friend/friend/add_friend.go @@ -52,65 +52,69 @@ func (s *friendServer) AddFriend(ctx context.Context, req *pbFriend.AddFriendReq return &pbFriend.CommonResp{}, nil } -func (s *friendServer) ImportFriend(ctx context.Context, req *pbFriend.ImportFriendReq) (*pbFriend.CommonResp, error) { - log.Info(req.Token, req.OperationID, "ImportFriendis server,userid=%s", req.OwnerUid) +func (s *friendServer) ImportFriend(ctx context.Context, req *pbFriend.ImportFriendReq) (*pbFriend.ImportFriendResp, error) { + log.Info(req.Token, req.OperationID, "ImportFriend come here,args=%s", req.String()) + var resp pbFriend.ImportFriendResp //Parse token, to find current user information claims, err := utils.ParseToken(req.Token) if err != nil { log.Error(req.Token, req.OperationID, "err=%s,parse token failed", err.Error()) - return &pbFriend.CommonResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil - } - if claims.UID != config.Config.AppManagerUid { - log.Error(req.Token, req.OperationID, "not magager uid", claims.UID, config.Config.AppManagerUid) - return &pbFriend.CommonResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil + return &pbFriend.ImportFriendResp{CommonResp: &pbFriend.CommonResp{ErrorCode: config.ErrAddFriend.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, FailedUidList: req.UidList}, nil } - if _, err = im_mysql_model.FindUserByUID(req.Uid); err != nil { - log.Error(req.Token, req.OperationID, "this user not exists,cant not add friend", req.Uid) - return &pbFriend.CommonResp{ErrorCode: config.ErrAddFriend.ErrCode, ErrorMsg: config.ErrSearchUserInfo.ErrMsg}, nil + if !utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) { + log.Error(req.Token, req.OperationID, "not magager uid", claims.UID) + return &pbFriend.ImportFriendResp{CommonResp: &pbFriend.CommonResp{ErrorCode: config.ErrAddFriend.ErrCode, ErrorMsg: "not authorized"}, FailedUidList: req.UidList}, nil } - if _, err = im_mysql_model.FindUserByUID(req.OwnerUid); err != nil { log.Error(req.Token, req.OperationID, "this user not exists,cant not add friend", req.OwnerUid) - return &pbFriend.CommonResp{ErrorCode: config.ErrAddFriend.ErrCode, ErrorMsg: config.ErrSearchUserInfo.ErrMsg}, nil + return &pbFriend.ImportFriendResp{CommonResp: &pbFriend.CommonResp{ErrorCode: config.ErrAddFriend.ErrCode, ErrorMsg: "this user not exists,cant not add friend"}, FailedUidList: req.UidList}, nil } + for _, v := range req.UidList { + if _, err = im_mysql_model.FindUserByUID(v); err != nil { + resp.CommonResp.ErrorMsg = "some uid establish failed" + resp.CommonResp.ErrorCode = 408 + resp.FailedUidList = append(resp.FailedUidList, v) + } else { + if _, err = im_mysql_model.FindFriendRelationshipFromFriend(req.OwnerUid, v); err != nil { + //Establish two single friendship + err1 := im_mysql_model.InsertToFriend(req.OwnerUid, v, 1) + if err1 != nil { + resp.FailedUidList = append(resp.FailedUidList, v) + log.Error(req.Token, req.OperationID, "err=%s,create friendship failed", err.Error()) + } + err2 := im_mysql_model.InsertToFriend(v, req.OwnerUid, 1) + if err2 != nil { + log.Error(req.Token, req.OperationID, "err=%s,create friendship failed", err.Error()) + } + if err1 == nil && err2 == nil { + var name, faceUrl string + n := content_struct.NotificationContent{1, constant.FriendAcceptTip, ""} + r, err := im_mysql_model.FindUserByUID(v) + if err != nil { + log.ErrorByKv("get info failed", req.OperationID, "err", err.Error(), "req", req.String()) + } + if r != nil { + name, faceUrl = r.Name, r.Icon + } - _, err = im_mysql_model.FindFriendRelationshipFromFriend(req.OwnerUid, req.Uid) + logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{ + SendID: v, + RecvID: req.OwnerUid, + SenderFaceURL: faceUrl, + SenderNickName: name, + Content: n.ContentToString(), + SendTime: utils.GetCurrentTimestampByNano(), + MsgFrom: constant.UserMsgType, //Notification message identification + ContentType: constant.AcceptFriendApplicationTip, //Add friend flag + SessionType: constant.SingleChatType, + OperationID: req.OperationID, + }) + } + } + } - if err != nil { - log.Error("", req.OperationID, err.Error()) - } - //Establish two single friendship - err = im_mysql_model.InsertToFriend(req.OwnerUid, req.Uid, 1) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,create friendship failed", err.Error()) - } - err = im_mysql_model.InsertToFriend(req.Uid, req.OwnerUid, 1) - if err != nil { - log.Error(req.Token, req.OperationID, "err=%s,create friendship failed", err.Error()) } + return &resp, nil - logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{ - SendID: req.OwnerUid, - RecvID: req.Uid, - Content: content_struct.NewContentStructString(0, "", " add you as a friend."), - SendTime: utils.GetCurrentTimestampBySecond(), - MsgFrom: constant.UserMsgType, //Notification message identification - ContentType: constant.AcceptFriendApplicationTip, //Add friend flag - SessionType: constant.SingleChatType, - OperationID: req.OperationID, - }) - - logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{ - SendID: req.Uid, - RecvID: req.OwnerUid, - Content: content_struct.NewContentStructString(0, "", " add you as a friend."), - SendTime: utils.GetCurrentTimestampBySecond(), - MsgFrom: constant.UserMsgType, //Notification message identification - ContentType: constant.AcceptFriendApplicationTip, //Add friend flag - SessionType: constant.SingleChatType, - OperationID: req.OperationID, - }) - - return &pbFriend.CommonResp{}, nil } diff --git a/src/rpc/group/group/create_group.go b/src/rpc/group/group/create_group.go index 971887dcb..4aeb073d7 100644 --- a/src/rpc/group/group/create_group.go +++ b/src/rpc/group/group/create_group.go @@ -87,7 +87,8 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR isMagagerFlag := 0 tokenUid := claims.UID - if tokenUid == config.Config.AppManagerUid { + + if utils.IsContain(tokenUid, config.Config.Manager.AppManagerUid) { isMagagerFlag = 1 } diff --git a/src/rpc/group/group/group.go b/src/rpc/group/group/group.go index 0fca4ae56..e1e1426b1 100644 --- a/src/rpc/group/group/group.go +++ b/src/rpc/group/group/group.go @@ -63,8 +63,9 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite return &pbGroup.InviteUserToGroupResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: config.ErrParseToken.ErrMsg}, nil } log.Info(claims.UID, req.OperationID, "recv req: ", req.String()) + // if !imdb.IsExistGroupMember(req.GroupID, claims.UID) && claims.UID != config.Config.AppManagerUid - if !imdb.IsExistGroupMember(req.GroupID, claims.UID) && claims.UID != config.Config.AppManagerUid { + if !imdb.IsExistGroupMember(req.GroupID, claims.UID) && !utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) { log.Error(req.Token, req.OperationID, "err= invite user not in group") return &pbGroup.InviteUserToGroupResp{ErrorCode: config.ErrAccess.ErrCode, ErrorMsg: config.ErrAccess.ErrMsg}, nil } @@ -118,7 +119,8 @@ func (s *groupServer) InviteUserToGroup(ctx context.Context, req *pbGroup.Invite resp.ErrorCode = 0 resp.ErrorMsg = "ok" - if claims.UID == config.Config.AppManagerUid { + //if claims.UID == config.Config.AppManagerUid + if utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) { var iu inviteUserToGroupReq iu.GroupID = req.GroupID iu.OperationID = req.OperationID @@ -268,7 +270,8 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou } } if flag != 1 { - if claims.UID == config.Config.AppManagerUid { + // if claims.UID == config.Config.AppManagerUid { + if utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) { flag = 1 } } @@ -320,7 +323,7 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou n := content_struct.NotificationContent{1, req.GroupID, kq.ContentToString()} - if claims.UID == config.Config.AppManagerUid { + if utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) { log.Info("", req.OperationID, claims.UID, req.GroupID) logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{ SendID: claims.UID, diff --git a/src/rpc/user/user/management_user.go b/src/rpc/user/user/management_user.go index 4c27300de..7f5e10e03 100644 --- a/src/rpc/user/user/management_user.go +++ b/src/rpc/user/user/management_user.go @@ -23,7 +23,7 @@ func (s *userServer) DeleteUsers(_ context.Context, req *pbUser.DeleteUsersReq) log.ErrorByKv("parse token failed", req.OperationID, "err", err.Error()) return &pbUser.DeleteUsersResp{CommonResp: &pbUser.CommonResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: err.Error()}, FailedUidList: req.DeleteUidList}, nil } - if c.UID != config.Config.AppManagerUid { + if !utils.IsContain(c.UID, config.Config.Manager.AppManagerUid) { log.ErrorByKv(" Authentication failed", req.OperationID, "args", c) return &pbUser.DeleteUsersResp{CommonResp: &pbUser.CommonResp{ErrorCode: 401, ErrorMsg: "not authorized"}, FailedUidList: req.DeleteUidList}, nil } @@ -46,7 +46,7 @@ func (s *userServer) GetAllUsersUid(_ context.Context, req *pbUser.GetAllUsersUi log.InfoByKv("parse token failed", req.OperationID, "err", err.Error()) return &pbUser.GetAllUsersUidResp{CommonResp: &pbUser.CommonResp{ErrorCode: config.ErrParseToken.ErrCode, ErrorMsg: err.Error()}}, nil } - if c.UID != config.Config.AppManagerUid { + if !utils.IsContain(c.UID, config.Config.Manager.AppManagerUid) { log.ErrorByKv(" Authentication failed", req.OperationID, "args", c) return &pbUser.GetAllUsersUidResp{CommonResp: &pbUser.CommonResp{ErrorCode: 401, ErrorMsg: "not authorized"}}, nil } diff --git a/src/rpc/user/user/update_user_info.go b/src/rpc/user/user/update_user_info.go index 952352596..368c08837 100644 --- a/src/rpc/user/user/update_user_info.go +++ b/src/rpc/user/user/update_user_info.go @@ -24,7 +24,8 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserI } ownerUid := "" - if claims.UID == config.Config.AppManagerUid { + //if claims.UID == config.Config.AppManagerUid { + if utils.IsContain(claims.UID, config.Config.Manager.AppManagerUid) { ownerUid = req.Uid } else { ownerUid = claims.UID