Spaces:
Build error
Build error
File size: 1,102 Bytes
d8435ba |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
use actix_web::{get, patch, web, Responder};
use storage::rbac::AccessRequirements;
use crate::actix::auth::ActixAccess;
use crate::common::debugger::{DebugConfigPatch, DebuggerState};
#[get("/debugger")]
async fn get_debugger_config(
ActixAccess(access): ActixAccess,
debugger_state: web::Data<DebuggerState>,
) -> impl Responder {
crate::actix::helpers::time(async move {
access.check_global_access(AccessRequirements::new().manage())?;
Ok(debugger_state.get_config())
})
.await
}
#[patch("/debugger")]
async fn update_debugger_config(
ActixAccess(access): ActixAccess,
debugger_state: web::Data<DebuggerState>,
debug_patch: web::Json<DebugConfigPatch>,
) -> impl Responder {
crate::actix::helpers::time(async move {
access.check_global_access(AccessRequirements::new().manage())?;
Ok(debugger_state.apply_config_patch(debug_patch.into_inner()))
})
.await
}
// Configure services
pub fn config_debugger_api(cfg: &mut web::ServiceConfig) {
cfg.service(get_debugger_config);
cfg.service(update_debugger_config);
}
|