Search in sources :

Example 11 with UserIdentificationImpl

use of org.ow2.proactive.scheduler.job.UserIdentificationImpl in project scheduling by ow2-proactive.

the class SchedulerFrontendTest method testConnection.

/**
 * Related to issue #1849.
 * <p>
 * https://github.com/ow2-proactive/scheduling/issues/1849
 */
@Test
public void testConnection() throws KeyException, AlreadyConnectedException {
    schedulerFrontend.connect(new UniqueID(), new UserIdentificationImpl("admin"), null);
    Mockito.verify(spacesSupport, times(1)).registerUserSpace("admin");
}
Also used : UniqueID(org.objectweb.proactive.core.UniqueID) UserIdentificationImpl(org.ow2.proactive.scheduler.job.UserIdentificationImpl) Test(org.junit.Test)

Example 12 with UserIdentificationImpl

use of org.ow2.proactive.scheduler.job.UserIdentificationImpl in project scheduling by ow2-proactive.

the class SchedulerFrontendState method checkLinkResourceManager.

synchronized void checkLinkResourceManager() throws NotConnectedException, PermissionException {
    UniqueID id = checkAccess();
    UserIdentificationImpl ident = identifications.get(id).getUser();
    // renew session for this user
    renewUserSession(id, ident);
    try {
        ident.checkPermission(new ConnectToResourceManagerPermission(), ident.getUsername() + " does not have permissions to change RM in the scheduler");
    } catch (PermissionException ex) {
        logger.info(ex.getMessage());
        throw ex;
    }
}
Also used : PermissionException(org.ow2.proactive.scheduler.common.exception.PermissionException) UniqueID(org.objectweb.proactive.core.UniqueID) ConnectToResourceManagerPermission(org.ow2.proactive.scheduler.permissions.ConnectToResourceManagerPermission) UserIdentificationImpl(org.ow2.proactive.scheduler.job.UserIdentificationImpl)

Example 13 with UserIdentificationImpl

use of org.ow2.proactive.scheduler.job.UserIdentificationImpl in project scheduling by ow2-proactive.

the class SchedulerFrontendState method checkChangeJobPriority.

synchronized void checkChangeJobPriority(JobId jobId, JobPriority priority) throws NotConnectedException, UnknownJobException, PermissionException, JobAlreadyFinishedException {
    checkPermissions("changeJobPriority", getIdentifiedJob(jobId), YOU_DO_NOT_HAVE_PERMISSION_TO_CHANGE_THE_PRIORITY_OF_THIS_JOB);
    UserIdentificationImpl ui = identifications.get(PAActiveObject.getContext().getCurrentRequest().getSourceBodyID()).getUser();
    try {
        ui.checkPermission(new ChangePriorityPermission(priority.getPriority()), ui.getUsername() + " does not have permissions to set job priority to " + priority);
    } catch (PermissionException ex) {
        logger.info(ex.getMessage());
        throw ex;
    }
    if (jobs.get(jobId).isFinished()) {
        String msg = " is already finished";
        jlogger.info(jobId, msg);
        throw new JobAlreadyFinishedException("Job " + jobId + msg);
    }
}
Also used : PermissionException(org.ow2.proactive.scheduler.common.exception.PermissionException) UserIdentificationImpl(org.ow2.proactive.scheduler.job.UserIdentificationImpl) ChangePriorityPermission(org.ow2.proactive.scheduler.permissions.ChangePriorityPermission) JobAlreadyFinishedException(org.ow2.proactive.scheduler.common.exception.JobAlreadyFinishedException)

Example 14 with UserIdentificationImpl

use of org.ow2.proactive.scheduler.job.UserIdentificationImpl in project scheduling by ow2-proactive.

the class SchedulerFrontendState method getCurrentUser.

public String getCurrentUser() throws NotConnectedException {
    UniqueID id = checkAccess();
    UserIdentificationImpl ident = identifications.get(id).getUser();
    // renew session for this user
    renewUserSession(id, ident);
    return ident.getUsername();
}
Also used : UniqueID(org.objectweb.proactive.core.UniqueID) UserIdentificationImpl(org.ow2.proactive.scheduler.job.UserIdentificationImpl)

Example 15 with UserIdentificationImpl

use of org.ow2.proactive.scheduler.job.UserIdentificationImpl in project scheduling by ow2-proactive.

the class SchedulerFrontendState method getSchedulerProperties.

public Map<String, Object> getSchedulerProperties() throws NotConnectedException {
    UniqueID id = checkAccess();
    UserIdentificationImpl ident = identifications.get(id).getUser();
    renewUserSession(id, ident);
    return PASchedulerProperties.getPropertiesAsHashMap();
}
Also used : UniqueID(org.objectweb.proactive.core.UniqueID) UserIdentificationImpl(org.ow2.proactive.scheduler.job.UserIdentificationImpl)

Aggregations

UserIdentificationImpl (org.ow2.proactive.scheduler.job.UserIdentificationImpl)16 UniqueID (org.objectweb.proactive.core.UniqueID)9 PermissionException (org.ow2.proactive.scheduler.common.exception.PermissionException)6 JobAlreadyFinishedException (org.ow2.proactive.scheduler.common.exception.JobAlreadyFinishedException)3 JobCreationException (org.ow2.proactive.scheduler.common.exception.JobCreationException)3 IOException (java.io.IOException)2 Test (org.junit.Test)2 ImmediateService (org.objectweb.proactive.annotation.ImmediateService)2 AlreadyConnectedException (org.ow2.proactive.scheduler.common.exception.AlreadyConnectedException)2 NotConnectedException (org.ow2.proactive.scheduler.common.exception.NotConnectedException)2 SubmissionClosedException (org.ow2.proactive.scheduler.common.exception.SubmissionClosedException)2 UnknownJobException (org.ow2.proactive.scheduler.common.exception.UnknownJobException)2 UnknownTaskException (org.ow2.proactive.scheduler.common.exception.UnknownTaskException)2 IdentifiedJob (org.ow2.proactive.scheduler.job.IdentifiedJob)2 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)2 ChangePriorityPermission (org.ow2.proactive.scheduler.permissions.ChangePriorityPermission)2 KeyException (java.security.KeyException)1 ArrayList (java.util.ArrayList)1 ExecutionException (java.util.concurrent.ExecutionException)1 ExecutorService (java.util.concurrent.ExecutorService)1