src/config/acl.rs: introduice privileges and roles for remotes

This commit is contained in:
Dietmar Maurer
2020-04-29 07:03:44 +02:00
parent 409f44247b
commit 8247db5b39
4 changed files with 47 additions and 9 deletions

View File

@ -16,7 +16,7 @@ use crate::backup::*;
use crate::client::*;
use crate::config::remote;
use crate::api2::types::*;
use crate::config::acl::{PRIV_DATASTORE_BACKUP, PRIV_DATASTORE_READ};
use crate::config::acl::{PRIV_DATASTORE_BACKUP, PRIV_REMOTE_READ};
use crate::config::cached_user_info::CachedUserInfo;
// fixme: implement filters
@ -405,7 +405,7 @@ pub async fn pull_store(
access: {
// Note: used parameters are no uri parameters, so we need to test inside function body
description: r###"The user needs Datastore.Backup privilege on '/datastore/{store}',
and needs to own the backup group. Datastore.Read is required on '/remote/{remote}/{remote-store}'.
and needs to own the backup group. Remote.Read is required on '/remote/{remote}/{remote-store}'.
"###,
permission: &Permission::Anybody,
},
@ -424,7 +424,7 @@ async fn pull (
let username = rpcenv.get_user().unwrap();
user_info.check_privs(&username, &["datastore", &store], PRIV_DATASTORE_BACKUP, false)?;
user_info.check_privs(&username, &["remote", &remote, &remote_store], PRIV_DATASTORE_READ, false)?;
user_info.check_privs(&username, &["remote", &remote, &remote_store], PRIV_REMOTE_READ, false)?;
let delete = delete.unwrap_or(true);