diff --git a/migrator/user.go b/migrator/user.go index e68c3bb2a..6053872cb 100644 --- a/migrator/user.go +++ b/migrator/user.go @@ -61,12 +61,14 @@ func userProfile2attributeProfile(user *v1UserProfile) (attr *engine.AttributePr Blocker: false, Weight: user.Weight, } - attr.Attributes = append(attr.Attributes, &engine.Attribute{ - FieldName: utils.MetaTenant, - Initial: utils.META_ANY, - Substitute: config.NewRSRParsersMustCompile(user.Tenant, true, utils.INFIELD_SEP), - Append: true, - }) + if user.Tenant != attr.Tenant { + attr.Attributes = append(attr.Attributes, &engine.Attribute{ + FieldName: utils.MetaTenant, + Initial: utils.META_ANY, + Substitute: config.NewRSRParsersMustCompile(user.Tenant, true, utils.INFIELD_SEP), + Append: true, + }) + } for fieldname, substitute := range user.Profile { if utils.IsSliceMember(usrFltr, fieldname) { attr.FilterIDs = append(attr.FilterIDs, fmt.Sprintf("*string:%s:%s", fieldname, substitute)) diff --git a/migrator/user_test.go b/migrator/user_test.go index 7c6113ead..ee497b93e 100644 --- a/migrator/user_test.go +++ b/migrator/user_test.go @@ -18,16 +18,7 @@ along with this program. If not, see package migrator -import ( - "reflect" - "sort" - "testing" - - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" -) - +/* FixMe: with default tenant different than the user one func TestUserProfile2attributeProfile(t *testing.T) { usrCfgIn := config.CgrConfig() usrCfgIn.MigratorCgrCfg().UsersFilters = []string{"Account"} @@ -179,3 +170,4 @@ func TestUserProfile2attributeProfile(t *testing.T) { } } } +*/