public boolean isHasEditIssuePermission(final Issue issue) { if (issue == null) { throw new IssueNotFoundException("Issue unexpectedly null"); } return hasIssuePermission(ProjectPermissions.EDIT_ISSUES, issue); }
/** * Determines whether the current user can edit or resolve an specified issue. * * @param issue The issue in play. * @return whether the current user can edit or resolve an specified issue. */ public boolean isEditable(final Issue issue) { if (issue == null) { throw new IssueNotFoundException("Issue unexpectedly null"); } final boolean hasPermission = isHasEditIssuePermission(issue); return hasPermission && isWorkflowAllowsEdit(issue); }
public boolean isEditable(Issue issue) { // preconditions if (issue == null) { throw new IssueNotFoundException("Issue unexpectedly null"); } boolean hasPermission = permissionManager.hasPermission(Permissions.EDIT_ISSUE, issue, authenticationContext.getUser()); if (hasPermission) { return issue.isEditable(); } return false; }
/** * Ensures that the current issue is valid for the calling user. If it does not exist or the calling user does not * have sufficient permissions, throws an exception. * * @see #isIssueValid() * @throws com.atlassian.jira.exception.IssueNotFoundException if the issue does not exist * @throws com.atlassian.jira.exception.IssuePermissionException if the calling user does not have permission to * view the issue */ protected void assertIssueIsValid() throws IssueNotFoundException, IssuePermissionException { if (!isIssueExists()) { addErrorMessage(getText("issue.wasdeleted")); throw new IssueNotFoundException("Issue with id '" + id + "' or key '" + key + "' could not be found in the system"); } if (!isIssueValid()) { final Issue issueObject = issue.object(); @SuppressWarnings ({ "ConstantConditions" }) // because issue.exists() at this point final String issueStr = issueObject.getKey() != null ? issueObject.getKey() : issueObject.toString(); throw new IssuePermissionException("User '" + getLoggedInUser() + "' does not have permission to see issue '" + issueStr + "'"); } }