update to v1.2.0 进一步完善了移动权限

This commit is contained in:
kohgylw 2024-01-06 18:21:13 +08:00
parent 82aef830d0
commit 12243ff603
8 changed files with 12 additions and 1 deletions

View File

@ -551,6 +551,11 @@ public class FileServiceImpl extends RangeFileStreamWriter implements FileServic
if (!ConfigureReader.instance().authorized(account, AccountAuth.MOVE_FILES, fu.getAllFoldersId(locationpath))) { if (!ConfigureReader.instance().authorized(account, AccountAuth.MOVE_FILES, fu.getAllFoldersId(locationpath))) {
return NO_AUTHORIZED; return NO_AUTHORIZED;
} }
// 如果执行的是剪切操作则还需要同时具备删除权限
if (!isCopy && !ConfigureReader.instance().authorized(account, AccountAuth.DELETE_FILE_OR_FOLDER,
fu.getAllFoldersId(locationpath))) {
return NO_AUTHORIZED;
}
// 对涉及的文件和文件夹逐一进行移动或复制操作 // 对涉及的文件和文件夹逐一进行移动或复制操作
try { try {
// 获取存在冲突的文件的对应处理表 // 获取存在冲突的文件的对应处理表
@ -905,8 +910,14 @@ public class FileServiceImpl extends RangeFileStreamWriter implements FileServic
Folder targetFolder = flm.queryById(locationpath); Folder targetFolder = flm.queryById(locationpath);
int needMovefilesCount = 0;// 记录可以合法移动或复制的文件数目 int needMovefilesCount = 0;// 记录可以合法移动或复制的文件数目
int needMoveFoldersCount = 0;// 同理记录可以合法移动或复制的文件夹数目 int needMoveFoldersCount = 0;// 同理记录可以合法移动或复制的文件夹数目
// 权限检查确认是否具备移动权限
if (ConfigureReader.instance().accessFolder(targetFolder, account) && ConfigureReader.instance() if (ConfigureReader.instance().accessFolder(targetFolder, account) && ConfigureReader.instance()
.authorized(account, AccountAuth.MOVE_FILES, fu.getAllFoldersId(locationpath))) { .authorized(account, AccountAuth.MOVE_FILES, fu.getAllFoldersId(locationpath))) {
// 如果执行的是剪切操作则还需要同时具备删除权限
if (!isCopy && !ConfigureReader.instance().authorized(account, AccountAuth.DELETE_FILE_OR_FOLDER,
fu.getAllFoldersId(locationpath))) {
return NO_AUTHORIZED;
}
try { try {
final List<String> idList = gson.fromJson(strIdList, new TypeToken<List<String>>() { final List<String> idList = gson.fromJson(strIdList, new TypeToken<List<String>>() {
}.getType()); }.getType());

View File

@ -1,5 +1,5 @@
#Generated by Maven Integration for Eclipse #Generated by Maven Integration for Eclipse
#Sat Jan 06 18:07:31 CST 2024 #Sat Jan 06 18:20:23 CST 2024
m2e.projectLocation=/Users/kohgylw/Programs/java_workspace/kiftd m2e.projectLocation=/Users/kohgylw/Programs/java_workspace/kiftd
m2e.projectName=kiftd m2e.projectName=kiftd
groupId=kohgylw groupId=kohgylw