MeiliSearch/meilisearch-http/src/routes/key.rs
2020-02-14 12:54:07 +01:00

19 lines
447 B
Rust

use tide::{Request, Response};
use serde_json::json;
use crate::error::SResult;
use crate::helpers::tide::RequestExt;
use crate::helpers::tide::ACL::*;
use crate::Data;
pub async fn list(ctx: Request<Data>) -> SResult<Response> {
ctx.is_allowed(Admin)?;
let keys = &ctx.state().api_keys;
Ok(tide::Response::new(200)
.body_json(&json!({
"private": keys.private,
"public": keys.public,
}))?)
}