修复了compareProjectAccessLevel的错误使用
parent
71cb31427f
commit
ff47276365
|
@ -94,7 +94,7 @@ public class ProjectGroupController {
|
|||
@PathVariable Integer projectId,
|
||||
@PathVariable Integer staffId
|
||||
) {
|
||||
if (projectGroupService.compareProjectAccessLevel(projectId, token, staffId) <= 0) {
|
||||
if (projectGroupService.compareProjectAccessLevel(projectId, token, staffId) >= 0) {
|
||||
throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
|
||||
}
|
||||
if (projectGroupService.remove(Wrappers.<ProjectGroup>lambdaQuery()
|
||||
|
|
|
@ -45,7 +45,7 @@ public interface IProjectGroupService extends IService<ProjectGroup> {
|
|||
* <p>
|
||||
* token持有者的判断受全局权限影响,目标id不会
|
||||
* <p>
|
||||
* 返回类似于{@link Integer#compare(int, int)}
|
||||
* 返回类似于{@link Integer#compare(int, int)},推荐使用compareProjectAccessLevel(...)>(或其他逻辑判断符)0,若<则token持有者拥有更高权限
|
||||
*/
|
||||
Integer compareProjectAccessLevel(Integer projectId, String token, Integer targetId);
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ public class AnnouncementServiceImpl extends ServiceImpl<AnnouncementMapper, Ann
|
|||
if (!Objects.equals(projectId, rawAnnouncement.getProjectId())) {
|
||||
throw new BadRequestException(BadRequestException.WRONG_PARAMETERS);
|
||||
}
|
||||
if (projectGroupService.compareProjectAccessLevel(projectId, token, rawAnnouncement.getAnnouncementPublisherId()) < 0) {
|
||||
if (projectGroupService.compareProjectAccessLevel(projectId, token, rawAnnouncement.getAnnouncementPublisherId()) > 0) {
|
||||
throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
|
||||
}
|
||||
return removeById(announcementId);
|
||||
|
|
|
@ -443,7 +443,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
|||
|| projectGroupService.getProjectAccessLevelIgnoreGlobalLevel(transferredStaffId, projectId) == 0) {
|
||||
throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
|
||||
}
|
||||
if (projectGroupService.compareProjectAccessLevel(projectId, token, transferredStaffId) < 0) {
|
||||
if (projectGroupService.compareProjectAccessLevel(projectId, token, transferredStaffId) > 0) {
|
||||
throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
|
||||
}
|
||||
|
||||
|
@ -498,7 +498,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
|
|||
|| projectGroupService.getProjectAccessLevelIgnoreGlobalLevel(targetStaffId, projectId) == 0) {
|
||||
throw new ForbiddenException(IProjectGroupService.UNABLE_TO_ACCESS_PROJECT);
|
||||
}
|
||||
if (projectGroupService.compareProjectAccessLevel(projectId, token, transferredStaffId) < 0) {
|
||||
if (projectGroupService.compareProjectAccessLevel(projectId, token, transferredStaffId) > 0) {
|
||||
throw new ForbiddenException(ForbiddenException.UNABLE_TO_OPERATE);
|
||||
}
|
||||
Long transferredTaskCount = baseMapper.selectCount(Wrappers.<Task>lambdaQuery().eq(Task::getTaskHolderId, transferredStaffId));
|
||||
|
|
Loading…
Reference in New Issue