Adjust shift plan based on authentication

This commit is contained in:
Simon Goller 2024-06-14 13:23:12 +02:00
parent f894bf325d
commit b4b926a8e4
10 changed files with 499 additions and 97 deletions

View file

@ -70,6 +70,24 @@ where
}
}
async fn check_user(
&self,
user: &str,
context: Authentication<Self::Context>,
) -> Result<(), ServiceError> {
match context {
Authentication::Full => Ok(()),
Authentication::Context(context) => {
let current_user = self.user_service.current_user(context).await?;
if current_user.as_ref() == user {
Ok(())
} else {
Err(service::ServiceError::Forbidden)
}
}
}
}
async fn get_privileges_for_current_user(
&self,
context: Authentication<Self::Context>,