Search in sources :

Example 41 with PermissionSubject

use of org.ovirt.engine.core.bll.utils.PermissionSubject in project ovirt-engine by oVirt.

the class ImportRepoImageCommand method getPermissionCheckSubjects.

@Override
public List<PermissionSubject> getPermissionCheckSubjects() {
    List<PermissionSubject> permissionSubjects = new ArrayList<>();
    // NOTE: there's no read-permission from a storage domain
    permissionSubjects.add(new PermissionSubject(getParameters().getStorageDomainId(), VdcObjectType.Storage, ActionGroup.CREATE_DISK));
    permissionSubjects.add(new PermissionSubject(getParameters().getSourceStorageDomainId(), VdcObjectType.Storage, ActionGroup.ACCESS_IMAGE_STORAGE));
    return permissionSubjects;
}
Also used : PermissionSubject(org.ovirt.engine.core.bll.utils.PermissionSubject) ArrayList(java.util.ArrayList)

Example 42 with PermissionSubject

use of org.ovirt.engine.core.bll.utils.PermissionSubject in project ovirt-engine by oVirt.

the class ExportRepoImageCommand method getPermissionCheckSubjects.

@Override
public List<PermissionSubject> getPermissionCheckSubjects() {
    List<PermissionSubject> permissionSubjects = new ArrayList<>();
    DiskImage diskImage = getDiskImage();
    if (diskImage != null) {
        permissionSubjects.add(new PermissionSubject(diskImage.getId(), VdcObjectType.Disk, ActionGroup.ATTACH_DISK));
    }
    permissionSubjects.add(new PermissionSubject(getParameters().getDestinationDomainId(), VdcObjectType.Storage, ActionGroup.CREATE_DISK));
    return permissionSubjects;
}
Also used : PermissionSubject(org.ovirt.engine.core.bll.utils.PermissionSubject) ArrayList(java.util.ArrayList) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 43 with PermissionSubject

use of org.ovirt.engine.core.bll.utils.PermissionSubject in project ovirt-engine by oVirt.

the class UpdateNetworkClusterPermissionsChecker method findPermissionCheckSubjects.

public List<PermissionSubject> findPermissionCheckSubjects(Guid networkId, Guid clusterId, ActionType actionType) {
    List<PermissionSubject> permissions = clusterPermissionsFinder.findPermissionCheckSubjects(clusterId, actionType);
    permissions.add(new PermissionSubject(networkId, VdcObjectType.Network, ActionGroup.ASSIGN_CLUSTER_NETWORK));
    return permissions;
}
Also used : PermissionSubject(org.ovirt.engine.core.bll.utils.PermissionSubject)

Example 44 with PermissionSubject

use of org.ovirt.engine.core.bll.utils.PermissionSubject in project ovirt-engine by oVirt.

the class AttachNetworkClusterPermissionsChecker method findPermissionCheckSubjects.

public List<PermissionSubject> findPermissionCheckSubjects(NetworkCluster networkCluster, ActionType actionType) {
    final List<PermissionSubject> permissions = new ArrayList<>();
    final Guid networkId = networkCluster == null ? null : networkCluster.getNetworkId();
    // require permissions on network
    permissions.add(new PermissionSubject(networkId, VdcObjectType.Network, actionType.getActionGroup()));
    return permissions;
}
Also used : PermissionSubject(org.ovirt.engine.core.bll.utils.PermissionSubject) ArrayList(java.util.ArrayList) Guid(org.ovirt.engine.core.compat.Guid)

Example 45 with PermissionSubject

use of org.ovirt.engine.core.bll.utils.PermissionSubject in project ovirt-engine by oVirt.

the class UpdateVmDiskCommand method getPermissionCheckSubjects.

@Override
public List<PermissionSubject> getPermissionCheckSubjects() {
    if (listPermissionSubjects == null) {
        listPermissionSubjects = new ArrayList<>();
        Guid diskId = (getOldDisk() == null) ? null : getOldDisk().getId();
        listPermissionSubjects.add(new PermissionSubject(diskId, VdcObjectType.Disk, ActionGroup.EDIT_DISK_PROPERTIES));
        if (getOldDisk() != null && getNewDisk() != null && getOldDisk().getSgio() != getNewDisk().getSgio()) {
            listPermissionSubjects.add(new PermissionSubject(diskId, VdcObjectType.Disk, ActionGroup.CONFIGURE_SCSI_GENERIC_IO));
        }
    }
    return listPermissionSubjects;
}
Also used : PermissionSubject(org.ovirt.engine.core.bll.utils.PermissionSubject) Guid(org.ovirt.engine.core.compat.Guid)

Aggregations

PermissionSubject (org.ovirt.engine.core.bll.utils.PermissionSubject)71 ArrayList (java.util.ArrayList)47 Guid (org.ovirt.engine.core.compat.Guid)15 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)6 HashSet (java.util.HashSet)5 Test (org.junit.Test)5 VdcObjectType (org.ovirt.engine.core.common.VdcObjectType)5 Collections (java.util.Collections)3 HashMap (java.util.HashMap)3 List (java.util.List)3 Map (java.util.Map)3 ImagesHandler (org.ovirt.engine.core.bll.storage.disk.image.ImagesHandler)3 ActionGroup (org.ovirt.engine.core.common.businessentities.ActionGroup)3 VM (org.ovirt.engine.core.common.businessentities.VM)3 VmStatic (org.ovirt.engine.core.common.businessentities.VmStatic)3 VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)3 VmNic (org.ovirt.engine.core.common.businessentities.network.VmNic)3 EngineMessage (org.ovirt.engine.core.common.errors.EngineMessage)3 DiskVmElementDao (org.ovirt.engine.core.dao.DiskVmElementDao)3 Arrays (java.util.Arrays)2