backup/datastore: refactor check_backup_owner there
and add a 'owns_backup' convenience function Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
committed by
Dietmar Maurer
parent
0a240aaa9a
commit
9751ef4b36
@ -74,18 +74,6 @@ fn check_priv_or_backup_owner(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn check_backup_owner(
|
||||
owner: &Authid,
|
||||
auth_id: &Authid,
|
||||
) -> Result<(), Error> {
|
||||
let correct_owner = owner == auth_id
|
||||
|| (owner.is_token() && &Authid::from(owner.user().clone()) == auth_id);
|
||||
if !correct_owner {
|
||||
bail!("backup owner check failed ({} != {})", auth_id, owner);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn read_backup_index(
|
||||
store: &DataStore,
|
||||
backup_dir: &BackupDir,
|
||||
|
Reference in New Issue
Block a user