@Before public void setUp() { cpuProfile1.setId(Guid.newGuid()); cpuProfile1.setClusterId(CLUSTER_ID); cpuProfile1.setName("CpuProfile 1"); cpuProfile2.setId(Guid.newGuid()); cpuProfile2.setClusterId(CLUSTER_ID); cpuProfile2.setName("CpuProfile 2"); when(cpuProfileDao.get(cpuProfile1.getId())).thenReturn(cpuProfile1); when(cpuProfileDao.get(cpuProfile2.getId())).thenReturn(cpuProfile2); when(cpuProfileDao.getAllForCluster(CLUSTER_ID)) .thenReturn(Arrays.asList(cpuProfile1, cpuProfile2)); when(permissionDao.getEntityPermissions( USER_1_ID, ActionGroup.ASSIGN_CPU_PROFILE, cpuProfile1.getId(), VdcObjectType.CpuProfile)) .thenReturn(Guid.newGuid()); when(permissionDao.getEntityPermissions( USER_2_ID, ActionGroup.ASSIGN_CPU_PROFILE, cpuProfile2.getId(), VdcObjectType.CpuProfile)) .thenReturn(Guid.newGuid()); }
@Override protected void executeQueryCommand() { setReturnValue( permissionDao.getForRoleAndAdElementAndObject( PredefinedRoles.SUPER_USER.getId(), getUser().getId(), MultiLevelAdministrationHandler.SYSTEM_OBJECT_ID) != null); }
@Override protected void executeQueryCommand() { Guid objectId = getParameters().getObjectId(); List<Permission> perms; if (getParameters().getDirectOnly()) { perms = dao.getAllForEntity( objectId, getEngineSessionSeqId(), getParameters().isFiltered(), getParameters().getAllUsersWithPermission()); } else { perms = dao.getTreeForEntity( objectId, getParameters().getVdcObjectType(), getEngineSessionSeqId(), getParameters().isFiltered()); } getQueryReturnValue().setReturnValue(perms); }