@@ -109,7 +109,7 @@ pub async fn registry_v2_check(
109109pub async fn auth_handler (
110110 State ( state) : State < Arc < AppState > > ,
111111 Query ( auth_req) : Query < AuthRequest > ,
112- headers : HeaderMap
112+ headers : HeaderMap ,
113113) -> impl IntoResponse {
114114 debug ! (
115115 service = auth_req. service,
@@ -238,34 +238,48 @@ pub async fn auth_handler(
238238 let mut scope_parts_clone = scope_parts. clone ( ) ;
239239 let library_scope = format ! ( "library/{}" , scope_parts_clone[ 1 ] ) ;
240240 scope_parts_clone[ 1 ] = & library_scope;
241- info ! ( "Converted scope {} -> {}" , auth_req. scope. clone( ) . unwrap_or_default( ) , library_scope) ;
241+ info ! (
242+ "Converted scope {} -> {}" ,
243+ auth_req. scope. clone( ) . unwrap_or_default( ) ,
244+ library_scope
245+ ) ;
242246 auth_req. scope = Some ( scope_parts_clone. join ( ":" ) ) ;
243247 } else {
244248 // Check if user is admin of the specified game scope
245249 match state. database . get_game_by_namespace ( namespace) . await {
246250 Ok ( Some ( game) ) => {
247251 if !game. is_admin ( user. id ) {
248- warn ! ( "User '{}' is not admin of game {}: {}" , username, game. id, game. bucket) ;
252+ warn ! (
253+ "User '{}' is not admin of game {}: {}" ,
254+ username, game. id, game. bucket
255+ ) ;
249256 return create_error_response (
250257 StatusCode :: UNAUTHORIZED ,
251258 "Access denied" ,
252259 ) ;
253260 }
254261 let bucket_clone = game. bucket . clone ( ) ;
255262 if bucket_clone != namespace {
256- // convert namespace from id to bucket
257- let mut scope_image_parts = scope_image_parts. to_vec ( ) ;
258- scope_image_parts[ 0 ] = & bucket_clone;
259- let mut scope_parts = scope_parts. to_vec ( ) ;
260- let scope_name = scope_image_parts. join ( "/" ) ;
261- scope_parts[ 1 ] = & scope_name;
262- let new_scope = scope_parts. join ( ":" ) ;
263- info ! ( "Converted scope {} -> {}" , auth_req. scope. unwrap_or_default( ) , new_scope) ;
264- auth_req. scope = Some ( new_scope) ;
263+ // convert namespace from id to bucket
264+ let mut scope_image_parts = scope_image_parts. to_vec ( ) ;
265+ scope_image_parts[ 0 ] = & bucket_clone;
266+ let mut scope_parts = scope_parts. to_vec ( ) ;
267+ let scope_name = scope_image_parts. join ( "/" ) ;
268+ scope_parts[ 1 ] = & scope_name;
269+ let new_scope = scope_parts. join ( ":" ) ;
270+ info ! (
271+ "Converted scope {} -> {}" ,
272+ auth_req. scope. unwrap_or_default( ) ,
273+ new_scope
274+ ) ;
275+ auth_req. scope = Some ( new_scope) ;
265276 }
266277 }
267278 Ok ( None ) => {
268- warn ! ( user = username, "Game not found for namespace: {}" , namespace) ;
279+ warn ! (
280+ user = username,
281+ "Game not found for namespace: {}" , namespace
282+ ) ;
269283 return create_error_response ( StatusCode :: UNAUTHORIZED , "Access denied" ) ;
270284 }
271285 Err ( e) => {
0 commit comments