public String getActingUser() { return principal.getActingUser(); }
/** * Gets the base username to use to determine a user's workspace. This is not used directly as a path segment, but * forms the sole basis for it. * * @since 9.2 */ protected String getUserName(NuxeoPrincipal principal, String username) { if (principal != null) { username = principal.getActingUser(); } if (NuxeoPrincipal.isTransientUsername(username)) { // no personal workspace for transient users username = null; } if (StringUtils.isEmpty(username)) { username = null; } return username; }
protected void updateTaskInfo(CoreSession session, GraphRoute graph, Task task, String status) { String nodeId = task.getVariable(DocumentRoutingConstants.TASK_NODE_ID_KEY); if (StringUtils.isEmpty(nodeId)) { throw new DocumentRouteException("No nodeId found on task: " + task.getId()); } GraphNode node = graph.getNode(nodeId); NuxeoPrincipal principal = session.getPrincipal(); String actor = principal.getActingUser(); node.updateTaskInfo(task.getId(), true, status, actor, null); }
String currentUser = session.getPrincipal().getActingUser(); task.addComment(currentUser, comment); session.saveDocument(taskDoc);
String currentUser = session.getPrincipal().getActingUser(); task.addComment(currentUser, comment); session.saveDocument(taskDoc);
protected void finishTask(CoreSession session, GraphRoute graph, GraphNode node, Task task, boolean delete, String status) throws DocumentRouteException { DocumentRoutingService routing = Framework.getService(DocumentRoutingService.class); DocumentModelList docs = graph.getAttachedDocumentModels(); routing.removePermissionsForTaskActors(session, docs, task); // delete task if (delete) { session.removeDocument(new IdRef(task.getId())); } // get the last comment on the task, if there are several: // task might have been previously reassigned or delegated List<TaskComment> comments = task.getComments(); String comment = comments.size() > 0 ? comments.get(comments.size() - 1).getText() : ""; // actor NuxeoPrincipal principal = session.getPrincipal(); String actor = principal.getActingUser(); node.updateTaskInfo(task.getId(), true, status, actor, comment); }
public JWTBuilderImpl() { builder = JWT.create(); // default Nuxeo issuer, checked during validation builder.withIssuer(NUXEO_ISSUER); // default to current principal as subject String subject = ClientLoginModule.getCurrentPrincipal().getActingUser(); if (subject == null) { throw new NuxeoException("No currently logged-in user"); } builder.withSubject(subject); // default TTL withTTL(0); }
session = null; } else { String originatingUsername = ctx.getPrincipal().getActingUser(); session = getReconnectedCoreSession(repositoryName, originatingUsername);
task.setProcessName(processName); task.setCreated(new Date()); task.setInitiator(principal.getActingUser()); task.setActors(prefixedActorIds); task.setDueDate(dueDate);
eventProperties.put("data", (Serializable) varData); eventProperties.put(RoutingAuditHelper.WORKFLOW_INITATIOR, graph.getInitiator()); eventProperties.put(RoutingAuditHelper.TASK_ACTOR, session.getPrincipal().getActingUser()); eventProperties.put("nodeVariables", (Serializable) node.getVariables()); eventProperties.put("workflowVariables", (Serializable) graph.getVariables());
protected void cancelTask(CoreSession session, final String taskId) throws DocumentRouteException { DocumentRef taskRef = new IdRef(taskId); if (!session.exists(taskRef)) { log.info(String.format("Task with id %s does not exist anymore", taskId)); DocumentModelList docs = graph.getAttachedDocumentModels(); Framework.getService(DocumentRoutingService.class).removePermissionsForTaskActors(session, docs, taskId); NuxeoPrincipal principal = session.getPrincipal(); String actor = principal.getActingUser(); updateTaskInfo(taskId, true, null, actor, null); return; } DocumentModel taskDoc = session.getDocument(new IdRef(taskId)); Task task = taskDoc.getAdapter(Task.class); if (task == null) { throw new DocumentRouteException("Invalid taskId: " + taskId); } DocumentModelList docs = graph.getAttachedDocumentModels(); Framework.getService(DocumentRoutingService.class).removePermissionsForTaskActors(session, docs, task); if (task.isOpened()) { task.cancel(session); } session.saveDocument(task.getDocument()); // task is considered processed with the status "null" when is // canceled // actor NuxeoPrincipal principal = session.getPrincipal(); String actor = principal.getActingUser(); updateTaskInfo(taskId, true, null, actor, null); }
String actor = principal.getActingUser(); node.setLastActor(actor);
eventProperties.put("modelName", routeInstance.getModelName()); eventProperties.put(RoutingAuditHelper.WORKFLOW_INITATIOR, routeInstance.getInitiator()); eventProperties.put(RoutingAuditHelper.TASK_ACTOR, session.getPrincipal().getActingUser()); eventProperties.put("comment", comment);
@Override public DocumentModel createDocumentRouteInstanceFromDocumentRouteModel(DocumentModel model, CoreSession session) { DocumentModel parent = getParentFolderForDocumentRouteInstance(model, session); DocumentModel result = session.copy(model.getRef(), parent.getRef(), null); // copy now copies all the acls, and we don't need the readOnly // policy applied on the model // on the instance, too => removing acls result = undoReadOnlySecurityPolicy(result, session); // set initiator NuxeoPrincipal principal = session.getPrincipal(); String initiator = principal.getActingUser(); result.setPropertyValue(DocumentRoutingConstants.INITIATOR, initiator); // using the ref, the value of the attached document might not been // saved on the model result.setPropertyValue(DocumentRoutingConstants.ATTACHED_DOCUMENTS_PROPERTY_NAME, model.getPropertyValue(DocumentRoutingConstants.ATTACHED_DOCUMENTS_PROPERTY_NAME)); // reset creation date, used for workflow start time result.setPropertyValue("dc:created", Calendar.getInstance()); result.setPropertyValue(DocumentRoutingConstants.DOCUMENT_ROUTE_INSTANCE_MODEL_ID, model.getId()); session.saveDocument(result); return result; }
entry.setRepositoryId(document.getRepositoryName()); if (principal != null) { entry.setPrincipalName(principal.getActingUser()); } else { log.warn("received event {} with null principal", eventName); entry.setPrincipalName(principal.getActingUser());
eventProperties.put("modelName", routeInstance.getModelName()); eventProperties.put(RoutingAuditHelper.WORKFLOW_INITATIOR, routeInstance.getInitiator()); eventProperties.put(RoutingAuditHelper.TASK_ACTOR, session.getPrincipal().getActingUser()); eventProperties.put("comment", comment);