コード例 #1
0
        public void MakeItSoUser(User user, ApplicationProfile app)
        {
            _logger.LogInformation($"Checking to see if user {user.email_address} already exists.");
            if (!_veracodeService.DoesUserExist(user))
            {
                _logger.LogInformation($"User {user.email_address} does not exist, adding configuration.");
                try
                {
                    _veracodeService.CreateUser(user, app);
                    _logger.LogInformation($"User {user.email_address} created succesfully.");
                }
                catch (Exception e)
                {
                    _logger.LogError($"User {user.email_address} could not be created!");
                    _logger.LogError($"{e.Message}.");
                }
                return;
            }

            _logger.LogInformation($"User {user.email_address} exists.");
            if (_veracodeService.HasUserChanged(user))
            {
                _logger.LogInformation($"User {user.email_address} has changed, updating configuration.");
                try
                {
                    _veracodeService.UpdateUser(user);
                    _logger.LogInformation($"User {user.email_address} updated succesfully.");
                }
                catch (Exception e)
                {
                    _logger.LogError($"User {user.email_address} could not be updated!");
                    _logger.LogError($"{e.Message}.");
                }
                return;
            }

            _logger.LogInformation($"User {user.email_address} has no changes.");
        }