use of org.ow2.proactive.scheduler.common.exception.PermissionException in project scheduling by ow2-proactive.
the class SchedulerStateListener method getSchedulerStatus.
public SchedulerStatus getSchedulerStatus(Scheduler scheduler) throws PermissionException, NotConnectedException {
SchedulerStatus status = state.getStatus();
if (status == null) {
status = scheduler.getStatus();
state.setStatus(status);
}
return status;
}
use of org.ow2.proactive.scheduler.common.exception.PermissionException in project scheduling by ow2-proactive.
the class SchedulerProxyUserInterfaceTest method testChangeStartAt.
@Test
public void testChangeStartAt() throws NotConnectedException, UnknownJobException, PermissionException {
JobId jobId = JobIdImpl.makeJobId("66");
String startAt = "2017-07-07T00:00:00+01:00";
when(uischedulerMock.changeStartAt(jobId, startAt)).thenReturn(true);
assertThat(schedulerProxyUserInterface.changeStartAt(jobId, startAt), is(true));
}
use of org.ow2.proactive.scheduler.common.exception.PermissionException in project scheduling by ow2-proactive.
the class SchedulerFrontendState method checkPermissionReturningListeningUser.
synchronized ListeningUser checkPermissionReturningListeningUser(String methodName, String permissionMsg) throws NotConnectedException, PermissionException {
UniqueID id = checkAccess();
ListeningUser ident = identifications.get(id);
// renew session for this user
renewUserSession(id, ident.getUser());
final String fullMethodName = SchedulerFrontend.class.getName() + "." + methodName;
final MethodCallPermission methodCallPermission = new MethodCallPermission(fullMethodName);
try {
ident.getUser().checkPermission(methodCallPermission, permissionMsg);
} catch (PermissionException ex) {
logger.warn(permissionMsg);
throw ex;
}
return ident;
}
use of org.ow2.proactive.scheduler.common.exception.PermissionException in project scheduling by ow2-proactive.
the class SchedulerFrontendState method getTaskState.
synchronized TaskState getTaskState(JobId jobId, TaskId taskId) throws NotConnectedException, UnknownJobException, UnknownTaskException, PermissionException {
checkPermissions("getJobState", getIdentifiedJob(jobId), YOU_DO_NOT_HAVE_PERMISSION_TO_GET_THE_STATE_OF_THIS_TASK);
if (jobsMap.get(jobId) == null) {
throw new UnknownJobException(jobId);
}
JobState jobState = jobsMap.get(jobId);
synchronized (jobState) {
TaskState ts = jobState.getHMTasks().get(taskId);
if (ts == null) {
throw new UnknownTaskException(taskId, jobId);
}
return ts;
}
}
use of org.ow2.proactive.scheduler.common.exception.PermissionException in project scheduling by ow2-proactive.
the class AuthenticationTest method loginAsAdmin.
private void loginAsAdmin(SchedulerAuthenticationInterface auth, PublicKey pubKey) throws KeyException, LoginException, AlreadyConnectedException, NotConnectedException, PermissionException {
log("Test 1");
log("Trying to authorized as an admin with correct user name and password");
Credentials cred = Credentials.createCredentials(new CredData(TestUsers.DEMO.username, TestUsers.DEMO.password), pubKey);
Scheduler admin = auth.login(cred);
String userName = admin.getCurrentUser();
Assert.assertEquals(TestUsers.DEMO.username, userName);
UserData userData = admin.getCurrentUserData();
Assert.assertNotNull(userData);
Assert.assertNotNull(userData.getUserName());
Assert.assertNotNull(userData.getGroups());
Assert.assertTrue(userData.getGroups().contains("admin"));
admin.disconnect();
log("Passed: successful authentication");
}
Aggregations