diff --git a/apier/v2/attributes.go b/apier/v2/attributes.go index 210b7a01d..9bb9ef382 100644 --- a/apier/v2/attributes.go +++ b/apier/v2/attributes.go @@ -33,9 +33,12 @@ type AttributeWithCache struct { //SetAttributeProfile add/update a new Attribute Profile func (APIerSv2 *APIerSv2) SetAttributeProfile(arg *AttributeWithCache, reply *string) error { - if missing := utils.MissingStructFields(arg.ExternalAttributeProfile, []string{utils.Tenant, utils.ID}); len(missing) != 0 { + if missing := utils.MissingStructFields(arg.ExternalAttributeProfile, []string{utils.ID}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } + if arg.Tenant == utils.EmptyString { + arg.Tenant = APIerSv2.Config.GeneralCfg().DefaultTenant + } alsPrf, err := arg.ExternalAttributeProfile.AsAttributeProfile() if err != nil { return utils.APIErrorHandler(err) diff --git a/dispatchers/cdrs.go b/dispatchers/cdrs.go index 92cf6d518..17790bb44 100644 --- a/dispatchers/cdrs.go +++ b/dispatchers/cdrs.go @@ -177,9 +177,9 @@ func (dS *DispatcherService) CDRsV1ProcessCDR(args *engine.CDRWithOpts, reply *s } func (dS *DispatcherService) CDRsV2ProcessEvent(args *engine.ArgV1ProcessEvent, reply *[]*utils.EventWithFlags) (err error) { - tnt := dS.cfg.GeneralCfg().DefaultTenant - if args.CGREvent.Tenant != utils.EmptyString { - tnt = args.CGREvent.Tenant + tnt := args.Tenant + if tnt == utils.EmptyString { + tnt = dS.cfg.GeneralCfg().DefaultTenant } if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.CDRsV2ProcessEvent, tnt, @@ -192,9 +192,9 @@ func (dS *DispatcherService) CDRsV2ProcessEvent(args *engine.ArgV1ProcessEvent, } func (dS *DispatcherService) CDRsV2StoreSessionCost(args *engine.ArgsV2CDRSStoreSMCost, reply *string) (err error) { - tnt := dS.cfg.GeneralCfg().DefaultTenant - if args.Tenant != utils.EmptyString { - tnt = args.Tenant + tnt := args.Tenant + if tnt == utils.EmptyString { + tnt = dS.cfg.GeneralCfg().DefaultTenant } if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.CDRsV2StoreSessionCost, tnt,