use of org.ow2.proactive.scheduler.job.UserIdentificationImpl in project scheduling by ow2-proactive.
the class SchedulerFrontendState method getCurrentUserData.
public UserData getCurrentUserData() throws NotConnectedException {
UniqueID id = checkAccess();
UserIdentificationImpl ident = identifications.get(id).getUser();
// renew session for this user
renewUserSession(id, ident);
UserData userData = new UserData();
userData.setUserName(ident.getUsername());
userData.setGroups(ident.getGroups());
return userData;
}
use of org.ow2.proactive.scheduler.job.UserIdentificationImpl in project scheduling by ow2-proactive.
the class SchedulerFrontend method getJobs.
/**
* {@inheritDoc}
*/
@Override
@ImmediateService
public Page<JobInfo> getJobs(int offset, int limit, JobFilterCriteria filterCriteria, List<SortParameter<JobSortParameter>> sortParameters) throws NotConnectedException, PermissionException {
UserIdentificationImpl ident = frontendState.checkPermission("getJobs", "You don't have permissions to load jobs");
boolean myJobsOnly = filterCriteria.isMyJobsOnly();
String user;
if (myJobsOnly) {
user = ident.getUsername();
} else {
user = null;
}
return dbManager.getJobs(offset, limit, user, filterCriteria.isPending(), filterCriteria.isRunning(), filterCriteria.isFinished(), sortParameters);
}
use of org.ow2.proactive.scheduler.job.UserIdentificationImpl in project scheduling by ow2-proactive.
the class SchedulerFrontend method submit.
/**
* {@inheritDoc}
*/
@Override
@ImmediateService
public JobId submit(Job userJob) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException {
try {
if (logger.isDebugEnabled()) {
logger.debug("New job submission requested : " + userJob.getName());
}
// check if the scheduler is stopped
if (!schedulingService.isSubmitPossible()) {
String msg = "Scheduler is stopped, cannot submit job";
logger.info(msg);
throw new SubmissionClosedException(msg);
}
UserIdentificationImpl ident = frontendState.checkPermission("submit", YOU_DO_NOT_HAVE_PERMISSION_TO_SUBMIT_A_JOB);
InternalJob job = frontendState.createJob(userJob, ident);
schedulingService.submitJob(job);
frontendState.jobSubmitted(job, ident);
return job.getId();
} catch (Exception e) {
logger.warn("Error when submitting job.", e);
throw e;
}
}
use of org.ow2.proactive.scheduler.job.UserIdentificationImpl in project scheduling by ow2-proactive.
the class SchedulerFrontend method removeThirdPartyCredential.
@Override
public void removeThirdPartyCredential(String key) throws NotConnectedException, PermissionException {
UserIdentificationImpl ident = frontendState.checkPermission("removeThirdPartyCredential", YOU_DO_NOT_HAVE_PERMISSION_TO_REMOVE_THIRD_PARTY_CREDENTIALS_FROM_THE_SCHEDULER);
dbManager.removeThirdPartyCredential(ident.getUsername(), key);
}
use of org.ow2.proactive.scheduler.job.UserIdentificationImpl in project scheduling by ow2-proactive.
the class SchedulerFrontend method putThirdPartyCredential.
@Override
public void putThirdPartyCredential(String key, String value) throws NotConnectedException, PermissionException, KeyException {
UserIdentificationImpl ident = frontendState.checkPermission("putThirdPartyCredential", YOU_DO_NOT_HAVE_PERMISSION_TO_PUT_THIRD_PARTY_CREDENTIALS_IN_THE_SCHEDULER);
HybridEncryptionUtil.HybridEncryptedData encryptedData = HybridEncryptionUtil.encryptString(value, corePublicKey);
dbManager.putThirdPartyCredential(ident.getUsername(), key, encryptedData);
}
Aggregations