mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-01-18 17:11:15 +08:00
Run the code formatter
This commit is contained in:
parent
be1c6f9dc4
commit
63e1fb4f96
@ -17,7 +17,7 @@ pub enum Action {
|
|||||||
#[serde(rename = "documents.delete")]
|
#[serde(rename = "documents.delete")]
|
||||||
DocumentsDelete = actions::DOCUMENTS_DELETE,
|
DocumentsDelete = actions::DOCUMENTS_DELETE,
|
||||||
#[serde(rename = "indexes.*")]
|
#[serde(rename = "indexes.*")]
|
||||||
IndexAll = actions::INDEXES_ALL,
|
IndexesAll = actions::INDEXES_ALL,
|
||||||
#[serde(rename = "indexes.create")]
|
#[serde(rename = "indexes.create")]
|
||||||
IndexesAdd = actions::INDEXES_CREATE,
|
IndexesAdd = actions::INDEXES_CREATE,
|
||||||
#[serde(rename = "indexes.get")]
|
#[serde(rename = "indexes.get")]
|
||||||
@ -66,7 +66,7 @@ impl Action {
|
|||||||
DOCUMENTS_ADD => Some(Self::DocumentsAdd),
|
DOCUMENTS_ADD => Some(Self::DocumentsAdd),
|
||||||
DOCUMENTS_GET => Some(Self::DocumentsGet),
|
DOCUMENTS_GET => Some(Self::DocumentsGet),
|
||||||
DOCUMENTS_DELETE => Some(Self::DocumentsDelete),
|
DOCUMENTS_DELETE => Some(Self::DocumentsDelete),
|
||||||
INDEXES_ALL => Some(Self::IndexAll),
|
INDEXES_ALL => Some(Self::IndexesAll),
|
||||||
INDEXES_CREATE => Some(Self::IndexesAdd),
|
INDEXES_CREATE => Some(Self::IndexesAdd),
|
||||||
INDEXES_GET => Some(Self::IndexesGet),
|
INDEXES_GET => Some(Self::IndexesGet),
|
||||||
INDEXES_UPDATE => Some(Self::IndexesUpdate),
|
INDEXES_UPDATE => Some(Self::IndexesUpdate),
|
||||||
@ -98,7 +98,7 @@ impl Action {
|
|||||||
Self::DocumentsAdd => DOCUMENTS_ADD,
|
Self::DocumentsAdd => DOCUMENTS_ADD,
|
||||||
Self::DocumentsGet => DOCUMENTS_GET,
|
Self::DocumentsGet => DOCUMENTS_GET,
|
||||||
Self::DocumentsDelete => DOCUMENTS_DELETE,
|
Self::DocumentsDelete => DOCUMENTS_DELETE,
|
||||||
Self::IndexAll => INDEXES_ALL,
|
Self::IndexesAll => INDEXES_ALL,
|
||||||
Self::IndexesAdd => INDEXES_CREATE,
|
Self::IndexesAdd => INDEXES_CREATE,
|
||||||
Self::IndexesGet => INDEXES_GET,
|
Self::IndexesGet => INDEXES_GET,
|
||||||
Self::IndexesUpdate => INDEXES_UPDATE,
|
Self::IndexesUpdate => INDEXES_UPDATE,
|
||||||
|
@ -92,76 +92,67 @@ impl HeedAuthStore {
|
|||||||
Action::into_enum_iter().collect()
|
Action::into_enum_iter().collect()
|
||||||
} else if key.actions.contains(&Action::DocumentsAll) {
|
} else if key.actions.contains(&Action::DocumentsAll) {
|
||||||
// if key.actions.contains.DocumentsAll add all actions related to documents.
|
// if key.actions.contains.DocumentsAll add all actions related to documents.
|
||||||
key.actions.iter()
|
key.actions
|
||||||
|
.iter()
|
||||||
.cloned()
|
.cloned()
|
||||||
.filter(|action|{ // Prevents duplicate entries in the actions vector
|
.filter(|action| {
|
||||||
*action != Action::DocumentsAdd &&
|
// Prevents duplicate entries in the actions vector
|
||||||
*action != Action::DocumentsDelete &&
|
*action != Action::DocumentsAdd
|
||||||
*action != Action::DocumentsGet
|
&& *action != Action::DocumentsDelete
|
||||||
|
&& *action != Action::DocumentsGet
|
||||||
})
|
})
|
||||||
.chain(vec![
|
.chain(vec![
|
||||||
Action::DocumentsAdd,
|
Action::DocumentsAdd,
|
||||||
Action::DocumentsDelete,
|
Action::DocumentsDelete,
|
||||||
Action::DocumentsGet
|
Action::DocumentsGet,
|
||||||
])
|
])
|
||||||
.collect()
|
.collect()
|
||||||
} else if key.actions.contains(&Action::IndexesAll) {
|
} else if key.actions.contains(&Action::IndexesAll) {
|
||||||
key.actions.iter()
|
key.actions
|
||||||
|
.iter()
|
||||||
.cloned()
|
.cloned()
|
||||||
.filter(|action| {
|
.filter(|action| {
|
||||||
*action != Action::IndexesAdd &&
|
*action != Action::IndexesAdd
|
||||||
*action != Action::IndexesGet &&
|
&& *action != Action::IndexesGet
|
||||||
*action != Action::IndexesDelete &&
|
&& *action != Action::IndexesDelete
|
||||||
*action != Action::IndexesUpdate
|
&& *action != Action::IndexesUpdate
|
||||||
})
|
})
|
||||||
.chain(vec![
|
.chain(vec![
|
||||||
Action::IndexesAdd,
|
Action::IndexesAdd,
|
||||||
Action::IndexesGet,
|
Action::IndexesGet,
|
||||||
Action::IndexesDelete,
|
Action::IndexesDelete,
|
||||||
Action::IndexesUpdate
|
Action::IndexesUpdate,
|
||||||
])
|
])
|
||||||
.collect()
|
.collect()
|
||||||
} else if key.actions.contains(&Action::SettingsAll) {
|
} else if key.actions.contains(&Action::SettingsAll) {
|
||||||
key.actions.iter()
|
key.actions
|
||||||
|
.iter()
|
||||||
.cloned()
|
.cloned()
|
||||||
.filter(|action| {
|
.filter(|action| {
|
||||||
*action != Action::SettingsGet &&
|
*action != Action::SettingsGet && *action != Action::SettingsUpdate
|
||||||
*action != Action::SettingsUpdate
|
|
||||||
})
|
})
|
||||||
.chain(vec![
|
.chain(vec![Action::SettingsGet, Action::SettingsUpdate])
|
||||||
Action::SettingsGet,
|
|
||||||
Action::SettingsUpdate
|
|
||||||
])
|
|
||||||
.collect()
|
.collect()
|
||||||
} else if key.actions.contains(&Action::TasksAll) {
|
} else if key.actions.contains(&Action::TasksAll) {
|
||||||
key.actions.iter()
|
key.actions
|
||||||
|
.iter()
|
||||||
.cloned()
|
.cloned()
|
||||||
.filter(|action|{
|
.filter(|action| *action != Action::TasksGet)
|
||||||
*action != Action::TasksGet
|
.chain(vec![Action::TasksGet])
|
||||||
})
|
|
||||||
.chain(vec![
|
|
||||||
Action::TasksGet
|
|
||||||
])
|
|
||||||
.collect()
|
.collect()
|
||||||
} else if key.actions.contains(&Action::DumpsAll) {
|
} else if key.actions.contains(&Action::DumpsAll) {
|
||||||
key.actions.iter()
|
key.actions
|
||||||
|
.iter()
|
||||||
.cloned()
|
.cloned()
|
||||||
.filter(|action|{
|
.filter(|action| *action != Action::DumpsCreate)
|
||||||
*action != Action::DumpsCreate
|
.chain(vec![Action::DumpsCreate])
|
||||||
})
|
|
||||||
.chain(vec![
|
|
||||||
Action::DumpsCreate
|
|
||||||
])
|
|
||||||
.collect()
|
.collect()
|
||||||
} else if key.actions.contains(&Action::StatsAll) {
|
} else if key.actions.contains(&Action::StatsAll) {
|
||||||
key.actions.iter()
|
key.actions
|
||||||
|
.iter()
|
||||||
.cloned()
|
.cloned()
|
||||||
.filter(|action|{
|
.filter(|action| *action != Action::StatsGet)
|
||||||
*action != Action::StatsGet
|
.chain(vec![Action::StatsGet])
|
||||||
})
|
|
||||||
.chain(vec![
|
|
||||||
Action::StatsGet
|
|
||||||
])
|
|
||||||
.collect()
|
.collect()
|
||||||
} else {
|
} else {
|
||||||
key.actions.clone()
|
key.actions.clone()
|
||||||
|
Loading…
Reference in New Issue
Block a user