forked from alemi/upub
feat: option to allow public debug fetches
This commit is contained in:
parent
9105f73921
commit
d3b141c9b5
2 changed files with 4 additions and 1 deletions
|
@ -64,6 +64,9 @@ pub struct DatasourceConfig {
|
|||
pub struct SecurityConfig {
|
||||
#[serde(default)]
|
||||
pub allow_registration: bool,
|
||||
|
||||
#[serde(default)]
|
||||
pub allow_public_debugger: bool,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ pub async fn debug(
|
|||
AuthIdentity(auth): AuthIdentity,
|
||||
) -> crate::Result<Json<serde_json::Value>> {
|
||||
// only local users can request debug fetches
|
||||
if !matches!(auth, Identity::Local(_)) {
|
||||
if !ctx.cfg().security.allow_public_debugger && !matches!(auth, Identity::Local(_)) {
|
||||
return Err(UpubError::unauthorized());
|
||||
}
|
||||
Ok(Json(
|
||||
|
|
Loading…
Reference in a new issue