use of org.ovirt.engine.core.common.VdcObjectType in project ovirt-engine by oVirt.
the class JobRepositoryImpl method getJob.
@Override
public Job getJob(final Guid jobId) {
Job job = jobDao.get(jobId);
if (job != null) {
Map<Guid, VdcObjectType> jobSubjectEntity = jobSubjectEntityDao.getJobSubjectEntityByJobId(jobId);
job.setJobSubjectEntities(jobSubjectEntity);
}
return job;
}
use of org.ovirt.engine.core.common.VdcObjectType in project ovirt-engine by oVirt.
the class GetPermissionsForObjectQueryTest method testExecuteQueryWithoutDirectOnly.
@Test
public void testExecuteQueryWithoutDirectOnly() {
VdcObjectType type = RandomUtils.instance().pickRandom(VdcObjectType.values());
when(getQueryParameters().getVdcObjectType()).thenReturn(type);
when(permissionDaoMock.getTreeForEntity(objectID, type, UNPRIVILEGED_USER_SESSION_ID, getQueryParameters().isFiltered())).thenReturn(mockedPermissions);
assertQueryDaoCall(false);
}
use of org.ovirt.engine.core.common.VdcObjectType in project ovirt-engine by oVirt.
the class CommandBase method checkSinglePermission.
public final boolean checkSinglePermission(PermissionSubject permSubject, Collection<String> messages) {
final Guid objectId = permSubject.getObjectId();
final VdcObjectType objectType = permSubject.getObjectType();
final ActionGroup objectActionGroup = permSubject.getActionGroup();
// if objectId is null we can't check permission
if (objectId == null) {
if (log.isDebugEnabled()) {
log.debug("The object to check is null for action '{}'.", getActionType());
}
messages.add(EngineMessage.USER_NOT_AUTHORIZED_TO_PERFORM_ACTION.name());
return false;
}
// Check that an action group is defined for this action;
if (objectActionGroup == null) {
if (log.isDebugEnabled()) {
log.debug("No action group is defined for action '{}'.", getActionType());
}
return false;
}
// Check the authorization:
if (!checkUserAuthorization(getCurrentUser().getId(), objectActionGroup, objectId, objectType)) {
messages.add(permSubject.getMessage().name());
return false;
}
return true;
}
Aggregations