private Set<Project> getIssueProjects(Collection<Issue> issues) { Set<Project> projects = new HashSet<Project>(); for (Issue issue : issues) { projects.add(issue.getProjectObject()); } return projects; }
/** * Returns the specified email address of the issue's project. * <p/> * @param issue The issue to be notified about * @return The email address of the issue's project */ static String getProjectEmailFromIssue(final Issue issue) { return issue.getProjectObject().getEmail(); }
private Collection<Version> getArchivedVersionsThatAreSelected(Issue issue, Collection selectedVersions) { Collection<Version> archivedVersions = versionManager.getVersionsArchived(issue.getProjectObject()); archivedVersions.retainAll(selectedVersions); return archivedVersions; }
@Override public boolean hasPermission(Issue issue, String parameter, ApplicationUser user, boolean issueCreation) { return hasPermission(issue.getProjectObject(), parameter, user, issueCreation); }
@Override public boolean hasPermission(Issue issue, String parameter, ApplicationUser user, boolean issueCreation) { return hasPermission(issue.getProjectObject(), parameter, user, issueCreation); }
@Override public boolean hasSchemePermission(@Nonnull final ProjectPermissionKey permissionKey, @Nonnull final Issue issue) { return hasSchemePermission(permissionKey, getSchemeIdFor(issue.getProjectObject()), new PermissionSchemeEntryChecker() { @Override public boolean hasPermission(final SchemeType schemeType, final String parameter) { return schemeType.hasPermission(issue, parameter); } }); }
/** * Returns a collection of Sub-task Issue Types for this project * @return Sub-task Issue Types for this project */ public Collection getSubTaskTypes() { return issueTypeSchemeManager.getSubTaskIssueTypesForProject(getIssueObject().getProjectObject()); }
protected boolean isUserInRole(Long roleLevel, ApplicationUser user, Issue issue) { boolean isUserInRole = false; ProjectRole projectRole = projectRoleManager.getProjectRole(roleLevel); if (projectRole != null) { isUserInRole = projectRoleManager.isUserInProjectRole(user, projectRole, issue.getProjectObject()); } return isUserInRole; }
@Override public FieldJsonRepresentation getJsonFromIssue(Issue issue, boolean renderedVersionRequested, @Nullable FieldLayoutItem fieldLayoutItem) { return new FieldJsonRepresentation(new JsonData(ProjectJsonBean.shortBean(issue.getProjectObject(), jiraBaseUrls))); }
private boolean doIssuePermissionCheck(ProjectPermissionKey permissionKey, final Issue issue, final ApplicationUser user) { // JRA-14788: if generic value of issue object is null, need to defer permission check to project object. if (issue.getId() != null) { return doIssuePermissionCheck(permissionKey, issue, user, false); } else { return doProjectPermissionCheck(permissionKey, issue.getProjectObject(), user, true); } }
@Override public Set<CustomField> getAvailableCustomFields(final ApplicationUser remoteUser, final Issue issue) throws FieldException { final Project project = issue.getProjectObject(); // TODO: Do we really want to do this null check? It was just copied from the old GenericValue version of this method. final List<Long> projectList = (project == null) ? Collections.<Long>emptyList() : CollectionBuilder.list(project.getId()); return getAvailableCustomFieldsWithScope(remoteUser, projectList, CollectionBuilder.list(issue.getIssueTypeId())); }
@Override public ApplicationUser getDefaultAssigneeObject(Issue issue, Map fieldValuesHolder) { // see if new components are being set Collection<ProjectComponent> components = getComponentsSystemField().getComponentsFromParams(fieldValuesHolder); if (components == null) { // components not set in fieldValuesHolder - use existing value (eg this is used when doing "assign issue" operation) components = issue.getComponentObjects(); } return projectManager.getDefaultAssignee(issue.getProjectObject(), components); }
private void validateAddAttachment(final ApplicationUser author, final Issue issue) throws AttachmentException, PermissionException { if (!attachmentManager.attachmentsEnabled()) { throw new AttachmentException("Attachments are disabled"); } if (hasNoPermissionToCreateAttachments(author, issue)) { throw new PermissionException(String.format("User '%s' has no permission to create attachments in project '%s'", getAuthorNameOrAnonymousIfNull(author), issue.getProjectObject().getKey())); } }
/** * @param issue the issue in context * @return the Collection of {@link ProjectRole}s for the specified issue that the current user is in - possibly empty */ private Collection<ProjectRole> getRoleLevels(Issue issue) { if (authenticationContext.getUser() != null && issue != null && getCommentService().isProjectRoleVisibilityEnabled()) { return getProjectRoleManager().getProjectRoles(authenticationContext.getUser(), issue.getProjectObject()); } return Collections.emptyList(); }
protected void addFieldRequiredErrorMessage(Issue issue, ErrorCollection errorCollection, I18nHelper i18n) { if (getPossibleVersions(issue.getProjectObject(), false).isEmpty()) { errorCollection.addErrorMessage(i18n.getText("createissue.error.versions.required", i18n.getText(getNameKey()), issue.getProjectObject().getName()), Reason.VALIDATION_FAILED); } else { errorCollection.addError(getId(), i18n.getText("issue.field.required", i18n.getText(getNameKey())), Reason.VALIDATION_FAILED); } }
@Override public FieldScreenScheme getFieldScreenScheme(final Issue issue) { final IssueTypeScreenScheme issueTypeScreenScheme = getIssueTypeScreenScheme(issue.getProjectObject()); IssueTypeScreenSchemeEntity entity = issueTypeScreenScheme.getEntity(issue.getIssueTypeId()); if (entity == null) { entity = issueTypeScreenScheme.getEntity(null); } return entity.getFieldScreenScheme(); }
private List<IssueSecurityLevel> getSecurityLevelsForLoggedInUser(Issue issue) { if (issue.getGenericValue() == null) { return issueSecurityLevelManager.getUsersSecurityLevels(issue.getProjectObject(), getAuthenticationContext().getUser()); } else { return issueSecurityLevelManager.getUsersSecurityLevels(issue, getAuthenticationContext().getUser()); } }
public boolean isAbleToComment() { return (getIssue() == null) ? permissionManager.hasPermission(COMMENT_ISSUE, getIssueObject().getProjectObject(), getLoggedInUser()) : permissionManager.hasPermission(COMMENT_ISSUE, getIssueObject(), getLoggedInUser()); }
private AttachmentKey createAttachmentKey(final String filename, final Issue issue) { final Long attachmentId = attachmentIdSequencer.getNextId(); return AttachmentKey.builder() .withAttachmentFilename(filename) .withIssueKey(issue.getKey()) .withAttachmentId(attachmentId) .withProjectKey(issue.getProjectObject().getOriginalKey()) .build(); }
public String getRenderedContent(FieldRenderContext fieldRenderContext) { Issue issue = fieldRenderContext.getIssue(); String fieldId = fieldRenderContext.getFieldId(); FieldLayoutManager fieldLayoutManager = ComponentAccessor.getComponentOfType(FieldLayoutManager.class); // can't put into constructor due to cyclic dependency FieldLayoutItem fieldLayoutItem = fieldLayoutManager.getFieldLayout(issue.getProjectObject(), issue.getIssueTypeId()).getFieldLayoutItem(fieldId); if (fieldLayoutItem != null) { return getRenderedContent(fieldLayoutItem.getRendererType(), fieldRenderContext.getBody(), issue.getIssueRenderContext()); } return null; }