Search in sources :

Example 16 with ActionGroup

use of org.ovirt.engine.core.common.businessentities.ActionGroup in project ovirt-engine by oVirt.

the class DetachActionGroupsFromRoleCommandTest method verifyRoleSaving.

private void verifyRoleSaving(boolean wasInheritable, boolean roleStatusChanged) {
    for (ActionGroup group : getParams().getActionGroups()) {
        verify(getRoleGroupMapDaoMock()).remove(group, getParams().getRoleId());
    }
    if (wasInheritable) {
        verify(getRoleDaoMock()).get(getParams().getRoleId());
        verify(getRoleGroupMapDaoMock()).getAllForRole(getParams().getRoleId());
    }
    if (roleStatusChanged) {
        verify(getRoleDaoMock()).update(getRole());
    }
    verifyNoMoreInteractions(getRoleGroupMapDaoMock());
}
Also used : ActionGroup(org.ovirt.engine.core.common.businessentities.ActionGroup)

Example 17 with ActionGroup

use of org.ovirt.engine.core.common.businessentities.ActionGroup in project ovirt-engine by oVirt.

the class BackendClusterLevelsResource method makeClusterLevel.

public ClusterLevel makeClusterLevel(String version) {
    ClusterLevel level = new ClusterLevel();
    level.setId(version);
    // Not exposing CPU list filtered queries:
    if (!isFiltered()) {
        CpuTypes cpuTypes = new CpuTypes();
        for (ServerCpu serverCpu : getServerCpuList(version)) {
            CpuType cpuType = new CpuType();
            cpuType.setName(serverCpu.getCpuName());
            cpuType.setLevel(serverCpu.getLevel());
            cpuType.setArchitecture(CPUMapper.map(serverCpu.getArchitecture(), null));
            cpuTypes.getCpuTypes().add(cpuType);
        }
        level.setCpuTypes(cpuTypes);
    }
    // Add permits:
    Permits permits = new Permits();
    for (ActionGroup actionGroup : getActionGroups()) {
        Permit permit = PermitMapper.map(actionGroup, null);
        permits.getPermits().add(permit);
    }
    level.setPermits(permits);
    return LinkHelper.addLinks(level);
}
Also used : Permit(org.ovirt.engine.api.model.Permit) ActionGroup(org.ovirt.engine.core.common.businessentities.ActionGroup) ClusterLevel(org.ovirt.engine.api.model.ClusterLevel) ServerCpu(org.ovirt.engine.core.common.businessentities.ServerCpu) CpuTypes(org.ovirt.engine.api.model.CpuTypes) CpuType(org.ovirt.engine.api.model.CpuType) Permits(org.ovirt.engine.api.model.Permits)

Example 18 with ActionGroup

use of org.ovirt.engine.core.common.businessentities.ActionGroup in project ovirt-engine by oVirt.

the class BackendPermitResourceTest method testGet.

@Test
public void testGet() {
    initResource(resource.parent);
    for (ActionGroup action : ActionGroup.values()) {
        resource.id = Integer.toString(action.getId());
        verifyPermit(resource.get(), action);
    }
    // reset id, because 'resource' is used for multiple tests.
    resource.id = "1";
}
Also used : ActionGroup(org.ovirt.engine.core.common.businessentities.ActionGroup) Test(org.junit.Test)

Example 19 with ActionGroup

use of org.ovirt.engine.core.common.businessentities.ActionGroup in project ovirt-engine by oVirt.

the class BackendPermitsResourceTest method verifyModel.

@Override
protected void verifyModel(Permit model, int index) {
    assertEquals(Integer.toString(index + 1), model.getId());
    ActionGroup actionGroup = ActionGroup.forValue(index + 1);
    assertEquals(actionGroup.name().toLowerCase(), model.getName());
}
Also used : ActionGroup(org.ovirt.engine.core.common.businessentities.ActionGroup)

Example 20 with ActionGroup

use of org.ovirt.engine.core.common.businessentities.ActionGroup in project ovirt-engine by oVirt.

the class RolesCommandBase method getActionGroupsByRoleId.

protected List<ActionGroup> getActionGroupsByRoleId(Guid roleId) {
    List<ActionGroup> allGroups = new ArrayList<>();
    List<RoleGroupMap> allGroupsMaps = roleGroupMapDao.getAllForRole(roleId);
    for (RoleGroupMap map : allGroupsMaps) {
        allGroups.add(map.getActionGroup());
    }
    return allGroups;
}
Also used : ActionGroup(org.ovirt.engine.core.common.businessentities.ActionGroup) RoleGroupMap(org.ovirt.engine.core.common.businessentities.RoleGroupMap) ArrayList(java.util.ArrayList)

Aggregations

ActionGroup (org.ovirt.engine.core.common.businessentities.ActionGroup)24 ArrayList (java.util.ArrayList)9 Guid (org.ovirt.engine.core.compat.Guid)8 ActionGroupsToRoleParameter (org.ovirt.engine.core.common.action.ActionGroupsToRoleParameter)6 Role (org.ovirt.engine.core.common.businessentities.Role)6 HashMap (java.util.HashMap)3 List (java.util.List)3 RoleGroupMap (org.ovirt.engine.core.common.businessentities.RoleGroupMap)3 SelectionTreeNodeModel (org.ovirt.engine.ui.uicommonweb.models.common.SelectionTreeNodeModel)3 Collection (java.util.Collection)2 Collections (java.util.Collections)2 Test (org.junit.Test)2 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)2 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)2 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)2 VM (org.ovirt.engine.core.common.businessentities.VM)2 VmBase (org.ovirt.engine.core.common.businessentities.VmBase)2 VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)2 NameableComparator (org.ovirt.engine.core.common.businessentities.comparators.NameableComparator)2 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)2