Bump to opentelemetry 0.31

This commit is contained in:
Maurus Decimus
2026-04-09 15:57:43 +02:00
parent 83c79d1fd7
commit ef8e56b4ca
8 changed files with 135 additions and 155 deletions

View File

@@ -15,8 +15,7 @@ pub mod diagnose;
use crate::{
api::diagnose::{DeliveryStage, spawn_delivery_diagnose},
auth::{
authenticate::Authenticator, oauth::auth::OAuthApiHandler,
permissions::PermissionsApiHandler,
authenticate::Authenticator, oauth::auth::OAuthApiHandler, permissions::AccountApiHandler,
},
};
use common::{
@@ -85,10 +84,10 @@ impl ManagementApi for Server {
Err(trc::ResourceEvent::NotFound.into_err())
}
}
"permissions" => {
"account" => {
// Authenticate request
let (_in_flight, access_token) = self.authenticate_headers(req, session).await?;
self.handle_permissions_request(&access_token).await
self.handle_account_request(&access_token).await
}
"token" => {
let access_token = self.management_access_token(req, session).await?;

View File

@@ -6,24 +6,25 @@
use common::{Server, auth::AccessToken};
use http_proto::{HttpResponse, JsonResponse, ToHttpResponse};
use registry::schema::enums::Permission;
use registry::schema::enums::{Locale, Permission};
use serde::Serialize;
#[derive(Debug, Clone, Serialize)]
pub struct Permissions {
pub struct Account {
pub permissions: Vec<Permission>,
pub edition: &'static str,
pub locale: Locale,
}
pub trait PermissionsApiHandler: Sync + Send {
fn handle_permissions_request(
pub trait AccountApiHandler: Sync + Send {
fn handle_account_request(
&self,
access_token: &AccessToken,
) -> impl Future<Output = trc::Result<HttpResponse>> + Send;
}
impl PermissionsApiHandler for Server {
async fn handle_permissions_request(
impl AccountApiHandler for Server {
async fn handle_account_request(
&self,
access_token: &AccessToken,
) -> trc::Result<HttpResponse> {
@@ -41,9 +42,12 @@ impl PermissionsApiHandler for Server {
};
// SPDX-SnippetEnd
Ok(JsonResponse::new(Permissions {
let account_info = self.account_info(access_token.account_id()).await?;
Ok(JsonResponse::new(Account {
permissions: access_token.permissions(),
edition,
locale: account_info.locale(),
})
.into_http_response())
}