src/api2/reader.rs: add access permissions

This commit is contained in:
Dietmar Maurer 2020-04-17 15:01:56 +02:00
parent 70e5f2461d
commit 73ce1d1146

View File

@ -7,7 +7,7 @@ use hyper::{Body, Response, StatusCode};
use serde_json::Value; use serde_json::Value;
use proxmox::{sortable, identity}; use proxmox::{sortable, identity};
use proxmox::api::{ApiResponseFuture, ApiHandler, ApiMethod, Router, RpcEnvironment}; use proxmox::api::{ApiResponseFuture, ApiHandler, ApiMethod, Router, RpcEnvironment, Permission};
use proxmox::api::schema::*; use proxmox::api::schema::*;
use proxmox::http_err; use proxmox::http_err;
@ -15,6 +15,7 @@ use crate::api2::types::*;
use crate::backup::*; use crate::backup::*;
use crate::server::{WorkerTask, H2Service}; use crate::server::{WorkerTask, H2Service};
use crate::tools; use crate::tools;
use crate::config::acl::PRIV_DATASTORE_ALLOCATE_SPACE;
mod environment; mod environment;
use environment::*; use environment::*;
@ -41,7 +42,7 @@ pub const API_METHOD_UPGRADE_BACKUP: ApiMethod = ApiMethod::new(
("debug", true, &BooleanSchema::new("Enable verbose debug logging.").schema()), ("debug", true, &BooleanSchema::new("Enable verbose debug logging.").schema()),
]), ]),
) )
); ).access(None, &Permission::Privilege(&["datastore", "{store}"], PRIV_DATASTORE_ALLOCATE_SPACE, false));
fn upgrade_to_backup_reader_protocol( fn upgrade_to_backup_reader_protocol(
parts: Parts, parts: Parts,