use of org.ovirt.engine.core.bll.utils.PermissionSubject in project ovirt-engine by oVirt.
the class AddVmPoolCommand method getPermissionCheckSubjects.
@Override
public List<PermissionSubject> getPermissionCheckSubjects() {
List<PermissionSubject> permissionList = new ArrayList<>();
permissionList.add(new PermissionSubject(getParameters().getVmStaticData().getClusterId(), VdcObjectType.Cluster, getActionType().getActionGroup()));
permissionList.add(new PermissionSubject(getVmTemplateId(), VdcObjectType.VmTemplate, ActionGroup.CREATE_VM));
return permissionList;
}
use of org.ovirt.engine.core.bll.utils.PermissionSubject in project ovirt-engine by oVirt.
the class AddVmTemplateCommand method getPermissionCheckSubjects.
/**
* in case of non-existing cluster the backend query will return a null
*/
@Override
public List<PermissionSubject> getPermissionCheckSubjects() {
if (permissionCheckSubject == null) {
permissionCheckSubject = new ArrayList<>();
if (getParameters().getTemplateType() != VmEntityType.INSTANCE_TYPE) {
Guid storagePoolId = getCluster() == null ? null : getCluster().getStoragePoolId();
permissionCheckSubject.add(new PermissionSubject(storagePoolId, VdcObjectType.StoragePool, getActionType().getActionGroup()));
// host-specific parameters can be changed by administration role only
if (!new HashSet<>(getParameters().getMasterVm().getDedicatedVmForVdsList()).equals(new HashSet<>(getVm().getDedicatedVmForVdsList())) || !StringUtils.isEmpty(getParameters().getMasterVm().getCpuPinning())) {
permissionCheckSubject.add(new PermissionSubject(storagePoolId, VdcObjectType.StoragePool, ActionGroup.EDIT_ADMIN_TEMPLATE_PROPERTIES));
}
} else {
permissionCheckSubject.add(new PermissionSubject(Guid.SYSTEM, VdcObjectType.System, getActionType().getActionGroup()));
}
}
return permissionCheckSubject;
}
use of org.ovirt.engine.core.bll.utils.PermissionSubject in project ovirt-engine by oVirt.
the class ImportVmFromExternalUrlCommand method getPermissionCheckSubjects.
@Override
public List<PermissionSubject> getPermissionCheckSubjects() {
Set<PermissionSubject> permissionSet = new HashSet<>();
// Destination domain
permissionSet.add(new PermissionSubject(getStorageDomainId(), VdcObjectType.Storage, getActionType().getActionGroup()));
return new ArrayList<>(permissionSet);
}
use of org.ovirt.engine.core.bll.utils.PermissionSubject in project ovirt-engine by oVirt.
the class ImportVmCommand method getPermissionCheckSubjects.
@Override
public List<PermissionSubject> getPermissionCheckSubjects() {
List<PermissionSubject> permissionList = super.getPermissionCheckSubjects();
// Destination domains
imageToDestinationDomainMap.values().stream().distinct().map(storageId -> new PermissionSubject(storageId, VdcObjectType.Storage, getActionType().getActionGroup())).forEach(permissionList::add);
// Source domain
permissionList.add(new PermissionSubject(getParameters().getSourceDomainId(), VdcObjectType.Storage, getActionType().getActionGroup()));
// special permission is needed to use custom properties
if (getVm() != null && !StringUtils.isEmpty(getVm().getCustomProperties())) {
permissionList.add(new PermissionSubject(getClusterId(), VdcObjectType.Cluster, ActionGroup.CHANGE_VM_CUSTOM_PROPERTIES));
}
return permissionList;
}
use of org.ovirt.engine.core.bll.utils.PermissionSubject in project ovirt-engine by oVirt.
the class VmLeaseCommandBase method getPermissionCheckSubjects.
@Override
public List<PermissionSubject> getPermissionCheckSubjects() {
List<PermissionSubject> permissionCheckSubjects = new ArrayList<>();
permissionCheckSubjects.add(new PermissionSubject(getParameters().getStorageDomainId(), VdcObjectType.Storage, getActionType().getActionGroup()));
return permissionCheckSubjects;
}
Aggregations