fix: improve condition check. (#2815)

pull/2818/head
Monet Lee 2 months ago committed by GitHub
parent 61fc9bffec
commit 269dd7180f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1811,7 +1811,6 @@ func (g *groupServer) GetSpecifiedUserGroupRequestInfo(ctx context.Context, req
} }
if req.UserID != opUserID { if req.UserID != opUserID {
req.UserID = mcontext.GetOpUserID(ctx)
adminIDs, err := g.db.GetGroupRoleLevelMemberIDs(ctx, req.GroupID, constant.GroupAdmin) adminIDs, err := g.db.GetGroupRoleLevelMemberIDs(ctx, req.GroupID, constant.GroupAdmin)
if err != nil { if err != nil {
return nil, err return nil, err
@ -1820,10 +1819,11 @@ func (g *groupServer) GetSpecifiedUserGroupRequestInfo(ctx context.Context, req
adminIDs = append(adminIDs, owners[0].UserID) adminIDs = append(adminIDs, owners[0].UserID)
adminIDs = append(adminIDs, g.config.Share.IMAdminUserID...) adminIDs = append(adminIDs, g.config.Share.IMAdminUserID...)
if !datautil.Contain(req.UserID, adminIDs...) { if !datautil.Contain(opUserID, adminIDs...) {
return nil, errs.ErrNoPermission.WrapMsg("opUser no permission") return nil, errs.ErrNoPermission.WrapMsg("opUser no permission")
} }
} }
requests, err := g.db.FindGroupRequests(ctx, req.GroupID, []string{req.UserID}) requests, err := g.db.FindGroupRequests(ctx, req.GroupID, []string{req.UserID})
if err != nil { if err != nil {
return nil, err return nil, err

Loading…
Cancel
Save