Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IVYPORTAL-17553 TaskWriteExpiryTimestamp does not work as expected #1020

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,34 @@ public boolean canChangePriority(ITask task) {
return isNotDone(task) && hasPermission(task, IPermission.TASK_WRITE_ORIGINAL_PRIORITY);
}

/**
* Logic to check if user can change task expiry date:
* - Task not null
* - Task state is different from DONE, DESTROYED
* - User has permission TaskWriteExpiryTimestamp
* - The task has expiry handler or has expiry option 'Nobody & delete'
*
* @param task
* @return condition whether the user can change expiry time
*/

public boolean canChangeExpiry(ITask task) {
List<TaskBusinessState> taskStates = Arrays.asList(TaskBusinessState.DONE, TaskBusinessState.DESTROYED);
return (hasPermission(task, IPermission.TASK_WRITE_EXPIRY_TIMESTAMP)
|| (task != null && StringUtils.isNotBlank(task.getExpiryTaskStartElementPid())))
&& !taskStates.contains(task.getBusinessState());
List<TaskState> nonChangeableExpiryStates = Arrays.asList(TaskState.DONE,
TaskState.DESTROYED);

if (task == null || nonChangeableExpiryStates.contains(task.getState())) {
return false;
}

boolean isAutoDeleteAfterExpiry = StringUtils
.isBlank(task.getExpiryActivatorName())
&& StringUtils.isBlank(task.getExpiryTaskStartElementPid());

boolean hasExpiryHandler = StringUtils
.isNotBlank(task.getExpiryTaskStartElementPid());

return hasPermission(task, IPermission.TASK_WRITE_EXPIRY_TIMESTAMP)
&& (isAutoDeleteAfterExpiry || hasExpiryHandler);
}

public boolean canChangeDelayTimestamp(ITask task) {
Expand Down
Loading