From 95fd8696a6caa66df2ee337b4a0a5398aca04a3b Mon Sep 17 00:00:00 2001 From: Mathis Burger Date: Fri, 11 Oct 2024 19:28:42 +0200 Subject: [PATCH] [FIX] Added better logging --- tasky/src/auth_middleware.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tasky/src/auth_middleware.rs b/tasky/src/auth_middleware.rs index 4ba4786..a236ff0 100644 --- a/tasky/src/auth_middleware.rs +++ b/tasky/src/auth_middleware.rs @@ -2,6 +2,7 @@ use actix_web::dev::{forward_ready, Service, ServiceRequest, ServiceResponse, Tr use actix_web::error::ErrorUnauthorized; use actix_web::{web, Error, HttpMessage}; use futures::future::LocalBoxFuture; +use log::info; use std::fmt::Display; use std::future::{ready, Ready}; @@ -17,7 +18,7 @@ pub struct UserData { } /// All roles a user can have -#[derive(Clone, PartialEq)] +#[derive(Clone, PartialEq, Debug)] pub enum UserRole { RoleAdmin, RoleTutor, @@ -124,6 +125,8 @@ where .map(|g| g.id) .collect(); + info!(target: "auth", "{}", format!("ID: {}, Roles: {:?}", uid, uroles)); + req.extensions_mut().insert(UserData { user_id: uid, user_roles: uroles,