Limit what API does when not in used in Install level

(cherry picked from commit 7b00c0d3e9)
This commit is contained in:
Bjarke Berg
2022-09-05 21:11:17 +02:00
committed by Sebastiaan Janssen
parent 7852220827
commit 5500f87223

View File

@@ -87,11 +87,15 @@ public class InstallApiController : ControllerBase
[HttpPost]
public async Task<ActionResult> CompleteInstall()
{
RuntimeLevel levelBeforeRestart = _runtime.State.Level;
await _runtime.RestartAsync();
BackOfficeIdentityUser identityUser =
await _backOfficeUserManager.FindByIdAsync(Constants.Security.SuperUserIdAsString);
_backOfficeSignInManager.SignInAsync(identityUser, false);
if (levelBeforeRestart == RuntimeLevel.Install)
{
BackOfficeIdentityUser identityUser = await _backOfficeUserManager.FindByIdAsync(Core.Constants.Security.SuperUserIdAsString);
_backOfficeSignInManager.SignInAsync(identityUser, false);
}
return NoContent();
}