mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-22 12:54:26 +01:00
Change the metrics route API access rights
This commit is contained in:
parent
f87ebfe477
commit
381df43be4
@ -41,6 +41,10 @@ pub enum Action {
|
||||
StatsAll = actions::STATS_ALL,
|
||||
#[serde(rename = "stats.get")]
|
||||
StatsGet = actions::STATS_GET,
|
||||
#[serde(rename = "metrics.*")]
|
||||
MetricsAll = actions::METRICS_ALL,
|
||||
#[serde(rename = "metrics.get")]
|
||||
MetricsGet = actions::METRICS_GET,
|
||||
#[serde(rename = "dumps.*")]
|
||||
DumpsAll = actions::DUMPS_ALL,
|
||||
#[serde(rename = "dumps.create")]
|
||||
@ -79,6 +83,8 @@ impl Action {
|
||||
SETTINGS_UPDATE => Some(Self::SettingsUpdate),
|
||||
STATS_ALL => Some(Self::StatsAll),
|
||||
STATS_GET => Some(Self::StatsGet),
|
||||
METRICS_ALL => Some(Self::MetricsAll),
|
||||
METRICS_GET => Some(Self::MetricsGet),
|
||||
DUMPS_ALL => Some(Self::DumpsAll),
|
||||
DUMPS_CREATE => Some(Self::DumpsCreate),
|
||||
VERSION => Some(Self::Version),
|
||||
@ -111,6 +117,8 @@ impl Action {
|
||||
Self::SettingsUpdate => SETTINGS_UPDATE,
|
||||
Self::StatsAll => STATS_ALL,
|
||||
Self::StatsGet => STATS_GET,
|
||||
Self::MetricsAll => METRICS_ALL,
|
||||
Self::MetricsGet => METRICS_GET,
|
||||
Self::DumpsAll => DUMPS_ALL,
|
||||
Self::DumpsCreate => DUMPS_CREATE,
|
||||
Self::Version => VERSION,
|
||||
@ -141,11 +149,13 @@ pub mod actions {
|
||||
pub const SETTINGS_UPDATE: u8 = 15;
|
||||
pub const STATS_ALL: u8 = 16;
|
||||
pub const STATS_GET: u8 = 17;
|
||||
pub const DUMPS_ALL: u8 = 18;
|
||||
pub const DUMPS_CREATE: u8 = 19;
|
||||
pub const VERSION: u8 = 20;
|
||||
pub const KEYS_CREATE: u8 = 21;
|
||||
pub const KEYS_GET: u8 = 22;
|
||||
pub const KEYS_UPDATE: u8 = 23;
|
||||
pub const KEYS_DELETE: u8 = 24;
|
||||
pub const METRICS_ALL: u8 = 18;
|
||||
pub const METRICS_GET: u8 = 19;
|
||||
pub const DUMPS_ALL: u8 = 20;
|
||||
pub const DUMPS_CREATE: u8 = 21;
|
||||
pub const VERSION: u8 = 22;
|
||||
pub const KEYS_CREATE: u8 = 23;
|
||||
pub const KEYS_GET: u8 = 24;
|
||||
pub const KEYS_UPDATE: u8 = 25;
|
||||
pub const KEYS_DELETE: u8 = 26;
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ pub async fn get_health() -> Result<HttpResponse, ResponseError> {
|
||||
}
|
||||
|
||||
pub async fn get_metrics(
|
||||
meilisearch: GuardedData<ActionPolicy<{ actions::STATS_GET }>, MeiliSearch>,
|
||||
meilisearch: GuardedData<ActionPolicy<{ actions::METRICS_GET }>, MeiliSearch>,
|
||||
) -> Result<HttpResponse, ResponseError> {
|
||||
let search_rules = &meilisearch.filters().search_rules;
|
||||
let response = meilisearch.get_all_stats(search_rules).await?;
|
||||
|
Loading…
Reference in New Issue
Block a user