mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-06 05:12:10 +08:00
refactor: all module update.
This commit is contained in:
parent
49c699edea
commit
b477577747
@ -534,7 +534,7 @@ func (s *userServer) ProcessUserCommandGetAll(ctx context.Context, req *pbuser.P
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *userServer) AddNotificationAccount(ctx context.Context, req *pbuser.AddNotificationAccountReq) (*pbuser.AddNotificationAccountResp, error) {
|
func (s *userServer) AddNotificationAccount(ctx context.Context, req *pbuser.AddNotificationAccountReq) (*pbuser.AddNotificationAccountResp, error) {
|
||||||
if err := authverify.CheckIMAdmin(ctx, s.config); err != nil {
|
if err := authverify.CheckAdmin(ctx, &s.config.Share.IMAdmin); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -577,7 +577,7 @@ func (s *userServer) AddNotificationAccount(ctx context.Context, req *pbuser.Add
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *userServer) UpdateNotificationAccountInfo(ctx context.Context, req *pbuser.UpdateNotificationAccountInfoReq) (*pbuser.UpdateNotificationAccountInfoResp, error) {
|
func (s *userServer) UpdateNotificationAccountInfo(ctx context.Context, req *pbuser.UpdateNotificationAccountInfoReq) (*pbuser.UpdateNotificationAccountInfoResp, error) {
|
||||||
if err := authverify.CheckIMAdmin(ctx, s.config); err != nil {
|
if err := authverify.CheckAdmin(ctx, &s.config.Share.IMAdmin); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -604,7 +604,7 @@ func (s *userServer) UpdateNotificationAccountInfo(ctx context.Context, req *pbu
|
|||||||
|
|
||||||
func (s *userServer) SearchNotificationAccount(ctx context.Context, req *pbuser.SearchNotificationAccountReq) (*pbuser.SearchNotificationAccountResp, error) {
|
func (s *userServer) SearchNotificationAccount(ctx context.Context, req *pbuser.SearchNotificationAccountReq) (*pbuser.SearchNotificationAccountResp, error) {
|
||||||
// Check if user is an admin
|
// Check if user is an admin
|
||||||
if err := authverify.CheckIMAdmin(ctx, s.config); err != nil {
|
if err := authverify.CheckAdmin(ctx, &s.config.Share.IMAdmin); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -55,17 +55,6 @@ func CheckAdmin(ctx context.Context, imAdmin *config.IMAdmin) error {
|
|||||||
return servererrs.ErrNoPermission.WrapMsg(fmt.Sprintf("user %s is not admin userID", mcontext.GetOpUserID(ctx)))
|
return servererrs.ErrNoPermission.WrapMsg(fmt.Sprintf("user %s is not admin userID", mcontext.GetOpUserID(ctx)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func CheckIMAdmin(ctx context.Context, config *config.GlobalConfig) error {
|
|
||||||
if datautil.Contain(mcontext.GetOpUserID(ctx), config.IMAdmin.UserID...) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return servererrs.ErrNoPermission.WrapMsg(fmt.Sprintf("user %s is not CheckIMAdmin userID", mcontext.GetOpUserID(ctx)))
|
|
||||||
}
|
|
||||||
|
|
||||||
func ParseRedisInterfaceToken(redisToken any, secret string) (*tokenverify.Claims, error) {
|
|
||||||
return tokenverify.GetClaimFromToken(string(redisToken.([]uint8)), Secret(secret))
|
|
||||||
}
|
|
||||||
|
|
||||||
func IsManagerUserID(opUserID string, imAdmin *config.IMAdmin) bool {
|
func IsManagerUserID(opUserID string, imAdmin *config.IMAdmin) bool {
|
||||||
return datautil.Contain(opUserID, imAdmin.UserID...)
|
return datautil.Contain(opUserID, imAdmin.UserID...)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user