模型阅览权限取交集修改

This commit is contained in:
lihongyu 2022-08-28 14:51:23 +08:00
parent 2426c25957
commit 855e29d9eb
2 changed files with 64 additions and 8 deletions

View File

@ -452,7 +452,6 @@ public final class PublishListHistory extends DaoObject<PublishListHistoryModel>
* @return
*/
public String getLastPublishTaskIdByModelId(String repositoryId) {
System.out.println("repositoryId==============="+repositoryId);
//String sql = "SELECT pl.TASKID FROM APP_ACT_COE_PAL_PUBLISH p, APP_ACT_COE_PAL_PUBLISH_LIST pl WHERE pl.pid = p.id AND pl.palrepositoryid = ? ORDER BY publishdate DESC";
String sql="SELECT TASKID FROM (SELECT TASKID FROM BO_ACT_COE_PUBLISH_N WHERE PUBLISHFILEID=? ORDER BY CREATEDATE DESC) WHERE ROWNUM=1";
String taskId = DBSql.getObject(sql, new RowMapper<String>() {
@ -462,7 +461,6 @@ public final class PublishListHistory extends DaoObject<PublishListHistoryModel>
}
}, new Object[] { repositoryId });
System.out.println("taskID====================="+taskId);
return taskId;
}

View File

@ -3530,8 +3530,53 @@ public class PALRepositoryQueryAPIManager {
return true;
}
}
// 判断组织权限
String orgPerm = bo.getString("ORGPERM");
String postPerm = bo.getString("POSTPERM");
String levelPerm = bo.getString("LEVELPERM");
// 根据发布流程选择的发布范围获取所选组织岗位职级的交集进行权限控制
// 都不为空时
if (UtilString.isNotEmpty(orgPerm) && UtilString.isNotEmpty(postPerm) && UtilString.isNotEmpty(levelPerm)) {
if (getOrgPerm(orgPerm, uc) && getPostPerm(postPerm, uc) && getLevelPerm(levelPerm, uc)) {
return true;
}
// 职级为空时
} else if (UtilString.isNotEmpty(orgPerm) && UtilString.isNotEmpty(postPerm) && UtilString.isEmpty(levelPerm)) {
if (getOrgPerm(orgPerm, uc) && getPostPerm(postPerm, uc)) {
return true;
}
// 岗位为空时
} else if (UtilString.isNotEmpty(orgPerm) && UtilString.isNotEmpty(levelPerm) && UtilString.isEmpty(postPerm)) {
if (getOrgPerm(orgPerm, uc) && getLevelPerm(levelPerm, uc)) {
return true;
}
// 组织为空时
} else if (UtilString.isNotEmpty(postPerm) && UtilString.isNotEmpty(levelPerm) && UtilString.isEmpty(orgPerm)) {
if (getPostPerm(postPerm, uc) && getLevelPerm(levelPerm, uc)) {
return true;
}
// 组织岗位为空时
} else if (UtilString.isNotEmpty(levelPerm) && UtilString.isEmpty(postPerm) && UtilString.isEmpty(orgPerm)) {
if (getLevelPerm(levelPerm, uc)) {
return true;
}
// 组织职级为空时
} else if (UtilString.isNotEmpty(postPerm) && UtilString.isEmpty(levelPerm) && UtilString.isEmpty(orgPerm)) {
if (getPostPerm(postPerm, uc)) {
return true;
}
// 岗位职级为空时
} else if (UtilString.isNotEmpty(orgPerm) && UtilString.isEmpty(levelPerm) && UtilString.isEmpty(postPerm)) {
if (getOrgPerm(orgPerm, uc)) {
return true;
}
}
return false;
}
//组织权限
private boolean getOrgPerm(String orgPerm,UserContext uc) {
if (UtilString.isNotEmpty(orgPerm)) {
// 兼职
Set<String> deptIdSet = new HashSet<>();
@ -3556,8 +3601,10 @@ public class PALRepositoryQueryAPIManager {
}
}
}
// 判断岗位权限
String postPerm = bo.getString("POSTPERM");
return false;
}
//岗位权限
private boolean getPostPerm(String postPerm,UserContext uc) {
if (UtilString.isNotEmpty(postPerm)) {
String positionNo = uc.getUserModel().getPositionNo();
String [] positionIds = postPerm.split(",");
@ -3569,10 +3616,21 @@ public class PALRepositoryQueryAPIManager {
return true;
}
}
// 判断职级权限
String levelPerm = bo.getString("LEVELPERM");
return false;
}
//职级权限
private boolean getLevelPerm(String levelPerm,UserContext uc) {
if (UtilString.isNotEmpty(levelPerm)) {
// todo 待完善
String userLevelPerm = uc.getUserModel().getExt2();
String[] levelPermspArray = levelPerm.split(",");
Set<String> levelPermspSet = new HashSet<>();
for (int i = 0; i < levelPermspArray.length; i++) {
levelPermspSet.add(levelPermspArray[i]);
}
if(levelPermspSet.contains(userLevelPerm)) {
return true;
}
}
return false;
}