-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added 'view' permissions for media folders. (#15173)
Co-authored-by: Zoltán Lehóczky <[email protected]> Co-authored-by: Hisham Bin Ateya <[email protected]>
- Loading branch information
1 parent
2b30e68
commit 9cf1f78
Showing
32 changed files
with
1,116 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/OrchardCore.Modules/OrchardCore.Media/Events/SecureMediaFileStoreEventHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System.Threading.Tasks; | ||
using OrchardCore.Environment.Cache; | ||
using OrchardCore.Media.Core.Events; | ||
|
||
namespace OrchardCore.Media.Events; | ||
|
||
internal sealed class SecureMediaFileStoreEventHandler : MediaEventHandlerBase | ||
{ | ||
private readonly ISignal _signal; | ||
|
||
public SecureMediaFileStoreEventHandler(ISignal signal) | ||
{ | ||
_signal = signal; | ||
} | ||
|
||
public override Task MediaCreatedDirectoryAsync(MediaCreatedContext context) | ||
{ | ||
if (context.Result) | ||
{ | ||
SignalDirectoryChange(); | ||
} | ||
|
||
return Task.CompletedTask; | ||
} | ||
|
||
public override Task MediaDeletedDirectoryAsync(MediaDeletedContext context) | ||
{ | ||
if (context.Result) | ||
{ | ||
SignalDirectoryChange(); | ||
} | ||
|
||
return Task.CompletedTask; | ||
} | ||
|
||
private void SignalDirectoryChange() => _signal.DeferredSignalToken(nameof(SecureMediaPermissions)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.