Skip to content

Commit

Permalink
[FIX] Added better logging
Browse files Browse the repository at this point in the history
  • Loading branch information
MathisBurger committed Oct 11, 2024
1 parent c5a7bd2 commit 95fd869
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tasky/src/auth_middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 95fd869

Please sign in to comment.