From bb34b5891053d28515f676f7777b7ab65801295d Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 17 Apr 2020 14:36:27 +0200 Subject: [PATCH] src/api2/admin/datastore.rs: add access permissions - first try We need to refine this later (introduce backup owner concept?) --- src/api2/admin/datastore.rs | 49 +++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs index 68195307..09f92b0b 100644 --- a/src/api2/admin/datastore.rs +++ b/src/api2/admin/datastore.rs @@ -8,8 +8,9 @@ use hyper::http::request::Parts; use hyper::{header, Body, Response, StatusCode}; use serde_json::{json, Value}; -use proxmox::api::api; -use proxmox::api::{ApiResponseFuture, ApiHandler, ApiMethod, Router, RpcEnvironment, RpcEnvironmentType}; +use proxmox::api::{ + api, ApiResponseFuture, ApiHandler, ApiMethod, Router, + RpcEnvironment, RpcEnvironmentType, Permission}; use proxmox::api::router::SubdirMap; use proxmox::api::schema::*; use proxmox::tools::fs::{file_get_contents, replace_file, CreateOptions}; @@ -21,6 +22,7 @@ use crate::backup::*; use crate::config::datastore; use crate::server::WorkerTask; use crate::tools; +use crate::config::acl::{PRIV_DATASTORE_AUDIT, PRIV_DATASTORE_ALLOCATE_SPACE}; fn read_backup_index(store: &DataStore, backup_dir: &BackupDir) -> Result, Error> { @@ -78,6 +80,9 @@ fn group_backups(backup_list: Vec) -> HashMap