move userid types to pbs-api-types
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
3c430e9a55
commit
751f6b6148
|
@ -6,7 +6,9 @@ edition = "2018"
|
||||||
description = "general API type helpers for PBS"
|
description = "general API type helpers for PBS"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
anyhow = "1.0"
|
||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
regex = "1.2"
|
regex = "1.2"
|
||||||
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
|
|
||||||
proxmox = { version = "0.11.5", default-features = false, features = [ "api-macro" ] }
|
proxmox = { version = "0.11.5", default-features = false, features = [ "api-macro" ] }
|
||||||
|
|
|
@ -3,6 +3,15 @@
|
||||||
use proxmox::api::schema::{ApiStringFormat, Schema, StringSchema};
|
use proxmox::api::schema::{ApiStringFormat, Schema, StringSchema};
|
||||||
use proxmox::const_regex;
|
use proxmox::const_regex;
|
||||||
|
|
||||||
|
#[macro_use]
|
||||||
|
mod userid;
|
||||||
|
pub use userid::Authid;
|
||||||
|
pub use userid::Userid;
|
||||||
|
pub use userid::{Realm, RealmRef};
|
||||||
|
pub use userid::{Tokenname, TokennameRef};
|
||||||
|
pub use userid::{Username, UsernameRef};
|
||||||
|
pub use userid::{PROXMOX_GROUP_ID_SCHEMA, PROXMOX_TOKEN_ID_SCHEMA, PROXMOX_TOKEN_NAME_SCHEMA};
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! PROXMOX_SAFE_ID_REGEX_STR {
|
macro_rules! PROXMOX_SAFE_ID_REGEX_STR {
|
||||||
() => {
|
() => {
|
||||||
|
|
|
@ -40,10 +40,15 @@ use super::PROXMOX_SAFE_ID_REGEX_STR;
|
||||||
// colon separated lists)!
|
// colon separated lists)!
|
||||||
// slash is not allowed because it is used as pve API delimiter
|
// slash is not allowed because it is used as pve API delimiter
|
||||||
// also see "man useradd"
|
// also see "man useradd"
|
||||||
|
#[macro_export]
|
||||||
macro_rules! USER_NAME_REGEX_STR { () => (r"(?:[^\s:/[:cntrl:]]+)") }
|
macro_rules! USER_NAME_REGEX_STR { () => (r"(?:[^\s:/[:cntrl:]]+)") }
|
||||||
|
#[macro_export]
|
||||||
macro_rules! GROUP_NAME_REGEX_STR { () => (USER_NAME_REGEX_STR!()) }
|
macro_rules! GROUP_NAME_REGEX_STR { () => (USER_NAME_REGEX_STR!()) }
|
||||||
|
#[macro_export]
|
||||||
macro_rules! TOKEN_NAME_REGEX_STR { () => (PROXMOX_SAFE_ID_REGEX_STR!()) }
|
macro_rules! TOKEN_NAME_REGEX_STR { () => (PROXMOX_SAFE_ID_REGEX_STR!()) }
|
||||||
|
#[macro_export]
|
||||||
macro_rules! USER_ID_REGEX_STR { () => (concat!(USER_NAME_REGEX_STR!(), r"@", PROXMOX_SAFE_ID_REGEX_STR!())) }
|
macro_rules! USER_ID_REGEX_STR { () => (concat!(USER_NAME_REGEX_STR!(), r"@", PROXMOX_SAFE_ID_REGEX_STR!())) }
|
||||||
|
#[macro_export]
|
||||||
macro_rules! APITOKEN_ID_REGEX_STR { () => (concat!(USER_ID_REGEX_STR!() , r"!", TOKEN_NAME_REGEX_STR!())) }
|
macro_rules! APITOKEN_ID_REGEX_STR { () => (concat!(USER_ID_REGEX_STR!() , r"!", TOKEN_NAME_REGEX_STR!())) }
|
||||||
|
|
||||||
const_regex! {
|
const_regex! {
|
|
@ -19,15 +19,6 @@ use crate::{
|
||||||
config::acl::Role,
|
config::acl::Role,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
mod userid;
|
|
||||||
pub use userid::{Realm, RealmRef};
|
|
||||||
pub use userid::{Tokenname, TokennameRef};
|
|
||||||
pub use userid::{Username, UsernameRef};
|
|
||||||
pub use userid::Userid;
|
|
||||||
pub use userid::Authid;
|
|
||||||
pub use userid::{PROXMOX_TOKEN_ID_SCHEMA, PROXMOX_TOKEN_NAME_SCHEMA, PROXMOX_GROUP_ID_SCHEMA};
|
|
||||||
|
|
||||||
mod tape;
|
mod tape;
|
||||||
pub use tape::*;
|
pub use tape::*;
|
||||||
|
|
||||||
|
@ -37,17 +28,7 @@ pub use file_restore::*;
|
||||||
mod acme;
|
mod acme;
|
||||||
pub use acme::*;
|
pub use acme::*;
|
||||||
|
|
||||||
pub use pbs_api_types::{
|
pub use pbs_api_types::*;
|
||||||
CERT_FINGERPRINT_SHA256_SCHEMA,
|
|
||||||
FINGERPRINT_SHA256_FORMAT,
|
|
||||||
FINGERPRINT_SHA256_REGEX,
|
|
||||||
PROXMOX_SAFE_ID_FORMAT,
|
|
||||||
PROXMOX_SAFE_ID_REGEX,
|
|
||||||
PROXMOX_SAFE_ID_REGEX_STR,
|
|
||||||
SINGLE_LINE_COMMENT_FORMAT,
|
|
||||||
SINGLE_LINE_COMMENT_REGEX,
|
|
||||||
SINGLE_LINE_COMMENT_SCHEMA,
|
|
||||||
};
|
|
||||||
|
|
||||||
// File names: may not contain slashes, may not start with "."
|
// File names: may not contain slashes, may not start with "."
|
||||||
pub const FILENAME_FORMAT: ApiStringFormat = ApiStringFormat::VerifyFn(|name| {
|
pub const FILENAME_FORMAT: ApiStringFormat = ApiStringFormat::VerifyFn(|name| {
|
||||||
|
|
Loading…
Reference in New Issue