CA-366140: Run data source operations on VMs only if they are allowed.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2022-04-22 15:33:18 +01:00
parent 429341cdca
commit dd56f744e8
3 changed files with 5 additions and 4 deletions

View File

@ -82,7 +82,7 @@ namespace XenAdmin.Actions
else
XenAPI.Host.forget_data_source_archives(Session, host.opaque_ref, ds.DataSource.name_label);
}
else if (vm != null)
else if (vm != null && vm.allowed_operations.Contains(vm_operations.data_source_op))
{
if (ds.Enabled)
XenAPI.VM.record_data_source(Session, vm.opaque_ref, ds.DataSource.name_label);

View File

@ -198,7 +198,8 @@ namespace XenAdmin.Controls.CustomDataGraph
if (xenObject is Host h)
_dataSources = Host.get_data_sources(h.Connection.Session, h.opaque_ref);
else if (xenObject is VM vm && vm.power_state == vm_power_state.Running)
else if (xenObject is VM vm && vm.power_state == vm_power_state.Running &&
vm.allowed_operations.Contains(vm_operations.data_source_op))
_dataSources = VM.get_data_sources(vm.Connection.Session, vm.opaque_ref);
Get(ArchiveInterval.None, RrdsUri, RRD_Full_InspectCurrentNode, xenObject);

View File

@ -52,7 +52,7 @@ namespace XenAdmin.Actions
{
List<Data_source> sources;
if (XenObject is VM vm)
if (XenObject is VM vm && vm.allowed_operations.Contains(vm_operations.data_source_op))
sources = VM.get_data_sources(Session, vm.opaque_ref);
else if (XenObject is Host host)
sources = Host.get_data_sources(Session, host.opaque_ref);
@ -106,7 +106,7 @@ namespace XenAdmin.Actions
Host.record_data_source(Session, Host.opaque_ref, _dataSource.name_label);
DataSources = Host.get_data_sources(Session, Host.opaque_ref);
}
else if (VM != null)
else if (VM != null && VM.allowed_operations.Contains(vm_operations.data_source_op))
{
VM.record_data_source(Session, VM.opaque_ref, _dataSource.name_label);
DataSources = VM.get_data_sources(Session, VM.opaque_ref);