/** * Get the {@link ApplicationUser} executing this condition. * * @param transientVars workflow context - parameters passed to workflow engine * @param args workflow's function arguments * @return The ApplicationUser, or null if run anonymously. */ public static ApplicationUser getCallerUserFromArgs(Map transientVars, Map args) { return getUserByKey(getCallerKey(transientVars, args)); }
/** * Get the {@link User} executing this condition. * * @param transientVars workflow context - parameters passed to workflow engine * @param args workflow's function arguments * @return The User, or null if run anonymously. * @deprecated Use {@link #getCallerUser(java.util.Map, java.util.Map)} instead. Since v6.0. */ protected ApplicationUser getCaller(Map transientVars, Map args) { return getCallerUser(transientVars, args); }
@Override public ApplicationUser getAuthorObject() { return WorkflowFunctionUtils.getUserByKey(authorKey); }
/** * Populate given map of parameters with data which can identify user, in order to be able retrieve {@link * ApplicationUser} later via {@link #getCallerUserFromArgs(java.util.Map, java.util.Map)} * <p/> * If you want to pass parameters explicitly, please use {@link #populateParamsWithUser(java.util.Map, String)} * * @param params mutable map, which will be populated with user's identifier * @param user user, which later should be identified by {@link #getCallerUserFromArgs(java.util.Map, * java.util.Map)} * @see #getCallerUserFromArgs(java.util.Map, java.util.Map) * @since 6.0 */ public static void populateParamsWithUser(Map<String, Object> params, ApplicationUser user) { populateParamsWithUser(params, user != null ? user.getKey() : null); }
private Workflow getWorkflowObject(WorkflowProgressAware from) { // Allows actions to be run as other users. String userkey = WorkflowFunctionUtils.getCallerKey(null, from.getAdditionalInputs()); if (userkey == null && ActionContext.getPrincipal() != null) { ApplicationUser principal = getUserManager().getUserByName(ActionContext.getPrincipal().getName()); userkey = principal == null ? null : principal.getKey(); } if (userkey == null) { userkey = ApplicationUsers.getKeyFor(from.getRemoteApplicationUser()); } return makeWorkflow(ApplicationUsers.byKey(userkey)); }
@Override public ApplicationUser getUpdateAuthorObject() { return WorkflowFunctionUtils.getUserByKey(updateAuthorKey); }
Map<String, Object> createAdditionalParameters(final ApplicationUser user, final Map<String, Object> fieldValuesHolder, TransitionOptions transitionOptions, final HistoryMetadata historyMetadata, final String originalAssigneeId) { final Map<String, Object> additionalParams = new HashMap<String, Object>(); // put the user info into the additional params WorkflowFunctionUtils.populateParamsWithUser(additionalParams, user); ///JRA-20604, JRADEV-1246: Need to populate the comment parameters into the additionalParams so they will be available //to the workflow actions. Importantly, this means that the event fired by the workflow will contain a comment if provided //by the user. final CommentSystemField commentSystemField = (CommentSystemField) fieldManager.getOrderableField(IssueFieldConstants.COMMENT); commentSystemField.populateAdditionalInputs(fieldValuesHolder, additionalParams); additionalParams.putAll(transitionOptions.getWorkflowParams()); if (historyMetadata != null) { additionalParams.put(DefaultChangeHistoryManager.HISTORY_METADATA_KEY, historyMetadata); } additionalParams.put("originalAssigneeId", originalAssigneeId); return additionalParams; }
/** * Get the {@link ApplicationUser} executing this condition. * * @param transientVars workflow context - parameters passed to workflow engine * @param args workflow's function arguments * @return The ApplicationUser, or null if run anonymously. */ protected ApplicationUser getCallerUser(Map transientVars, Map args) { return getUserByKey(getCallerKey(transientVars, args)); }
@Override public ApplicationUser getAuthorObject() { return WorkflowFunctionUtils.getUserByKey(authorKey); }
@SuppressWarnings ("unchecked") @Override public Map getAdditionalInputs() { final Map map = new HashMap(additionalInputs.size() + 3); map.putAll(additionalInputs); // Only supply fields that have been updated if (fieldUpdated(FIELD_COMMENT)) { map.put(FIELD_COMMENT, getComment()); map.put(FIELD_COMMENT_LEVEL, getCommentLevel()); map.put(CommentSystemField.PARAM_ROLE_LEVEL, getCommentRoleLevel()); } WorkflowFunctionUtils.populateParamsWithUser(map, getUserKey()); return map; }
/** * Get the name of the user executing this condition. * * @param transientVars workflow context - parameters passed to workflow engine * @param args workflow's function arguments * @return Username, or null if run anonymously. * @deprecated Use {@link #getCallerUser(java.util.Map, java.util.Map)} instead. Since v6.0. */ protected String getCallerName(Map transientVars, Map args) { ApplicationUser user = getCallerUser(transientVars, args); return user != null ? user.getUsername() : null; }
@Override public ApplicationUser getUpdateAuthorObject() { return WorkflowFunctionUtils.getUserByKey(updateAuthorKey); }
/** * Given a map of transientVars from a Workflow Function, returns the {@link ApplicationUser} object of the caller. * * @param transientVars the "transientVars" from the workflow FunctionProvider * @return the username of the caller (can be null for anonymous). * @since 6.0 */ public static ApplicationUser getCallerUser(Map transientVars) { return WorkflowFunctionUtils.getUserByKey(getCallerKey(transientVars)); }
public ApplicationUser getAuthorObject() { return WorkflowFunctionUtils.getUserByKey(getAuthorKey()); }