mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-15 13:58:36 +02:00
Add a default management key
This commit is contained in:
parent
b421c8e7de
commit
032b34c377
1 changed files with 16 additions and 0 deletions
|
@ -144,6 +144,21 @@ impl Key {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn default_management() -> Self {
|
||||
let now = OffsetDateTime::now_utc();
|
||||
let uid = Uuid::new_v4();
|
||||
Self {
|
||||
name: Some("Default Management API Key".to_string()),
|
||||
description: Some("Use it to peek into the instance in a read-only mode. Caution! Do not expose it on a public frontend".to_string()),
|
||||
uid,
|
||||
actions: vec![Action::AllRead],
|
||||
indexes: vec![IndexUidPattern::all()],
|
||||
expires_at: None,
|
||||
created_at: now,
|
||||
updated_at: now,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn default_search() -> Self {
|
||||
let now = OffsetDateTime::now_utc();
|
||||
let uid = Uuid::new_v4();
|
||||
|
@ -453,6 +468,7 @@ pub mod actions {
|
|||
use super::Action::*;
|
||||
|
||||
pub(crate) const ALL: u8 = All.repr();
|
||||
pub const ALL_READ: u8 = AllRead.repr();
|
||||
pub const SEARCH: u8 = Search.repr();
|
||||
pub const DOCUMENTS_ALL: u8 = DocumentsAll.repr();
|
||||
pub const DOCUMENTS_ADD: u8 = DocumentsAdd.repr();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue