新增小组接口:获取隐藏角色配置-用户权限
This commit is contained in:
parent
f7b73da52b
commit
98c638c42d
Binary file not shown.
@ -1,12 +1,17 @@
|
||||
package com.actionsoft.apps.coe.pal.cooperation;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.components.web.PALRepositoryTreeWeb;
|
||||
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.web.CooperationWeb;
|
||||
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
|
||||
import com.actionsoft.bpms.org.dao.User;
|
||||
import com.actionsoft.bpms.server.UserContext;
|
||||
import com.actionsoft.bpms.server.bind.annotation.Controller;
|
||||
import com.actionsoft.bpms.server.bind.annotation.Mapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Created by sunlh
|
||||
* @Date 2020-12-01
|
||||
@ -202,6 +207,19 @@ public class CooperationController {
|
||||
return web.queryRoleUpdateData(teamId, roleId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏角色配置信息
|
||||
* @param uc
|
||||
* @param teamId
|
||||
* @param userid
|
||||
* @return
|
||||
*/
|
||||
@Mapping("com.actionsoft.apps.coe.pal.cooperation_hide_role_update_data_query")
|
||||
public String queryHideRoleUpdateData(UserContext uc, String teamId, String userid) {
|
||||
CooperationWeb web = new CooperationWeb(uc);
|
||||
return web.queryHideRoleUpdateData(teamId, userid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设置的小组权限范围内的流程树结构
|
||||
* @param uc
|
||||
@ -308,4 +326,6 @@ public class CooperationController {
|
||||
return web.removeCooperationMember(teamId, userIds);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -898,6 +898,135 @@ public class CooperationWeb extends ActionWeb {
|
||||
return ro.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户权限信息
|
||||
* @param teamId
|
||||
* @param userid
|
||||
* @return
|
||||
*/
|
||||
public String queryHideRoleUpdateData(String teamId,String userid){
|
||||
ResponseObject ro = ResponseObject.newOkResponse();
|
||||
CoeCooperationAPIManager api = CoeCooperationAPIManager.getInstance();
|
||||
CoeCooperationTeamModel team = api.queryCooperationTeamById(teamId);
|
||||
if (team == null) {
|
||||
return ResponseObject.newErrResponse("查询失败,小组不存在").toString();
|
||||
}
|
||||
// 1.数据定义
|
||||
String wsId = team.getWsId();// 资产库Id
|
||||
String roleDesc = "";// 角色描述
|
||||
int roleType = CoeCooperationConst.ROLE_TYPE_CUSTOM;
|
||||
List<JSONObject> appPermOpts = new ArrayList<>();// 应用权限选项
|
||||
JSONArray actionPermOpts = new JSONArray();// 操作权限选项
|
||||
boolean isAllDataPerm = false;// 是否有全部数据权限
|
||||
List<String> dataPerm = new ArrayList<>();// 数据权限
|
||||
Map<String,List<String>> dataActionPerm = new HashMap<>(); //数据操作权限
|
||||
JSONArray dataActionPermOpts = new JSONArray();// 操作权限选项
|
||||
List<String> dataPermTextList = new ArrayList<>();// 数据权限文字,用于界面显示
|
||||
boolean isAllAppPerm = false;// 是否有全部应用权限
|
||||
List<String> appPerm = new ArrayList<>();// 应用权限
|
||||
List<String> actionPerm = new ArrayList<>();// 操作权限
|
||||
// 获取应用权限选项范围
|
||||
List<CooperationAppProfile> appList = CooperationAppManager.getList();
|
||||
for (CooperationAppProfile profile : appList) {
|
||||
JSONObject appObj = new JSONObject();
|
||||
appObj.put("value", profile.getTitle());
|
||||
appObj.put("label", profile.getId());
|
||||
appPermOpts.add(appObj);
|
||||
}
|
||||
//权限操作权限options
|
||||
JSONObject actionObj1 = new JSONObject();
|
||||
actionObj1.put("value", "新建流程");
|
||||
actionObj1.put("label", CoeCooperationConst.ACTION_CREATE_PROCESS);
|
||||
JSONObject actionObj2 = new JSONObject();
|
||||
actionObj2.put("value", "批量创建/替换");
|
||||
actionObj2.put("label", CoeCooperationConst.ACTION_BATCH);
|
||||
actionPermOpts.add(actionObj1);
|
||||
actionPermOpts.add(actionObj2);
|
||||
|
||||
//文件数据操作权限option
|
||||
JSONObject actionObj3 = new JSONObject();
|
||||
actionObj3.put("value", "编辑");
|
||||
actionObj3.put("label", CoeCooperationConst.ACTION_WRITE);
|
||||
JSONObject actionObj4 = new JSONObject();
|
||||
actionObj4.put("value", "删除");
|
||||
actionObj4.put("label", CoeCooperationConst.ACTION_DELETE);
|
||||
JSONObject actionObj5 = new JSONObject();
|
||||
actionObj5.put("value", "版本管理");
|
||||
actionObj5.put("label", CoeCooperationConst.ACTION_VERSION);
|
||||
dataActionPermOpts.add(actionObj3);
|
||||
dataActionPermOpts.add(actionObj4);
|
||||
dataActionPermOpts.add(actionObj5);
|
||||
|
||||
//查询隐藏角色
|
||||
CoeCooperationRoleDao roleDao = new CoeCooperationRoleDao();
|
||||
CoeCooperationRoleModel role = roleDao.getCooperationHideRoleByRoleName(teamId,userid);
|
||||
if (role == null) {
|
||||
return ResponseObject.newErrResponse("用户权限不存在").toString();
|
||||
}
|
||||
|
||||
roleDesc = role.getRoleDesc();
|
||||
roleType = role.getRoleType();
|
||||
// 获取模型全部数据权限
|
||||
isAllDataPerm = CoeCooperationConst.PERM_ALL.equalsIgnoreCase(role.getDataPerm());
|
||||
if (!isAllDataPerm) {
|
||||
// 获取小组的数据权限
|
||||
Set<String> teamPermVerIds = CooperationUtil.getPermRepositoryVersionIds(wsId, teamId, null, null);
|
||||
dataPerm = api.queryCooperationRoleDataPerms(teamId, role.getId());
|
||||
for (String palVersionId : dataPerm) {
|
||||
if (teamPermVerIds.contains(palVersionId)) {
|
||||
List<PALRepositoryModel> palRepositoryModels = PALRepositoryCache.getByVersionId(palVersionId);
|
||||
if (palRepositoryModels != null) {
|
||||
for (PALRepositoryModel palModel : palRepositoryModels) {
|
||||
if (palModel.isUse()) {
|
||||
dataPermTextList.add(palModel.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//具体文件的操作权限
|
||||
List<CoeCooperationRolePermModel> rolePermModels = api.queryCooperationRoleDataPermList(teamId, role.getId());
|
||||
for (CoeCooperationRolePermModel rolePermModel : rolePermModels) {
|
||||
dataActionPerm.put(rolePermModel.getPalVersionId(), Arrays.asList(rolePermModel.getActionPerm().split(",").clone()));
|
||||
}
|
||||
}
|
||||
|
||||
// 获取应用权限数据
|
||||
isAllAppPerm = CoeCooperationConst.PERM_ALL.equalsIgnoreCase(role.getAppPerm());
|
||||
if (!isAllAppPerm) {
|
||||
String appPermsStr = role.getAppPerm();
|
||||
if (UtilString.isNotEmpty(appPermsStr)) {
|
||||
appPerm = Arrays.asList(appPermsStr.split(","));
|
||||
}
|
||||
}
|
||||
// 获取操作权限数据
|
||||
String actionPermsStr = role.getActionPerm();
|
||||
if (UtilString.isNotEmpty(actionPermsStr)) {
|
||||
actionPerm = Arrays.asList(actionPermsStr.split(","));
|
||||
}
|
||||
|
||||
ro.put("wsId", wsId);
|
||||
ro.put("roleId", role.getId());
|
||||
ro.put("userid", userid);
|
||||
ro.put("isUser", role.getIsUser());
|
||||
ro.put("roleName", UserCache.getModel(userid).getUserName());
|
||||
ro.put("roleDesc", roleDesc);
|
||||
ro.put("roleType", roleType);
|
||||
ro.put("appPermOpts", appPermOpts);
|
||||
ro.put("actionPermOpts", actionPermOpts);
|
||||
ro.put("isAllDataPerm", isAllDataPerm);
|
||||
ro.put("isAllAppPerm", isAllAppPerm);
|
||||
ro.put("dataPerm", dataPerm);
|
||||
ro.put("dataActionPerm", dataActionPerm);
|
||||
ro.put("dataActionPermOpts", dataActionPermOpts);
|
||||
ro.put("appPerm", appPerm);
|
||||
ro.put("actionPerm", actionPerm);
|
||||
ro.put("dataPermText", StringUtils.join(dataPermTextList, ","));
|
||||
|
||||
return ro.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设置的小组权限范围内的流程树结构
|
||||
* @param wsId
|
||||
|
||||
Loading…
Reference in New Issue
Block a user