mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-06-03 13:44:31 -04:00
Ensure only admins can call getDirectories
This commit is contained in:
parent
f8ccc5a01f
commit
f8c50b40bb
@ -42,12 +42,10 @@ namespace API.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path"></param>
|
/// <param name="path"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
[Authorize(Policy = "RequireAdminRole")]
|
||||||
[HttpGet("list")]
|
[HttpGet("list")]
|
||||||
public ActionResult<IEnumerable<string>> GetDirectories(string path)
|
public ActionResult<IEnumerable<string>> GetDirectories(string path)
|
||||||
{
|
{
|
||||||
// TODO: We need some sort of validation other than our auth layer
|
|
||||||
_logger.Log(LogLevel.Debug, "Listing Directories for " + path);
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
return Ok(Directory.GetLogicalDrives());
|
return Ok(Directory.GetLogicalDrives());
|
||||||
@ -57,7 +55,7 @@ namespace API.Controllers
|
|||||||
|
|
||||||
return Ok(_directoryService.ListDirectory(path));
|
return Ok(_directoryService.ListDirectory(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<ActionResult<IEnumerable<LibraryDto>>> GetLibraries()
|
public async Task<ActionResult<IEnumerable<LibraryDto>>> GetLibraries()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user