From b7c46370f89665b88596141024af6906f898c2cc Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 31 Aug 2018 16:38:21 +0000 Subject: [PATCH] --- devdocs/specs/core-import-v7.txt | 2 ++ server/AyaNova/biz/LocaleBiz.cs | 7 +++++++ server/AyaNova/biz/UserBiz.cs | 13 ++++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/devdocs/specs/core-import-v7.txt b/devdocs/specs/core-import-v7.txt index 0618668c..409ed596 100644 --- a/devdocs/specs/core-import-v7.txt +++ b/devdocs/specs/core-import-v7.txt @@ -72,6 +72,8 @@ IMPORTMAP NOTES FOR DOCS - Only an empty database is supported for import - Only one shot import, can't import again later +- LOCALES + - MUST be a default locale set before import because new raven keys will be added to imported v7 locale using the default locale only - IMPORTED USERS - login and passwords are not imported and need to be setup again after import - no Authorization Role is set and therefore no rights to anything. A role needs to be set after import for each user diff --git a/server/AyaNova/biz/LocaleBiz.cs b/server/AyaNova/biz/LocaleBiz.cs index 1f45ffbd..343313a2 100644 --- a/server/AyaNova/biz/LocaleBiz.cs +++ b/server/AyaNova/biz/LocaleBiz.cs @@ -437,6 +437,13 @@ namespace AyaNova.Biz } } + //Now add keys that were added after v7 for RAVEN using default locale values + foreach(string s in ValidKeys){ + if(!NewLocaleDict.ContainsKey(s)){ + NewLocaleDict.Add(s,GetDefaultLocalizedText(s).Result); + } + } + //Validate it's the correct number of keys expected if (NewLocaleDict.Count != ValidKeys.Count) { diff --git a/server/AyaNova/biz/UserBiz.cs b/server/AyaNova/biz/UserBiz.cs index b6324e46..4d8c3026 100644 --- a/server/AyaNova/biz/UserBiz.cs +++ b/server/AyaNova/biz/UserBiz.cs @@ -415,6 +415,14 @@ namespace AyaNova.Biz { var V7Id = new Guid(j["ID"].Value()); + //skip the administrator account but add it to the map for all the other import code that requires it + if (V7Id == new Guid("2ecc77fc-69e2-4a7e-b88d-bd0ecaf36aed")) + { + var mapItem = new ImportAyaNova7MapItem(V7Id, AyaType.User, 1); + importMap.Add(mapItem); + return true; + } + //Copy values User i = new User(); i.Name = j["FirstName"].Value() + " " + j["LastName"].Value(); @@ -438,7 +446,10 @@ namespace AyaNova.Biz i.Password = Hasher.hash(i.Salt, Hasher.GenerateSalt()); //No rights - i.Roles=AuthorizationRoles.NoRole; + i.Roles = AuthorizationRoles.NoRole; + + //temporary locale id to satisfy db settings + i.LocaleId = ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID; User o = await CreateAsync(i); if (HasErrors)