Beispiel #1
0
        public async Task <IActionResult> CreateAdminPermissions(string adGroup)
        {
            var requestId = Guid.NewGuid().ToString();

            _logger.LogInformation($"RequestID:{requestId} SetupController_CreateAdminPermissions called.");

            // Check to see if setup is enabled and if not respond with bad request
            var checkSetupState = await CheckSetupState();

            if (checkSetupState != null)
            {
                return(BadRequest(checkSetupState));
            }

            try
            {
                await _setupService.CreateSiteAdminPermissionsAsync(adGroup);
            }
            catch (Exception ex)
            {
                _logger.LogError($"RequestID:{requestId} SetupController_CreateAdminPermissions error: {ex.Message}");
                var errorResponse = JsonErrorResponse.BadRequest($"CreateAdminPermissions error: {ex.Message}", requestId);
                return(BadRequest(errorResponse));
            }
            return(NoContent());
        }