mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-06-03 05:34:21 -04:00
Changed scan to POST and added new API for route gurads on UI.
This commit is contained in:
parent
521eac266a
commit
55a44000fc
@ -85,7 +85,7 @@ namespace API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Authorize(Policy = "RequireAdminRole")]
|
[Authorize(Policy = "RequireAdminRole")]
|
||||||
[HttpGet("scan")]
|
[HttpPost("scan")]
|
||||||
public async Task<ActionResult> ScanLibrary(int libraryId)
|
public async Task<ActionResult> ScanLibrary(int libraryId)
|
||||||
{
|
{
|
||||||
var library = await _libraryRepository.GetLibraryDtoForIdAsync(libraryId);
|
var library = await _libraryRepository.GetLibraryDtoForIdAsync(libraryId);
|
||||||
|
@ -84,5 +84,17 @@ namespace API.Controllers
|
|||||||
{
|
{
|
||||||
return Ok(await _userRepository.GetMembersAsync());
|
return Ok(await _userRepository.GetMembersAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet("has-library-access")]
|
||||||
|
public async Task<ActionResult<bool>> HasLibraryAccess(int libraryId)
|
||||||
|
{
|
||||||
|
var user = await _userRepository.GetUserByUsernameAsync(User.GetUsername());
|
||||||
|
|
||||||
|
if (user == null) return BadRequest("Could not validate user");
|
||||||
|
|
||||||
|
var libs = await _libraryRepository.GetLibrariesForUsernameAysnc(user.UserName);
|
||||||
|
|
||||||
|
return Ok(libs.Any(x => x.Id == libraryId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user