Ejemplo n.º 1
0
        public async Task DropUserAsync(string username, DropUserOptions options = null)
        {
            options = options ?? DropUserOptions.Default;
            var uri = GetUsersUri(options.DomainName, username);

            Logger.LogInformation($"Attempting to drop user with username {username} - {uri}");

            try
            {
                // drop user
                var result = await _client.DeleteAsync(uri, options.CancellationToken).ConfigureAwait(false);

                if (result.StatusCode == HttpStatusCode.NotFound)
                {
                    throw new UserNotFoundException(username);
                }

                result.EnsureSuccessStatusCode();
            }
            catch (Exception exception)
            {
                Logger.LogError(exception, $"Error trying to drop user with username {username} - {uri}");
                throw;
            }
        }
Ejemplo n.º 2
0
        public static Task DropUserAsync(this IUserManager userManager, string username, Action <DropUserOptions> configureOptions)
        {
            var options = new DropUserOptions();

            configureOptions(options);

            return(userManager.DropUserAsync(username, options));
        }