根据客户反馈文档《优化需求23.5.29反馈-6.6更新》中小组权限问题 做调整
This commit is contained in:
parent
f789cb2fa4
commit
bce486dd1c
Binary file not shown.
@ -283,11 +283,23 @@ public class CooperationWeb extends ActionWeb {
|
|||||||
msg = "保存小组管理员信息";
|
msg = "保存小组管理员信息";
|
||||||
if (isOk && repositoryVerIds.size() > 0) {
|
if (isOk && repositoryVerIds.size() > 0) {
|
||||||
// 创建权限信息
|
// 创建权限信息
|
||||||
|
Set<String> toBeInsertPermIds = new HashSet<>();
|
||||||
List<CoeCooperationTeamPermModel> perms = new ArrayList<>();
|
List<CoeCooperationTeamPermModel> perms = new ArrayList<>();
|
||||||
for (int i = 0; i < repositoryVerIds.size(); i++) {
|
for (int i = 0; i < repositoryVerIds.size(); i++) {
|
||||||
CoeCooperationTeamPermModel perm = new CoeCooperationTeamPermModel(UUIDGener.getUUID(), teamId, repositoryVerIds.getString(i));
|
CoeCooperationTeamPermModel perm = new CoeCooperationTeamPermModel(UUIDGener.getUUID(), teamId, repositoryVerIds.getString(i));
|
||||||
perms.add(perm);
|
perms.add(perm);
|
||||||
|
|
||||||
|
// 将当前数据的所有直接父级也加权限
|
||||||
|
PALRepositoryModel repositoryModel = PALRepositoryCache.getCache().get(repositoryVerIds.getString(i));
|
||||||
|
if (repositoryModel == null) continue;
|
||||||
|
String parentId = repositoryModel.getParentId();
|
||||||
|
recursionLookUp(parentId, toBeInsertPermIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (String permId : toBeInsertPermIds) {
|
||||||
|
CoeCooperationAPIManager.getInstance().addRepositoryToTeamAndRolePerm(teamId, permId);
|
||||||
|
}
|
||||||
|
|
||||||
isOk = api.createCooperationTeamPerms(perms);
|
isOk = api.createCooperationTeamPerms(perms);
|
||||||
msg = "保存小组数据权限信息";
|
msg = "保存小组数据权限信息";
|
||||||
}
|
}
|
||||||
@ -377,11 +389,23 @@ public class CooperationWeb extends ActionWeb {
|
|||||||
|
|
||||||
if (repositoryVerIds.size() > 0) {
|
if (repositoryVerIds.size() > 0) {
|
||||||
// 创建权限信息
|
// 创建权限信息
|
||||||
|
Set<String> toBeInsertPermIds = new HashSet<>();
|
||||||
List<CoeCooperationTeamPermModel> perms = new ArrayList<>();
|
List<CoeCooperationTeamPermModel> perms = new ArrayList<>();
|
||||||
for (int i = 0; i < repositoryVerIds.size(); i++) {
|
for (int i = 0; i < repositoryVerIds.size(); i++) {
|
||||||
CoeCooperationTeamPermModel perm = new CoeCooperationTeamPermModel(UUIDGener.getUUID(), teamId, repositoryVerIds.getString(i));
|
CoeCooperationTeamPermModel perm = new CoeCooperationTeamPermModel(UUIDGener.getUUID(), teamId, repositoryVerIds.getString(i));
|
||||||
perms.add(perm);
|
perms.add(perm);
|
||||||
|
|
||||||
|
// 将当前数据的所有直接父级也加权限
|
||||||
|
PALRepositoryModel repositoryModel = PALRepositoryCache.getCache().get(repositoryVerIds.getString(i));
|
||||||
|
if (repositoryModel == null) continue;
|
||||||
|
String parentId = repositoryModel.getParentId();
|
||||||
|
recursionLookUp(parentId, toBeInsertPermIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (String permId : toBeInsertPermIds) {
|
||||||
|
CoeCooperationAPIManager.getInstance().addRepositoryToTeamAndRolePerm(teamId, permId);
|
||||||
|
}
|
||||||
|
|
||||||
isOk = api.createCooperationTeamPerms(perms);
|
isOk = api.createCooperationTeamPerms(perms);
|
||||||
msg = "更新小组数据权限信息";
|
msg = "更新小组数据权限信息";
|
||||||
|
|
||||||
@ -406,6 +430,19 @@ public class CooperationWeb extends ActionWeb {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向上查找直接父级节点ID
|
||||||
|
* @param targetId
|
||||||
|
* @param toBeInsertPermIds
|
||||||
|
*/
|
||||||
|
private void recursionLookUp(String targetId, Set<String> toBeInsertPermIds){
|
||||||
|
if (targetId.length() < 36) return;
|
||||||
|
toBeInsertPermIds.add(targetId);
|
||||||
|
PALRepositoryModel targetModel = PALRepositoryCache.getCache().get(targetId);
|
||||||
|
String parentId = targetModel.getParentId();
|
||||||
|
recursionLookUp(parentId, toBeInsertPermIds);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询用户是否在PAL用户中
|
* 查询用户是否在PAL用户中
|
||||||
* @param adminArr
|
* @param adminArr
|
||||||
|
|||||||
Binary file not shown.
@ -588,6 +588,36 @@ public class CoeCooperationAPIManager {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向小组及其下的非隐藏角色的权限数据中添加数据
|
||||||
|
* @param teamId
|
||||||
|
* @param palVersionId
|
||||||
|
*/
|
||||||
|
public void addRepositoryToTeamAndRolePerm(String teamId, String palVersionId){
|
||||||
|
// 1、向小组权限中添加数据
|
||||||
|
List<String> teamPermList = queryCooperationTeamPermVerIds(teamId);
|
||||||
|
// 获取现有数据权限,判断是否已存在
|
||||||
|
if (!teamPermList.contains(palVersionId)) {
|
||||||
|
// 添加
|
||||||
|
CoeCooperationTeamPermModel teamPerm = new CoeCooperationTeamPermModel(UUIDGener.getUUID(), teamId, palVersionId);
|
||||||
|
new CoeCooperationTeamPermDao().insert(teamPerm);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2、获取小组下非隐藏角色(用户权限)的角色
|
||||||
|
List<CoeCooperationRoleModel> coeCooperationRoleModels = queryCooperationRoleList(teamId);
|
||||||
|
for (CoeCooperationRoleModel roleModel : coeCooperationRoleModels) {
|
||||||
|
// 判断是否设定的默认全部权限
|
||||||
|
if (!CoeCooperationConst.PERM_ALL.equals(roleModel.getDataPerm())) {
|
||||||
|
// 获取现有角色数据权限,判断是否已存在
|
||||||
|
List<String> rolePermList = new CoeCooperationRolePermDao().getRolePermListByRole(teamId, roleModel.getId());
|
||||||
|
if (!rolePermList.contains(palVersionId)){
|
||||||
|
CoeCooperationRolePermModel rolePerm = new CoeCooperationRolePermModel(UUIDGener.getUUID(), teamId, roleModel.getId(), palVersionId);
|
||||||
|
new CoeCooperationRolePermDao().insert(rolePerm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询用户在指定小组中的角色
|
* 查询用户在指定小组中的角色
|
||||||
* @param teamId
|
* @param teamId
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import com.actionsoft.apps.AppPlatformConfig;
|
|||||||
import com.actionsoft.apps.AppsConst;
|
import com.actionsoft.apps.AppsConst;
|
||||||
import com.actionsoft.apps.coe.pal.cooperation.CoeCooperationAPIManager;
|
import com.actionsoft.apps.coe.pal.cooperation.CoeCooperationAPIManager;
|
||||||
import com.actionsoft.apps.coe.pal.cooperation.cache.CooperationCache;
|
import com.actionsoft.apps.coe.pal.cooperation.cache.CooperationCache;
|
||||||
|
import com.actionsoft.apps.coe.pal.cooperation.cache.model.TeamInfo;
|
||||||
import com.actionsoft.apps.coe.pal.cooperation.constant.CoeCooperationConst;
|
import com.actionsoft.apps.coe.pal.cooperation.constant.CoeCooperationConst;
|
||||||
import com.actionsoft.apps.coe.pal.cooperation.model.CoeCooperationMemberModel;
|
import com.actionsoft.apps.coe.pal.cooperation.model.CoeCooperationMemberModel;
|
||||||
import com.actionsoft.apps.coe.pal.cooperation.model.CoeCooperationTeamModel;
|
import com.actionsoft.apps.coe.pal.cooperation.model.CoeCooperationTeamModel;
|
||||||
@ -8167,6 +8168,18 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
|||||||
if (!UtilString.isEmpty(teamId)) {// 小组赋权
|
if (!UtilString.isEmpty(teamId)) {// 小组赋权
|
||||||
CoeCooperationAPIManager.getInstance().addRepositoryToTeamAndRolePerm(_uc, teamId, model.getVersionId(), true, true);
|
CoeCooperationAPIManager.getInstance().addRepositoryToTeamAndRolePerm(_uc, teamId, model.getVersionId(), true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 新增的架构或者文件夹 自动加权 遍历所有小组 判断父级文件夹/架构是否在该小组下是否有权限
|
||||||
|
if (UtilString.isNotEmpty(parentId) && parentId.length() == 36){
|
||||||
|
List<TeamInfo> allTeamInfo = CoeCooperationAPIManager.getInstance().getAllTeamInfo();
|
||||||
|
for (TeamInfo teamInfo : allTeamInfo) {
|
||||||
|
Set<String> teamPermVersionIds = teamInfo.getVersionIds();
|
||||||
|
if (teamPermVersionIds.contains(parentId)){ // 当前新增的架构/文件夹的父级在小组权限中
|
||||||
|
CoeCooperationAPIManager.getInstance().addRepositoryToTeamAndRolePerm(teamId, model.getVersionId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 操作行为日志记录
|
// 操作行为日志记录
|
||||||
if (SDK.getAppAPI().getPropertyBooleanValue(CoEConstant.APP_ID, "IS_RECORD_OP_LOG", false)) {
|
if (SDK.getAppAPI().getPropertyBooleanValue(CoEConstant.APP_ID, "IS_RECORD_OP_LOG", false)) {
|
||||||
CoEOpLogAPI.auditOkOp(_uc, CoEOpLogConst.MODULE_CATEGORY_REPOSITORY, CoEOpLogConst.OP_CREATE, CoEOpLogConst.INFO_REPOSITORY_CREATE);
|
CoEOpLogAPI.auditOkOp(_uc, CoEOpLogConst.MODULE_CATEGORY_REPOSITORY, CoEOpLogConst.OP_CREATE, CoEOpLogConst.INFO_REPOSITORY_CREATE);
|
||||||
@ -8263,6 +8276,18 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
|||||||
if (!UtilString.isEmpty(teamId)) {
|
if (!UtilString.isEmpty(teamId)) {
|
||||||
CoeCooperationAPIManager.getInstance().addRepositoryToTeamAndRolePerm(_uc, teamId, model.getVersionId(), true, true);
|
CoeCooperationAPIManager.getInstance().addRepositoryToTeamAndRolePerm(_uc, teamId, model.getVersionId(), true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 新增的架构或者文件夹 自动加权 遍历所有小组 判断父级文件夹/架构是否在该小组下是否有权限
|
||||||
|
if (UtilString.isNotEmpty(parentId) && parentId.length() == 36){
|
||||||
|
List<TeamInfo> allTeamInfo = CoeCooperationAPIManager.getInstance().getAllTeamInfo();
|
||||||
|
for (TeamInfo teamInfo : allTeamInfo) {
|
||||||
|
Set<String> teamPermVersionIds = teamInfo.getVersionIds();
|
||||||
|
if (teamPermVersionIds.contains(parentId)){ // 当前新增的架构/文件夹的父级在小组权限中
|
||||||
|
CoeCooperationAPIManager.getInstance().addRepositoryToTeamAndRolePerm(teamId, model.getVersionId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ro.put("id", id);
|
ro.put("id", id);
|
||||||
// 操作行为日志记录
|
// 操作行为日志记录
|
||||||
if (SDK.getAppAPI().getPropertyBooleanValue(CoEConstant.APP_ID, "IS_RECORD_OP_LOG", false)) {
|
if (SDK.getAppAPI().getPropertyBooleanValue(CoEConstant.APP_ID, "IS_RECORD_OP_LOG", false)) {
|
||||||
@ -10743,6 +10768,25 @@ public String deleteReply(String replyid, String messageid) {
|
|||||||
if (SDK.getAppAPI().getPropertyBooleanValue(CoEConstant.APP_ID, "IS_RECORD_OP_LOG", false)) {
|
if (SDK.getAppAPI().getPropertyBooleanValue(CoEConstant.APP_ID, "IS_RECORD_OP_LOG", false)) {
|
||||||
CoEOpLogAPI.auditOkOp(_uc, CoEOpLogConst.MODULE_CATEGORY_REPOSITORY, CoEOpLogConst.OP_UPDATE, CoEOpLogConst.INFO_REPOSITORY_MOVE_UPDATE);
|
CoEOpLogAPI.auditOkOp(_uc, CoEOpLogConst.MODULE_CATEGORY_REPOSITORY, CoEOpLogConst.OP_UPDATE, CoEOpLogConst.INFO_REPOSITORY_MOVE_UPDATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<TeamInfo> allTeamInfo = CoeCooperationAPIManager.getInstance().getAllTeamInfo();
|
||||||
|
for (TeamInfo teamInfo : allTeamInfo) {
|
||||||
|
boolean isPerm = false; // 移动的文件/文件夹/架构 只要有一个在当前小组数据权限中 则 目标文件/文件夹/架构及所有直接父级都放入小组权限中
|
||||||
|
Set<String> teamInfoPermIds = teamInfo.getVersionIds();
|
||||||
|
Set<String> toBeInsertPermIds = new HashSet<>();
|
||||||
|
for (PALRepositoryModel repositoryModel : sourceList) {
|
||||||
|
isPerm = teamInfoPermIds.contains(repositoryModel.getVersionId());
|
||||||
|
if (isPerm) break;
|
||||||
|
}
|
||||||
|
if (isPerm){
|
||||||
|
recursionLookUp(targetId, toBeInsertPermIds);
|
||||||
|
for (String permId : toBeInsertPermIds) {
|
||||||
|
CoeCooperationAPIManager.getInstance().addRepositoryToTeamAndRolePerm(teamInfo.getTeamId(), permId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* by bzp
|
* by bzp
|
||||||
*/
|
*/
|
||||||
@ -10751,6 +10795,19 @@ public String deleteReply(String replyid, String messageid) {
|
|||||||
return ro.toString();
|
return ro.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向上查找直接父级节点ID
|
||||||
|
* @param targetId
|
||||||
|
* @param toBeInsertPermIds
|
||||||
|
*/
|
||||||
|
private void recursionLookUp(String targetId, Set<String> toBeInsertPermIds){
|
||||||
|
if (targetId.length() < 36) return;
|
||||||
|
toBeInsertPermIds.add(targetId);
|
||||||
|
PALRepositoryModel targetModel = PALRepositoryCache.getCache().get(targetId);
|
||||||
|
String parentId = targetModel.getParentId();
|
||||||
|
recursionLookUp(parentId, toBeInsertPermIds);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* by bzp
|
* by bzp
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user