fix:删除文件夹,重命名文件夹需要添加跳过权限校验功能
This commit is contained in:
@@ -31,4 +31,7 @@ public class DelDirReq {
|
||||
@Schema(description = "审批模板名称")
|
||||
private String templateName;
|
||||
|
||||
@Schema(description = "是否跳过权限校验,默认为false", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private Boolean skipPermissionCheck = false;
|
||||
|
||||
}
|
||||
@@ -29,4 +29,7 @@ public class RenameDirReq {
|
||||
// 0相对路径,1绝对路径
|
||||
@Schema(description = "路径类型: 0相对路径, 1绝对路径", defaultValue = "0")
|
||||
private Integer type = 0;
|
||||
|
||||
@Schema(description = "是否跳过权限校验,默认为false", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private Boolean skipPermissionCheck = false;
|
||||
}
|
||||
@@ -531,9 +531,11 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
Integer dirType = deleteDirMetadataInfo.getDirType();
|
||||
|
||||
// 1. 权限校验(仅校验根目录删除权限)
|
||||
boolean hasDeletePermission = fileUserPermissionService.hasFilePermission(rootDirId, ThreadLocalContext.getUserId(), FilePermissionEnum.DELETE);
|
||||
if (!hasDeletePermission) {
|
||||
return SdmResponse.failed("没有删除权限");
|
||||
if (!Boolean.TRUE.equals(req.getSkipPermissionCheck())) {
|
||||
boolean hasDeletePermission = fileUserPermissionService.hasFilePermission(rootDirId, ThreadLocalContext.getUserId(), FilePermissionEnum.DELETE);
|
||||
if (!hasDeletePermission) {
|
||||
return SdmResponse.failed("没有删除权限");
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 空目录快速判定:检查是否存在子项
|
||||
@@ -1298,10 +1300,12 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
}
|
||||
|
||||
// 2. 权限校验
|
||||
boolean hasWritePermission = fileUserPermissionService.hasFilePermission(
|
||||
dirMetadataInfo.getId(), ThreadLocalContext.getUserId(), FilePermissionEnum.WRITE);
|
||||
if (!hasWritePermission) {
|
||||
return SdmResponse.failed("没有写入权限");
|
||||
if (!Boolean.TRUE.equals(req.getSkipPermissionCheck())) {
|
||||
boolean hasWritePermission = fileUserPermissionService.hasFilePermission(
|
||||
dirMetadataInfo.getId(), ThreadLocalContext.getUserId(), FilePermissionEnum.WRITE);
|
||||
if (!hasWritePermission) {
|
||||
return SdmResponse.failed("没有写入权限");
|
||||
}
|
||||
}
|
||||
|
||||
String newName = req.getNewName();
|
||||
|
||||
Reference in New Issue
Block a user