Skip to content

Commit

Permalink
Minor changes to recent PRs (OrchardCMS#16891)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeAlhayek authored Oct 16, 2024
1 parent 4adf49b commit 7ede2ef
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ namespace OrchardCore.DataProtection.Azure;
/// <summary>
/// A tenant event that deletes data protection blobs from a container when a tenant is deleted.
/// </summary>
public class BlobModularTenantEvents : ModularTenantEvents
internal sealed class BlobModularTenantEvents : ModularTenantEvents
{
private readonly BlobOptions _blobOptions;
private readonly ILogger<BlobModularTenantEvents> _logger;
private readonly ILogger _logger;

public BlobModularTenantEvents(
BlobOptions blobOptions,
Expand All @@ -25,7 +25,7 @@ public BlobModularTenantEvents(
/// Removes the data protection blob from the container when a tenant is deleted.
/// </summary>
/// <param name="context">The <see cref="ShellRemovingContext"/></param>
public async override Task RemovingAsync(ShellRemovingContext context)
public override Task RemovingAsync(ShellRemovingContext context)
{
var blobClient = new BlobClient(
_blobOptions.ConnectionString,
Expand All @@ -34,6 +34,6 @@ public async override Task RemovingAsync(ShellRemovingContext context)

_logger.LogDebug("Deleting blob '{BlobName}' from container '{ContainerName}'.", _blobOptions.BlobName, _blobOptions.ContainerName);

await blobClient.DeleteIfExistsAsync();
return blobClient.DeleteIfExistsAsync();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Fluid.Values;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using OrchardCore.Liquid;
using OrchardCore.Security;
using OrchardCore.Security.Permissions;
Expand Down Expand Up @@ -46,6 +47,10 @@ public static ValueTask<FluidValue> HasClaim(FluidValue input, FilterArguments a
if (string.Equals(claimType, Permission.ClaimType, StringComparison.OrdinalIgnoreCase) &&
user.HasClaim(StandardClaims.SiteOwner.Type, StandardClaims.SiteOwner.Value))
{
var logger = context.Services.GetRequiredService<ILogger<Startup>>();

logger.LogWarning("The tenant is using the 'has_claim' Liquid filter for Permission claims '{ClaimName}', which will break in the next major release of OrchardCore; please use 'has_permission: \"{ClaimName}\"' instead.", claimName, claimName);

return BooleanValue.True;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,14 @@ public BlobShellsFileStore(IFileStore fileStore)
}

public Task<string> CreateFileFromStreamAsync(string path, Stream inputStream)
{
return _fileStore.CreateFileFromStreamAsync(path, inputStream, true);
}
=> _fileStore.CreateFileFromStreamAsync(path, inputStream, true);

public Task<IFileStoreEntry> GetFileInfoAsync(string path)
{
return _fileStore.GetFileInfoAsync(path);
}
=> _fileStore.GetFileInfoAsync(path);

public Task<Stream> GetFileStreamAsync(string path)
{
return _fileStore.GetFileStreamAsync(path);
}
=> _fileStore.GetFileStreamAsync(path);

public Task RemoveFileAsync(string path) => _fileStore.TryDeleteFileAsync(path);
public Task RemoveFileAsync(string path)
=> _fileStore.TryDeleteFileAsync(path);
}

0 comments on commit 7ede2ef

Please sign in to comment.