PAL主页进行模型删除时,增加校验删除模型或者子级所有版本的状态,已发布不允许删除

This commit is contained in:
446052889@qq.com 2024-09-19 16:08:09 +08:00
parent d3aceea5e7
commit 825f704851
2 changed files with 17 additions and 4 deletions

View File

@ -11668,6 +11668,22 @@ public class CoeProcessLevelWeb extends ActionWeb {
for (int i = 0; i < repositoryIdArr.size(); i++) {
String repositoryId = repositoryIdArr.getString(i);
PALRepositoryModel model = PALRepositoryCache.getCache().get(repositoryId);
List<PALRepositoryModel> removeList = new ArrayList<>();// 记录所有要删除的版本和子级
removeList.addAll(PALRepositoryCache.getByVersionId(model.getVersionId()));// 当前模型的所有版本
List<PALRepositoryModel> childList = new ArrayList<>();
Set<String> ids = new HashSet<>();
PALRepositoryCache.getAllChildrenModelsByPid(model.getWsId(), model.getId(), childList, ids);
removeList.addAll(childList);
for (PALRepositoryModel removeModel : removeList) {
//普通用户不允许删除已发布的文件
if (removeModel.isPublish() && !"admin".equals(_uc.getUID())) {
return ResponseObject.newErrResponse("已发布文件["+ removeModel.getName() + VersionUtil.getVersionStrV(removeModel.getVersion()) + "]不允许删除,请联系系统管理员!").toString();
}
}
//新版小组的权限校验
ResponseObject res = ResponseObject.newOkResponse();
CoeCooperationAPIManager.getInstance().queryCooperationFileActionPerm(teamId, _uc.getUID(), model.getVersionId(), res);
@ -11676,10 +11692,7 @@ public class CoeProcessLevelWeb extends ActionWeb {
failed++;
continue;
}
//普通用户不允许删除已发布的文件
if (model.isPublish() && !"admin".equals(_uc.getUID())) {
return ResponseObject.newErrResponse("已发布文件不允许删除,请联系系统管理员!").toString();
}
if (model.isPublish() && "admin".equals(_uc.getUID())) {
CancelPublishKnwl("com.actionsoft.apps.coe.pal", _uc.getSessionId(), model.getExt4());
}