|
|
@ -38,6 +38,9 @@ func CheckAccessV3(ctx context.Context, ownerUserID string) (err error) {
|
|
|
|
if utils.IsContain(opUserID, config.Config.Manager.UserID) {
|
|
|
|
if utils.IsContain(opUserID, config.Config.Manager.UserID) {
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if utils.IsContain(opUserID, config.Config.IMAdmin.UserID) {
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
if opUserID == ownerUserID {
|
|
|
|
if opUserID == ownerUserID {
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -45,13 +48,16 @@ func CheckAccessV3(ctx context.Context, ownerUserID string) (err error) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func IsAppManagerUid(ctx context.Context) bool {
|
|
|
|
func IsAppManagerUid(ctx context.Context) bool {
|
|
|
|
return utils.IsContain(mcontext.GetOpUserID(ctx), config.Config.Manager.UserID)
|
|
|
|
return utils.IsContain(mcontext.GetOpUserID(ctx), config.Config.Manager.UserID) || utils.IsContain(mcontext.GetOpUserID(ctx), config.Config.IMAdmin.UserID)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func CheckAdmin(ctx context.Context) error {
|
|
|
|
func CheckAdmin(ctx context.Context) error {
|
|
|
|
if utils.IsContain(mcontext.GetOpUserID(ctx), config.Config.Manager.UserID) {
|
|
|
|
if utils.IsContain(mcontext.GetOpUserID(ctx), config.Config.Manager.UserID) {
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if utils.IsContain(mcontext.GetOpUserID(ctx), config.Config.IMAdmin.UserID) {
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
return errs.ErrNoPermission.Wrap(fmt.Sprintf("user %s is not admin userID", mcontext.GetOpUserID(ctx)))
|
|
|
|
return errs.ErrNoPermission.Wrap(fmt.Sprintf("user %s is not admin userID", mcontext.GetOpUserID(ctx)))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func CheckIMAdmin(ctx context.Context) error {
|
|
|
|
func CheckIMAdmin(ctx context.Context) error {
|
|
|
@ -69,7 +75,8 @@ func ParseRedisInterfaceToken(redisToken any) (*tokenverify.Claims, error) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func IsManagerUserID(opUserID string) bool {
|
|
|
|
func IsManagerUserID(opUserID string) bool {
|
|
|
|
return utils.IsContain(opUserID, config.Config.Manager.UserID)
|
|
|
|
return utils.IsContain(opUserID, config.Config.Manager.UserID) || utils.IsContain(opUserID, config.Config.IMAdmin.UserID)
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func WsVerifyToken(token, userID string, platformID int) error {
|
|
|
|
func WsVerifyToken(token, userID string, platformID int) error {
|
|
|
|