mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-26 23:04:26 +01:00
update keys route
This commit is contained in:
parent
fab50256bc
commit
817fcfdd88
@ -1,13 +1,11 @@
|
|||||||
use actix_web::get;
|
use actix_web::{web, HttpResponse};
|
||||||
use actix_web::web;
|
|
||||||
use actix_web::HttpResponse;
|
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use crate::helpers::Authentication;
|
|
||||||
use crate::Data;
|
use crate::Data;
|
||||||
|
use crate::extractors::authentication::{GuardedData, policies::*};
|
||||||
|
|
||||||
pub fn services(cfg: &mut web::ServiceConfig) {
|
pub fn services(cfg: &mut web::ServiceConfig) {
|
||||||
cfg.service(list);
|
cfg.route("/keys", web::get().to(list));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
@ -16,8 +14,7 @@ struct KeysResponse {
|
|||||||
public: Option<String>,
|
public: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/keys", wrap = "Authentication::Admin")]
|
async fn list(data: GuardedData<Admin, Data>) -> HttpResponse {
|
||||||
async fn list(data: web::Data<Data>) -> HttpResponse {
|
|
||||||
let api_keys = data.api_keys.clone();
|
let api_keys = data.api_keys.clone();
|
||||||
HttpResponse::Ok().json(&KeysResponse {
|
HttpResponse::Ok().json(&KeysResponse {
|
||||||
private: api_keys.private,
|
private: api_keys.private,
|
||||||
|
Loading…
Reference in New Issue
Block a user