Commit 845adc66 by zhangkb

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

parent 96ae3889
......@@ -268,7 +268,7 @@ public class TagCtrl {
public Map<String,Object> getTagMetadataWithDataPrivilege(@RequestParam String dimensionType,
@RequestParam String idPath,@RequestParam(required = false) String keyword,
@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,
pageNum, pageSize, tagType);
}
......
......@@ -716,7 +716,7 @@ public class TagService {
//根据授予的元数据数据权限过滤标签关联的元数据
@SuppressWarnings("unchecked")
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();
logger.info("tag metadata user privilege:"+systemTagMap);
......@@ -758,8 +758,10 @@ public class TagService {
//根据当前用户被授予的标签获取关联的元数据
Set<String> tags = systemTagMap.get(Long.valueOf(sys));
for(String usrTag : tags) {
//根据标签id获取标签
Tag tag = this.getTagById(usrTag);
List<Map<String,Object>> tagContent = repoService.getByTagByPrivileges(
systemTagMap, null, usrTag, "1", "1", "",
systemTagMap, null, tag.getIdPath(), "1", "1", "",
pageNum, pageSize);
List<String> idList = new ArrayList<String>();
for(Map<String,Object> map : tagContent) {
......@@ -793,8 +795,10 @@ public class TagService {
mData.put("operable", "1");
}else {
for(String usrTag : tagList) {
//根据标签id获取标签
Tag tag = this.getTagById(usrTag);
List<Map<String,Object>> tagContent = repoService.getByTagByPrivileges(
systemTagMap, modelPath, usrTag, "1", "1", "",
systemTagMap, modelPath, tag.getIdPath(), "1", "1", "",
pageNum, pageSize);
List<String> idList = new ArrayList<String>();
for(Map<String,Object> map : tagContent) {
......@@ -847,15 +851,21 @@ public class TagService {
//根据当前用户被授予的标签获取关联的元数据
Set<String> tags = systemTagMap.get(Long.valueOf(sys));
for(String usrTag : tags) {
List<Map<String,Object>> tagContent = repoService.
getByTagByPrivileges(systemTagMap, null,
usrTag, "1", "1", "", 1, 10);
List<String> idList = new ArrayList<>();
for(Map<String,Object> map : tagContent) {
idList.add(map.get("_id").toString());
}
if(idList.contains(mData.get("_id"))) {
return true;
//根据标签id获取标签
try {
Tag uTag = this.getTagById(usrTag);
List<Map<String,Object>> tagContent = repoService.
getByTagByPrivileges(systemTagMap, null,
uTag.getIdPath(), "1", "1", "", 1, 10);
List<String> idList = new ArrayList<>();
for(Map<String,Object> map : tagContent) {
idList.add(map.get("_id").toString());
}
if(idList.contains(mData.get("_id"))) {
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