diff --git a/src/api2/access/acl.rs b/src/api2/access/acl.rs index 82d89072..f0823cc2 100644 --- a/src/api2/access/acl.rs +++ b/src/api2/access/acl.rs @@ -2,41 +2,11 @@ use failure::*; use ::serde::{Deserialize, Serialize}; use proxmox::api::{api, Router, RpcEnvironment, Permission}; -use proxmox::api::schema::{Schema, StringSchema, BooleanSchema, ApiStringFormat}; use crate::api2::types::*; use crate::config::acl; use crate::config::acl::{PRIV_SYS_AUDIT, PRIV_SYS_MODIFY}; -pub const ACL_PROPAGATE_SCHEMA: Schema = BooleanSchema::new( - "Allow to propagate (inherit) permissions.") - .default(true) - .schema(); - -pub const ACL_PATH_SCHEMA: Schema = StringSchema::new( - "Access control path.") - .format(&ACL_PATH_FORMAT) - .min_length(1) - .max_length(128) - .schema(); - -pub const ACL_UGID_TYPE_SCHEMA: Schema = StringSchema::new( - "Type of 'ugid' property.") - .format(&ApiStringFormat::Enum(&["user", "group"])) - .schema(); - -pub const ACL_ROLE_SCHEMA: Schema = StringSchema::new( - "Role.") - .format(&ApiStringFormat::Enum(&[ - "Admin", - "Audit", - "Datastore.Admin", - "Datastore.Audit", - "Datastore.User", - "NoAccess", - ])) - .schema(); - #[api( properties: { propagate: { diff --git a/src/api2/types.rs b/src/api2/types.rs index 5cb48435..2b0f1c7d 100644 --- a/src/api2/types.rs +++ b/src/api2/types.rs @@ -171,6 +171,35 @@ pub const TIME_ZONE_SCHEMA: Schema = StringSchema::new( .max_length(64) .schema(); +pub const ACL_PATH_SCHEMA: Schema = StringSchema::new( + "Access control path.") + .format(&ACL_PATH_FORMAT) + .min_length(1) + .max_length(128) + .schema(); + +pub const ACL_PROPAGATE_SCHEMA: Schema = BooleanSchema::new( + "Allow to propagate (inherit) permissions.") + .default(true) + .schema(); + +pub const ACL_UGID_TYPE_SCHEMA: Schema = StringSchema::new( + "Type of 'ugid' property.") + .format(&ApiStringFormat::Enum(&["user", "group"])) + .schema(); + +pub const ACL_ROLE_SCHEMA: Schema = StringSchema::new( + "Role.") + .format(&ApiStringFormat::Enum(&[ + "Admin", + "Audit", + "Datastore.Admin", + "Datastore.Audit", + "Datastore.User", + "NoAccess", + ])) + .schema(); + pub const BACKUP_ARCHIVE_NAME_SCHEMA: Schema = StringSchema::new("Backup archive name.") .format(&PROXMOX_SAFE_ID_FORMAT)