Fixing bad location index
This commit is contained in:
@@ -64,9 +64,23 @@ public class CharactersController : ControllerBase
|
||||
return Unauthorized();
|
||||
|
||||
var allowAnyOwner = User.IsInRole("SUPER");
|
||||
var character = await _characters.GetForOwnerByIdAsync(id, userId, allowAnyOwner);
|
||||
var character = await _characters.GetByIdAsync(id);
|
||||
if (character is null)
|
||||
{
|
||||
_logger.LogWarning("Visible locations request failed: character {CharacterId} was not found.", id);
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
if (!allowAnyOwner && character.OwnerUserId != userId)
|
||||
{
|
||||
_logger.LogWarning(
|
||||
"Visible locations request denied: character {CharacterId} belongs to owner {OwnerUserId}, request user was {UserId}",
|
||||
id,
|
||||
character.OwnerUserId,
|
||||
userId
|
||||
);
|
||||
return Forbid();
|
||||
}
|
||||
|
||||
_logger.LogInformation(
|
||||
"Visible locations requested for character {CharacterId} at ({X},{Y}) radius {VisionRadius} by user {UserId}",
|
||||
|
||||
Reference in New Issue
Block a user