public ApiClient CreateNewSandboxClient(string sandboxName, SandboxOptions sandboxOptions, User user) { if (user.ApiClients.Count >= _maximumSandboxesPerUser) { var message = $"The maximum of {_maximumSandboxesPerUser} sandboxes for user id {user.UserId} has been reached!"; message += " To configure please update the 'MaximumSandboxesPerUser' app setting in the web.config."; _log.Error(message); throw new ArgumentOutOfRangeException(message); } var client = SetupDefaultSandboxClient(sandboxName, sandboxOptions, user); ProvisionSandbox(client); var leaIds = _templateDatabaseLeaQuery.GetLocalEducationAgencyIds(client.Key); _defaultApplicationCreator.AddLeaIdsToApplication(leaIds, client.Application.ApplicationId); return(client); }
public void UpdateClientWithLEAIdsFromPopulatedSandbox() { foreach (var user in _settings.Users) { var clientProfile = _clientAppRepo.GetUser(user.Email); // look through all the sandboxes that are populated so we can get the lea ids from the created sandbox. // note our current template process has the populated data with lea's installed in it. foreach (var apiClient in clientProfile.ApiClients) { var leaIds = _templateDatabaseLeaQuery.GetLocalEducationAgencyIds(apiClient.Key).ToList(); _applicationCreator.AddLeaIdsToApplication(leaIds, apiClient.Application.ApplicationId); } } }