Updated apiers by adding tenant default value in apier/v2

This commit is contained in:
porosnicuadrian
2020-10-15 16:59:00 +03:00
committed by Dan Christian Bogos
parent 010a7e92c7
commit 5baaeba5a8
2 changed files with 10 additions and 7 deletions

View File

@@ -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)

View File

@@ -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,