public void removeValueFromIssueObject(MutableIssue issue) { if (issue.isSubTask()) { // Subtask must always take Security Level of its parent - don't allow someone to try to remove it. return; } else { // Top Level (parent) Issue. issue.setSecurityLevel(null); } }
if (issueSecurityHelper.securityLevelNeedsMove(selectedIssue, cloneIssue)) cloneIssue.setSecurityLevel(null);
public void updateIssue(FieldLayoutItem fieldLayoutItem, MutableIssue issue, Map fieldValueHolder) { if (issue.isSubTask()) { final Issue parentObject = issue.getParentObject(); // on subtask create its possible that the parent is known on the issue yet if (parentObject != null) { // Set the security field to be the same as the parent issue issue.setSecurityLevel(parentObject.getSecurityLevel()); } } else { if (fieldValueHolder.containsKey(getId())) { issue.setSecurityLevel((GenericValue) getValueFromParams(fieldValueHolder)); } } }
/** * Retrieves the issue from the IssueManager and updates the Project and IssueType, and possibly clears the security. * <p> * JRA-11605 - we need this method so that the display can prompt the user with values from system fields that are * unencumbered by security level permission checks. It will set security level to null if the issue is moving * somewhere that the old security level is no relevant. * </p> * @return Target Issue Object with required Project and Issue Type added in. * @see #getTargetIssueObjectWithSecurityLevel() */ protected MutableIssue getTargetIssueObject() { if (targetIssue == null) { targetIssue = getTargetIssueObjectWithSecurityLevel(); if(issueSecurityHelper.securityLevelNeedsMove(getIssueObject(), targetIssue)) { targetIssue.setSecurityLevel(null); } } return targetIssue; }
/** * Get Target Issue with Security Level set to null if it is needed. * JRA-11605 - we need this method so that the display can prompt the user with values from system fields that * are unencumbered by security level permission checks. * * @return Target Issue with nullified Security Level */ public MutableIssue getTargetIssue() { MutableIssue targetIssue = getTargetIssueObjectWithSecurityLevel(); FieldLayout layout = fieldLayoutManager.getFieldLayout(getIssue()); FieldLayoutItem fieldLayoutItem = layout.getFieldLayoutItem(IssueFieldConstants.SECURITY); if (fieldLayoutItem != null) { OrderableField orderableField = fieldLayoutItem.getOrderableField(); if (orderableField.needsMove(EasyList.build(getIssue()), targetIssue, fieldLayoutItem).getResult()) { targetIssue.setSecurityLevel(null); } } return targetIssue; }
/** * Sets the parent's security level on the target issue and add a new * change item to the change holder if security level of the target or * currnet issue is different from the parent issue's. * * @param changeHolder change holder * @param currentIssue current issue - original issue * @param targetIssue target issue - sub-task * @param parentIssue parent issue */ private void updateTargetIssueSecurityLevel(IssueChangeHolder changeHolder, Issue currentIssue, MutableIssue targetIssue, Issue parentIssue) { targetIssue.setSecurityLevel(parentIssue.getSecurityLevel()); final Long targetSecurityLevelId = targetIssue.getSecurityLevelId(); final Long currentSecurityLevelId = currentIssue.getSecurityLevelId(); final Long parentSecurityLevelId = parentIssue.getSecurityLevelId(); if (isNotNullAndNotEqualTo(targetSecurityLevelId, parentSecurityLevelId) || isNotNullAndNotEqualTo(currentSecurityLevelId, parentSecurityLevelId)) { changeHolder.addChangeItem(new ChangeItemBean( ChangeItemBean.STATIC_FIELD, IssueFieldConstants.SECURITY, getLongToStringNullSafe(currentSecurityLevelId), getIssueNameNullSafe(currentIssue), getLongToStringNullSafe(targetSecurityLevelId), getIssueNameNullSafe(targetIssue))); } }