diff options
author | metamuffin <metamuffin@disroot.org> | 2025-05-31 03:26:45 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-05-31 03:26:45 +0200 |
commit | 3e834092ba230ee081065a3b80ad227d585b5a13 (patch) | |
tree | b168d1524045716e6922c137f1ad92bdf3f47994 /server/src/helper/session.rs | |
parent | 3b15caade07e8fbe351fed9aceb3f435bf58368e (diff) | |
download | jellything-3e834092ba230ee081065a3b80ad227d585b5a13.tar jellything-3e834092ba230ee081065a3b80ad227d585b5a13.tar.bz2 jellything-3e834092ba230ee081065a3b80ad227d585b5a13.tar.zst |
get rid of admin session; checking manually instead
Diffstat (limited to 'server/src/helper/session.rs')
-rw-r--r-- | server/src/helper/session.rs | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/server/src/helper/session.rs b/server/src/helper/session.rs index 090330b..1417df0 100644 --- a/server/src/helper/session.rs +++ b/server/src/helper/session.rs @@ -6,7 +6,7 @@ use super::A; use crate::ui::error::MyError; use anyhow::anyhow; -use jellylogic::session::{bypass_auth_session, token_to_session, AdminSession, Session}; +use jellylogic::session::{bypass_auth_session, token_to_session, Session}; use log::warn; use rocket::{ async_trait, @@ -65,28 +65,3 @@ impl<'r> FromRequest<'r> for A<Session> { } } } - -#[async_trait] -impl<'r> FromRequest<'r> for A<AdminSession> { - type Error = MyError; - async fn from_request<'life0>( - request: &'r Request<'life0>, - ) -> request::Outcome<Self, Self::Error> { - match session_from_request(request).await { - Ok(x) => { - if x.user.admin { - Outcome::Success(A(AdminSession(x))) - } else { - Outcome::Error(( - Status::Unauthorized, - MyError(anyhow!("you are not an admin")), - )) - } - } - Err(e) => { - warn!("authentificated route rejected: {e:?}"); - Outcome::Forward(Status::Unauthorized) - } - } - } -} |