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());
}
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);
}
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";
}
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());
}
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;
}
Aggregations