use of org.camunda.bpm.engine.IdentityService in project camunda-bpm-platform by camunda.
the class HalTenantResolver method resolveNotCachedLinks.
@Override
protected List<HalResource<?>> resolveNotCachedLinks(String[] linkedIds, ProcessEngine processEngine) {
IdentityService identityService = processEngine.getIdentityService();
List<Tenant> tenants = identityService.createTenantQuery().tenantIdIn(linkedIds).list();
List<HalResource<?>> resolvedTenants = new ArrayList<HalResource<?>>();
for (Tenant tenant : tenants) {
resolvedTenants.add(HalTenant.fromTenant(tenant));
}
return resolvedTenants;
}
use of org.camunda.bpm.engine.IdentityService in project camunda-bpm-platform by camunda.
the class HalUserResolver method resolveNotCachedLinks.
protected List<HalResource<?>> resolveNotCachedLinks(String[] linkedIds, ProcessEngine processEngine) {
IdentityService identityService = processEngine.getIdentityService();
List<User> users = identityService.createUserQuery().userIdIn(linkedIds).listPage(0, linkedIds.length);
List<HalResource<?>> resolvedUsers = new ArrayList<HalResource<?>>();
for (User user : users) {
resolvedUsers.add(HalUser.fromUser(user));
}
return resolvedUsers;
}
use of org.camunda.bpm.engine.IdentityService in project camunda-bpm-platform by camunda.
the class GroupRestServiceImpl method createGroup.
public void createGroup(GroupDto groupDto) {
final IdentityService identityService = getIdentityService();
if (identityService.isReadOnly()) {
throw new InvalidRequestException(Status.FORBIDDEN, "Identity service implementation is read-only.");
}
Group newGroup = identityService.newGroup(groupDto.getId());
groupDto.update(newGroup);
identityService.saveGroup(newGroup);
}
use of org.camunda.bpm.engine.IdentityService in project camunda-bpm-platform by camunda.
the class FetchAndLockHandlerImpl method addPendingRequest.
@Override
public void addPendingRequest(FetchExternalTasksExtendedDto dto, AsyncResponse asyncResponse, ProcessEngine processEngine) {
Long asyncResponseTimeout = dto.getAsyncResponseTimeout();
if (asyncResponseTimeout != null && asyncResponseTimeout > MAX_TIMEOUT) {
invalidRequest(asyncResponse, "The asynchronous response timeout cannot be set to a value greater than " + MAX_TIMEOUT + " milliseconds");
return;
}
IdentityService identityService = processEngine.getIdentityService();
Authentication authentication = identityService.getCurrentAuthentication();
FetchAndLockRequest incomingRequest = new FetchAndLockRequest().setProcessEngine(processEngine).setAsyncResponse(asyncResponse).setAuthentication(authentication).setDto(dto);
FetchAndLockResult result = tryFetchAndLock(incomingRequest);
if (result.wasSuccessful()) {
List<LockedExternalTaskDto> lockedTasks = result.getTasks();
if (!lockedTasks.isEmpty() || dto.getAsyncResponseTimeout() == null) {
// response immediately if tasks available
asyncResponse.resume(lockedTasks);
} else {
addRequest(incomingRequest);
}
} else {
ProcessEngineException processEngineException = result.getProcessEngineException();
asyncResponse.resume(processEngineException);
}
}
use of org.camunda.bpm.engine.IdentityService in project camunda-bpm-platform by camunda.
the class TaskCommentResourceImpl method isHistoryEnabled.
private boolean isHistoryEnabled() {
IdentityService identityService = engine.getIdentityService();
Authentication currentAuthentication = identityService.getCurrentAuthentication();
try {
identityService.clearAuthentication();
int historyLevel = engine.getManagementService().getHistoryLevel();
return historyLevel > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE;
} finally {
identityService.setAuthentication(currentAuthentication);
}
}
Aggregations