Commit 845adc66 by zhangkb

用户权限接口之前返回是标签idPath,现在改成返回标签id,所以涉及相关代码修改

parent 96ae3889
...@@ -268,7 +268,7 @@ public class TagCtrl { ...@@ -268,7 +268,7 @@ public class TagCtrl {
public Map<String,Object> getTagMetadataWithDataPrivilege(@RequestParam String dimensionType, public Map<String,Object> getTagMetadataWithDataPrivilege(@RequestParam String dimensionType,
@RequestParam String idPath,@RequestParam(required = false) String keyword, @RequestParam String idPath,@RequestParam(required = false) String keyword,
@RequestParam(required = false) String modelPath,@RequestParam int pageNum, @RequestParam(required = false) String modelPath,@RequestParam int pageNum,
@RequestParam int pageSize,@RequestParam String tagType){ @RequestParam int pageSize,@RequestParam String tagType)throws Exception{
return tagService.getTagMetadataWithDataPrivilege(dimensionType, idPath, keyword, modelPath, return tagService.getTagMetadataWithDataPrivilege(dimensionType, idPath, keyword, modelPath,
pageNum, pageSize, tagType); pageNum, pageSize, tagType);
} }
......
...@@ -716,7 +716,7 @@ public class TagService { ...@@ -716,7 +716,7 @@ public class TagService {
//根据授予的元数据数据权限过滤标签关联的元数据 //根据授予的元数据数据权限过滤标签关联的元数据
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public Map<String,Object> getTagMetadataWithDataPrivilege(String dimensionType,String idPath, public Map<String,Object> getTagMetadataWithDataPrivilege(String dimensionType,String idPath,
String keyword,String modelPath,int pageNum,int pageSize,String tagType){ String keyword,String modelPath,int pageNum,int pageSize,String tagType)throws Exception{
//获取用户关联的数据权限 //获取用户关联的数据权限
Map<Long, Set<String>> systemTagMap = GrantedAuthHelper.getDataPrivileges(); Map<Long, Set<String>> systemTagMap = GrantedAuthHelper.getDataPrivileges();
logger.info("tag metadata user privilege:"+systemTagMap); logger.info("tag metadata user privilege:"+systemTagMap);
...@@ -758,8 +758,10 @@ public class TagService { ...@@ -758,8 +758,10 @@ public class TagService {
//根据当前用户被授予的标签获取关联的元数据 //根据当前用户被授予的标签获取关联的元数据
Set<String> tags = systemTagMap.get(Long.valueOf(sys)); Set<String> tags = systemTagMap.get(Long.valueOf(sys));
for(String usrTag : tags) { for(String usrTag : tags) {
//根据标签id获取标签
Tag tag = this.getTagById(usrTag);
List<Map<String,Object>> tagContent = repoService.getByTagByPrivileges( List<Map<String,Object>> tagContent = repoService.getByTagByPrivileges(
systemTagMap, null, usrTag, "1", "1", "", systemTagMap, null, tag.getIdPath(), "1", "1", "",
pageNum, pageSize); pageNum, pageSize);
List<String> idList = new ArrayList<String>(); List<String> idList = new ArrayList<String>();
for(Map<String,Object> map : tagContent) { for(Map<String,Object> map : tagContent) {
...@@ -793,8 +795,10 @@ public class TagService { ...@@ -793,8 +795,10 @@ public class TagService {
mData.put("operable", "1"); mData.put("operable", "1");
}else { }else {
for(String usrTag : tagList) { for(String usrTag : tagList) {
//根据标签id获取标签
Tag tag = this.getTagById(usrTag);
List<Map<String,Object>> tagContent = repoService.getByTagByPrivileges( List<Map<String,Object>> tagContent = repoService.getByTagByPrivileges(
systemTagMap, modelPath, usrTag, "1", "1", "", systemTagMap, modelPath, tag.getIdPath(), "1", "1", "",
pageNum, pageSize); pageNum, pageSize);
List<String> idList = new ArrayList<String>(); List<String> idList = new ArrayList<String>();
for(Map<String,Object> map : tagContent) { for(Map<String,Object> map : tagContent) {
...@@ -847,9 +851,12 @@ public class TagService { ...@@ -847,9 +851,12 @@ public class TagService {
//根据当前用户被授予的标签获取关联的元数据 //根据当前用户被授予的标签获取关联的元数据
Set<String> tags = systemTagMap.get(Long.valueOf(sys)); Set<String> tags = systemTagMap.get(Long.valueOf(sys));
for(String usrTag : tags) { for(String usrTag : tags) {
//根据标签id获取标签
try {
Tag uTag = this.getTagById(usrTag);
List<Map<String,Object>> tagContent = repoService. List<Map<String,Object>> tagContent = repoService.
getByTagByPrivileges(systemTagMap, null, getByTagByPrivileges(systemTagMap, null,
usrTag, "1", "1", "", 1, 10); uTag.getIdPath(), "1", "1", "", 1, 10);
List<String> idList = new ArrayList<>(); List<String> idList = new ArrayList<>();
for(Map<String,Object> map : tagContent) { for(Map<String,Object> map : tagContent) {
idList.add(map.get("_id").toString()); idList.add(map.get("_id").toString());
...@@ -857,6 +864,9 @@ public class TagService { ...@@ -857,6 +864,9 @@ public class TagService {
if(idList.contains(mData.get("_id"))) { if(idList.contains(mData.get("_id"))) {
return true; return true;
} }
} catch (TagNotExistException e) {
e.printStackTrace();
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment