Search in sources :

Example 56 with PermissionSubject

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

the class NetworkCommon method getPermissionCheckSubjects.

@Override
public List<PermissionSubject> getPermissionCheckSubjects() {
    Network network = getNetwork();
    Guid networkId = network == null ? null : network.getId();
    return Collections.singletonList(new PermissionSubject(networkId, VdcObjectType.Network, getActionType().getActionGroup()));
}
Also used : PermissionSubject(org.ovirt.engine.core.bll.utils.PermissionSubject) Network(org.ovirt.engine.core.common.businessentities.network.Network) Guid(org.ovirt.engine.core.compat.Guid)

Example 57 with PermissionSubject

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

the class AttachNetworkClusterPermissionsChecker method checkPermissions.

public boolean checkPermissions(CommandBase<?> command, List<PermissionSubject> permissionCheckSubjects) {
    final List<String> messages = new ArrayList<>();
    for (PermissionSubject permSubject : permissionCheckSubjects) {
        messages.clear();
        if (command.checkSinglePermission(permSubject, messages)) {
            return true;
        }
    }
    command.getReturnValue().getValidationMessages().addAll(messages);
    return false;
}
Also used : PermissionSubject(org.ovirt.engine.core.bll.utils.PermissionSubject) ArrayList(java.util.ArrayList)

Example 58 with PermissionSubject

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

the class ImportVmCommandBase method getPermissionCheckSubjects.

@Override
public List<PermissionSubject> getPermissionCheckSubjects() {
    List<PermissionSubject> permissionList = new ArrayList<>();
    // Destination cluster
    permissionList.add(new PermissionSubject(getClusterId(), VdcObjectType.Cluster, ActionGroup.CREATE_VM));
    return permissionList;
}
Also used : PermissionSubject(org.ovirt.engine.core.bll.utils.PermissionSubject) ArrayList(java.util.ArrayList)

Example 59 with PermissionSubject

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

the class ImportVmFromExternalProviderCommand method getPermissionCheckSubjects.

@Override
public List<PermissionSubject> getPermissionCheckSubjects() {
    List<PermissionSubject> permissionList = super.getPermissionCheckSubjects();
    // Destination domain
    permissionList.add(new PermissionSubject(getStorageDomainId(), VdcObjectType.Storage, getActionType().getActionGroup()));
    return permissionList;
}
Also used : PermissionSubject(org.ovirt.engine.core.bll.utils.PermissionSubject)

Example 60 with PermissionSubject

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

the class ExportOvaCommand method getPermissionCheckSubjects.

@Override
public List<PermissionSubject> getPermissionCheckSubjects() {
    List<PermissionSubject> permissionSubjects = new ArrayList<>();
    permissionSubjects.add(new PermissionSubject(getParameters().getEntityId(), getParameters().getEntityType() == VmEntityType.VM ? VdcObjectType.VM : VdcObjectType.VmTemplate, getActionType().getActionGroup()));
    return permissionSubjects;
}
Also used : PermissionSubject(org.ovirt.engine.core.bll.utils.PermissionSubject) ArrayList(java.util.ArrayList)

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