修正了Task修改的一个漏洞

master
白封羽 2022-07-04 15:22:07 +08:00
parent c7f448ef81
commit e548a2fce0
1 changed files with 7 additions and 2 deletions

View File

@ -1,5 +1,6 @@
package cn.edu.hfut.rmdjzz.projectmanagement.entity;
import cn.edu.hfut.rmdjzz.projectmanagement.service.IProjectGroupService;
import cn.edu.hfut.rmdjzz.projectmanagement.utils.BeanUtils;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
@ -8,6 +9,7 @@ import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import java.time.LocalDateTime;
import java.util.Map;
@ -19,7 +21,8 @@ import java.util.Objects;
*/
@Data
public class Task {
@Autowired
private IProjectGroupService projectGroupService;
public static final String ATTACH_DEMAND_SOURCE = "demandSource";
public static final String ATTACH_ESTIMATED_MAN_HOURS = "estimatedManHours";
public static final String ATTACH_SEVERITY = "severity";
@ -100,7 +103,7 @@ public class Task {
return false;
if (father.getTaskId() == 0)
return true;
if(!father.getTaskStatus().equals(STATUS_WAITING)&&!father.getTaskStatus().equals(STATUS_PROCESSING))
if (!father.getTaskStatus().equals(STATUS_WAITING) && !father.getTaskStatus().equals(STATUS_PROCESSING))
return false;
if (this.getTaskType().equals(TYPE_DEFECT)) {
return father.getTaskType().equals(TYPE_DEMAND);
@ -113,6 +116,8 @@ public class Task {
}
public Boolean checkModification(Task rawTask) {
if (projectGroupService.getProjectAccessLevel(this.getTaskHolderId(), 3, this.getTaskProjectId()) == 0)
return false;
if (rawTask.getTaskStatus().equals(STATUS_COMPLETED) || rawTask.getTaskStatus().equals(STATUS_CLOSED))
return false;
if (!rawTask.getTaskStatus().equals(STATUS_WAITING) && this.getTaskStatus().equals(STATUS_WAITING))