mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-24 16:48:45 +05:00
Migrator - only add user tenant if different than default
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -18,16 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
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) {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user