Skip to content

Commit 8cb6e7d

Browse files
committed
editoast: no auth for listing signaling systems
Signed-off-by: Tristram Gräbener <tristram+git@tristramg.eu>
1 parent d1389d4 commit 8cb6e7d

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

editoast/src/views/sprites.rs

+1-22
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ use axum::extract::Json;
22
use axum::extract::Path;
33
use axum::extract::Request;
44
use axum::response::IntoResponse;
5-
use axum::Extension;
6-
use editoast_authz::BuiltinRole;
75
use editoast_derive::EditoastError;
86
use thiserror::Error;
97
use tower::ServiceExt;
@@ -12,8 +10,6 @@ use tower_http::services::ServeFile;
1210
use crate::client::get_dynamic_assets_path;
1311
use crate::error::Result;
1412
use crate::generated_data::sprite_config::SpriteConfig;
15-
use crate::views::AuthenticationExt;
16-
use crate::views::AuthorizationError;
1713

1814
crate::routes! {
1915
"/sprites" => {
@@ -41,15 +37,7 @@ enum SpriteErrors {
4137
(status = 200, description = "List of supported signaling systems", body = Vec<String>, example = json!(["BAL", "TVM300"])),
4238
),
4339
)]
44-
async fn signaling_systems(Extension(auth): AuthenticationExt) -> Result<Json<Vec<String>>> {
45-
let authorized = auth
46-
.check_roles([BuiltinRole::MapRead].into())
47-
.await
48-
.map_err(AuthorizationError::AuthError)?;
49-
if !authorized {
50-
return Err(AuthorizationError::Forbidden.into());
51-
}
52-
40+
async fn signaling_systems() -> Result<Json<Vec<String>>> {
5341
let sprite_configs = SpriteConfig::load();
5442
let signaling_systems = sprite_configs.keys().cloned().collect();
5543
Ok(Json(signaling_systems))
@@ -69,18 +57,9 @@ async fn signaling_systems(Extension(auth): AuthenticationExt) -> Result<Json<Ve
6957
),
7058
)]
7159
async fn sprites(
72-
Extension(auth): AuthenticationExt,
7360
Path((signaling_system, file_name)): Path<(String, String)>,
7461
request: Request,
7562
) -> Result<impl IntoResponse> {
76-
let authorized = auth
77-
.check_roles([BuiltinRole::MapRead].into())
78-
.await
79-
.map_err(AuthorizationError::AuthError)?;
80-
if !authorized {
81-
return Err(AuthorizationError::Forbidden.into());
82-
}
83-
8463
let sprite_configs = SpriteConfig::load();
8564
if signaling_system != "default" && !sprite_configs.contains_key(&signaling_system) {
8665
return Err(SpriteErrors::UnknownSignalingSystem { signaling_system }.into());

0 commit comments

Comments
 (0)