Skip to content

Commit

Permalink
fix: all data permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtread committed Apr 27, 2024
1 parent 7eb2f41 commit 23ffb1e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/routes/players.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,16 @@ impl Serialize for PlayerDataMap {
///
/// `player_id` The ID of the player
pub async fn all_data(
_: AdminAuth,
Auth(auth): Auth,
Path(player_id): Path<PlayerID>,
Extension(db): Extension<DatabaseConnection>,
) -> PlayersRes<PlayerDataMap> {
let player: Player = find_player(&db, player_id).await?;

if !auth.has_permission_over(&player) {
return Err(PlayersError::InvalidPermission);
}

let data = PlayerData::all(&db, player_id).await?;
Ok(Json(PlayerDataMap(data)))
}
Expand Down

0 comments on commit 23ffb1e

Please sign in to comment.