Skip to content

Commit e511043

Browse files
committed
- Improved BootOASISAsync in OASISBootLoader so the OASIS System Account check has been improved with integrity checks.
- Updated OASIS Runtime v3.2.2. - Fixed bugs in the OASIS.STAR.DNATemplates.OAPP.Console.DLL template.
1 parent e97be21 commit e511043

58 files changed

Lines changed: 30 additions & 32 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

NextGenSoftware.OASIS.OASISBootLoader/OASISBootLoader.cs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -226,16 +226,28 @@ public static async Task<OASISResult<bool>> BootOASISAsync(OASISDNA OASISDNA, bo
226226

227227
if (result.Result && !result.IsError)
228228
{
229-
if (!string.IsNullOrEmpty(OASISDNA.OASIS.OASISSystemAccountId))
230-
LoggingManager.Log($"OASISSystemAccountId Found In OASISDNA: {OASISDNA.OASIS.OASISSystemAccountId}.", LogType.Info);
229+
LoggingManager.BeginLogAction($"Looking For OASIS System Account For Email {OASISDNA.OASIS.Email.SmtpUser}...", LogType.Info);
230+
OASISResult<IAvatar> oasisSystemAccountResult = await AvatarManager.Instance.LoadAvatarByEmailAsync(OASISDNA.OASIS.Email.SmtpUser);
231+
232+
//if (!string.IsNullOrEmpty(OASISDNA.OASIS.OASISSystemAccountId))
233+
if (oasisSystemAccountResult != null && oasisSystemAccountResult.Result != null && !oasisSystemAccountResult.IsError)
234+
{
235+
LoggingManager.EndLogAction($"DONE", LogType.Info);
236+
LoggingManager.Log($"OASIS System Account Found: Id: {oasisSystemAccountResult.Result.Id}, Name: {oasisSystemAccountResult.Result.Name}, Email: {oasisSystemAccountResult.Result.Email}, Username: {oasisSystemAccountResult.Result.Username}, Type: {oasisSystemAccountResult.Result.AvatarType.Name}.", LogType.Info);
237+
238+
if (oasisSystemAccountResult.Result.AvatarType.Value != AvatarType.System || oasisSystemAccountResult.Result.Name != "OASIS SYSTEM" || oasisSystemAccountResult.Result.Username != "root")
239+
LoggingManager.Log($"OASIS System Account Invalid! Please change the SmtpUser to a different email in the Email section in the OASISDNA and then boot the OASIS again so a new OASIS System Account can be generated using the new email.", LogType.Error);
240+
else
241+
{
242+
//Make sure the OASISDNA is updated with the right id.
243+
OASISDNA.OASIS.OASISSystemAccountId = oasisSystemAccountResult.Result.Id.ToString();
244+
await OASISDNAManager.SaveDNAAsync(OASISDNAPath, OASISDNA);
245+
}
246+
}
231247
else
232248
{
233-
//LoggingManager.Log($"OASISSystemAccountId Not Found In OASISDNA So Generating Now...", LogType.Info, true, false, false, 1, true);
234-
LoggingManager.BeginLogAction($"OASISSystemAccountId Not Found In OASISDNA So Generating Now...", LogType.Info);
235-
236-
//TODO: Later may need to actually create a avatar for this Id? So we can see which ids belong to OASIS SYSTEM Accounts outside of each ONODE (each ONODE has its own OASISDNA with its own system id's)
237-
//OASISDNA.OASIS.OASISSystemAccountId = Guid.NewGuid().ToString();
238-
//await OASISDNAManager.SaveDNAAsync(OASISDNAPath, OASISDNA);
249+
LoggingManager.EndLogAction($"DONE", LogType.Info);
250+
LoggingManager.BeginLogAction($"OASIS System Account Not Found So Generating For Email {OASISDNA.OASIS.Email.SmtpUser} Now...", LogType.Info);
239251

240252
//TODO: Need to make this more secure in future to prevent others creating similar accounts (but none will ever have AvatarType of System, this is the only place that can be created but we need to make sure a normal user accout is not hacked or changed to a system one. But currently it cannot do any harm because this system account is currently not used for anything, it simply creates the default OASIS Omniverse when STAR CLI first boots up on a running ONODE (before a avatar is created or logged in).
241253
CLIEngine.SupressConsoleLogging = true;
@@ -248,7 +260,7 @@ public static async Task<OASISResult<bool>> BootOASISAsync(OASISDNA OASISDNA, bo
248260
await OASISDNAManager.SaveDNAAsync(OASISDNAPath, OASISDNA);
249261

250262
LoggingManager.EndLogAction($"DONE", LogType.Info);
251-
LoggingManager.Log($"OASISSystemAccountId Generated: {OASISDNA.OASIS.OASISSystemAccountId}.", LogType.Info);
263+
LoggingManager.Log($"OASIS System Account Generated: Id: {avatarResult.Result.Id}, Name: {avatarResult.Result.Name}, Email: {avatarResult.Result.Email}, Username: {avatarResult.Result.Username}, Type: {avatarResult.Result.AvatarType.Name}.", LogType.Info);
252264
}
253265
else
254266
OASISErrorHandling.HandleError(ref result, $"Error Occured In OASISBootLoader.BootOASISAsync Calling AvatarManager.Instance.RegisterAsync Attempting To Create The OASISSystem Account. Reason: {avatarResult.Message}");

NextGenSoftware.OASIS.STAR.DNATemplates.OAPP.Console.DLL/Program.cs

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
if (!holonsReuslt.IsError && holonsReuslt.Result != null)
2323
{
24-
CLIEngine.ShowErrorMessage($"{holonsReuslt.Result.Count()} Child Holons Loaded.");
24+
CLIEngine.ShowSuccessMessage($"{holonsReuslt.Result.Count()} Child Holons Loaded.");
2525
STARCLI.ShowHolons(holonsReuslt.Result);
2626
}
2727
else
@@ -64,8 +64,7 @@
6464
if (!loadHolonResult.IsError && loadHolonResult.Result != null)
6565
{
6666
holon = loadHolonResult.Result;
67-
ShowHolon(saveHolonResult.Result, "saveHolonResult: Test Holon Loaded (Using Zome).");
68-
ShowHolon(holon, "holon: Test Holon Loaded (Using Zome).");
67+
ShowHolon(loadHolonResult.Result, "loadHolonResult: Test Holon Loaded (Using Zome).");
6968
}
7069
else
7170
CLIEngine.ShowErrorMessage($"Error Loading Holon (Using Zome). Reason: {loadHolonResult.Message}");
@@ -94,10 +93,7 @@
9493
OASISResult<{HOLON}> loadHolonResult = await zome.GlobalHolonData.LoadHolonAsync<{HOLON}> (holon.Id);
9594

9695
if (!loadHolonResult.IsError && loadHolonResult.Result != null)
97-
{
98-
ShowHolon(saveHolonResult.Result, "saveHolonResult: Test Holon Loaded (Using Zome GlobalHolonData Generic SaveAsync).");
99-
ShowHolon(holon, "holon: Test Holon Loaded (Using Zome GlobalHolonData Generic SaveAsync).");
100-
}
96+
ShowHolon(loadHolonResult.Result, "loadHolonResult: Test Holon Loaded (Using Zome GlobalHolonData Generic SaveAsync).");
10197
else
10298
CLIEngine.ShowErrorMessage($"Error Loading Holon (Using Zome GlobalHolonData Generic LoadAsync). Reason: {loadHolonResult.Message}");
10399
}
@@ -127,10 +123,7 @@
127123
OASISResult<IHolon> loadHolonResult = await zome.GlobalHolonData.LoadHolonAsync(holon.Id);
128124

129125
if (!loadHolonResult.IsError && loadHolonResult.Result != null)
130-
{
131-
ShowHolon(saveGlobalHolonResult.Result, "saveGlobalHolonResult: Test Holon Loaded (Using Zome GlobalHolonData Standard SaveAsync).");
132-
ShowHolon(holon, "holon: Test Holon Loaded (Using Zome GlobalHolonData Standard SaveAsync).");
133-
}
126+
ShowHolon(loadHolonResult.Result, "loadHolonResult: Test Holon Loaded (Using Zome GlobalHolonData Standard SaveAsync).");
134127
else
135128
CLIEngine.ShowErrorMessage($"Error Loading Holon (Using Zome GlobalHolonData Standard LoadAsync). Reason: {loadHolonResult.Message}");
136129
}
@@ -147,8 +140,8 @@
147140

148141
//CelestialBodyOnly:{CELESTIALBODY} {CELESTIALBODYVAR} = new {CELESTIALBODY}();
149142
//CelestialBodyOnly:saveHolonResult = await {CELESTIALBODYVAR}.Save{HOLON}Async(holon);
150-
//CelestialBodyOnly://saveHolonResult = await supermama.GlobalHolonData.SaveHolonAsync<{HOLON}>(holon); //Alternatively you can use the generic GlobalHolonData functions just like you could with the zome example above (GlobalHolonData is available on ALL COSMIC objects so includes CelestialBodies, CelesitalSpaces, Zomes & Holons).
151-
//CelestialBodyOnly://saveGlobalHolonResult = await supermama.GlobalHolonData.SaveHolonAsync(holon);
143+
//CelestialBodyOnly://saveHolonResult = await {CELESTIALBODY}.GlobalHolonData.SaveHolonAsync<{HOLON}>(holon); //Alternatively you can use the generic GlobalHolonData functions just like you could with the zome example above (GlobalHolonData is available on ALL COSMIC objects so includes CelestialBodies, CelesitalSpaces, Zomes & Holons).
144+
//CelestialBodyOnly://saveGlobalHolonResult = await {CELESTIALBODY}.GlobalHolonData.SaveHolonAsync(holon);
152145

153146
//CelestialBodyOnly:if (!saveHolonResult.IsError && saveHolonResult.Result != null)
154147
//CelestialBodyOnly:{
@@ -160,8 +153,7 @@
160153

161154
//CelestialBodyOnly:if (!loadHolonResult.IsError && loadHolonResult.Result != null)
162155
//CelestialBodyOnly:{
163-
//CelestialBodyOnly:ShowHolon(saveGlobalHolonResult.Result, "saveGlobalHolonResult: Test Holon Loaded (Using CelestialBody).");
164-
//CelestialBodyOnly:ShowHolon(holon, "holon: Test Holon Loaded (Using CelestialBody).");
156+
//CelestialBodyOnly:ShowHolon(loadHolonResult.Result, "loadHolonResult: Test Holon Loaded (Using CelestialBody).");
165157
//CelestialBodyOnly:}
166158
//CelestialBodyOnly:else
167159
//CelestialBodyOnly:CLIEngine.ShowErrorMessage($"Error Loading Holon (Using Zome GlobalHolonData Standard LoadAsync). Reason: {loadHolonResult.Message}");
@@ -192,10 +184,7 @@
192184
OASISResult<{HOLON}> loadHolonResult = await holon.LoadAsync<{HOLON}>();
193185

194186
if (!loadHolonResult.IsError && loadHolonResult.Result != null)
195-
{
196-
ShowHolon(saveHolonResult.Result, "saveHolonResult: Test Holon Loaded (Using Holon).");
197-
ShowHolon(holon, "holon: Test Holon Loaded (Using Holon).");
198-
}
187+
ShowHolon(loadHolonResult.Result, "loadHolonResult: Test Holon Loaded (Using Holon).");
199188
else
200189
CLIEngine.ShowErrorMessage($"Error Loading Holon (Using Holon). Reason: {loadHolonResult.Message}");
201190
}
@@ -227,10 +216,7 @@
227216
OASISResult<{HOLON}> loadHolonResult = await STAR.OASISAPI.Data.LoadHolonAsync<{HOLON}>(holon.Id);
228217

229218
if (!loadHolonResult.IsError && loadHolonResult.Result != null)
230-
{
231-
ShowHolon(saveHolonResult.Result, "saveHolonResult: Test Holon Loaded (Using Data API).");
232-
ShowHolon(holon, "holon: Test Holon Loaded (Using Data API).");
233-
}
219+
ShowHolon(loadHolonResult.Result, "loadHolonResult: Test Holon Loaded (Using Data API).");
234220
else
235221
CLIEngine.ShowErrorMessage($"Error Loading Holon (Using Data API). Reason: {loadHolonResult.Message}");
236222
}

0 commit comments

Comments
 (0)