From 0674e479714eca8eac529ca0a68f9301da0ddc13 Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Fri, 19 Jul 2024 14:52:57 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E5=90=8E=E7=AB=AF-?= =?UTF-8?q?=E5=B7=A5=E5=8D=95=E6=9F=A5=E7=9C=8B=E6=9D=83=E9=99=90-?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E9=80=9A=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1204167459176448]后端-工单查看权限-服务通道 http://192.168.0.96:8090/demo/rdm.html#/task-detail/939050947543040/939050947543050/1204167459176448 --- .../catalog/CalalogBreadcrumbSearchApi.java | 2 +- .../api/catalog/CatalogTreeSearchApi.java | 2 +- .../relation/CalalogBreadcrumbApi.java | 2 +- .../api/catalog/relation/CatalogTreeApi.java | 2 +- .../process/api/channel/ChannelGetApi.java | 8 ++++- .../process/api/channel/ChannelSaveApi.java | 3 +- .../process/api/channel/ChannelSearchApi.java | 3 +- .../dao/mapper/catalog/ChannelMapper.java | 10 ++++-- .../dao/mapper/catalog/ChannelMapper.xml | 32 ++++++++++++------- .../process/service/CatalogServiceImpl.java | 21 +++++++----- .../process/service/ChannelServiceImpl.java | 17 ++++++++-- .../changelog/2024-07-19/neatlogic_tenant.sql | 4 +++ .../process/changelog/2024-07-19/version.json | 10 ++++++ .../resources/process/sqlscript/ddl.sql | 3 +- 14 files changed, 85 insertions(+), 34 deletions(-) create mode 100644 src/main/resources/neatlogic/resources/process/changelog/2024-07-19/neatlogic_tenant.sql create mode 100644 src/main/resources/neatlogic/resources/process/changelog/2024-07-19/version.json diff --git a/src/main/java/neatlogic/module/process/api/catalog/CalalogBreadcrumbSearchApi.java b/src/main/java/neatlogic/module/process/api/catalog/CalalogBreadcrumbSearchApi.java index ad6e1efdd..61a3f0072 100644 --- a/src/main/java/neatlogic/module/process/api/catalog/CalalogBreadcrumbSearchApi.java +++ b/src/main/java/neatlogic/module/process/api/catalog/CalalogBreadcrumbSearchApi.java @@ -85,7 +85,7 @@ public class CalalogBreadcrumbSearchApi extends PrivateApiComponentBase { JSONObject resultObj = new JSONObject(); resultObj.put("breadcrumbList", new ArrayList<>()); //已授权的服务uuid - List currentUserAuthorizedChannelUuidList = channelMapper.getAuthorizedChannelUuidList(UserContext.get().getUserUuid(true), authenticationInfoVo.getTeamUuidList(), authenticationInfoVo.getRoleUuidList(), null); + List currentUserAuthorizedChannelUuidList = channelMapper.getAuthorizedChannelUuidList(UserContext.get().getUserUuid(true), authenticationInfoVo.getTeamUuidList(), authenticationInfoVo.getRoleUuidList(), CatalogChannelAuthorityAction.REPORT.getValue(), null); if (CollectionUtils.isEmpty(currentUserAuthorizedChannelUuidList)) { return resultObj; } diff --git a/src/main/java/neatlogic/module/process/api/catalog/CatalogTreeSearchApi.java b/src/main/java/neatlogic/module/process/api/catalog/CatalogTreeSearchApi.java index 0d5904941..98c4614bd 100755 --- a/src/main/java/neatlogic/module/process/api/catalog/CatalogTreeSearchApi.java +++ b/src/main/java/neatlogic/module/process/api/catalog/CatalogTreeSearchApi.java @@ -74,7 +74,7 @@ public class CatalogTreeSearchApi extends PrivateApiComponentBase { return new ArrayList<>(); } //已授权的服务uuid - List currentUserAuthorizedChannelUuidList = channelMapper.getAuthorizedChannelUuidList(UserContext.get().getUserUuid(true), authenticationInfoVo.getTeamUuidList(), authenticationInfoVo.getRoleUuidList(), null); + List currentUserAuthorizedChannelUuidList = channelMapper.getAuthorizedChannelUuidList(UserContext.get().getUserUuid(true), authenticationInfoVo.getTeamUuidList(), authenticationInfoVo.getRoleUuidList(), CatalogChannelAuthorityAction.REPORT.getValue(), null); if(CollectionUtils.isEmpty(currentUserAuthorizedChannelUuidList)) { return new ArrayList<>(); } diff --git a/src/main/java/neatlogic/module/process/api/catalog/relation/CalalogBreadcrumbApi.java b/src/main/java/neatlogic/module/process/api/catalog/relation/CalalogBreadcrumbApi.java index f38475326..ac3cadc6c 100755 --- a/src/main/java/neatlogic/module/process/api/catalog/relation/CalalogBreadcrumbApi.java +++ b/src/main/java/neatlogic/module/process/api/catalog/relation/CalalogBreadcrumbApi.java @@ -108,7 +108,7 @@ public class CalalogBreadcrumbApi extends PrivateApiComponentBase { } AuthenticationInfoVo authenticationInfoVo = UserContext.get().getAuthenticationInfoVo(); //已授权的服务uuid - List currentUserAuthorizedChannelUuidList = channelMapper.getAuthorizedChannelUuidList(UserContext.get().getUserUuid(true), authenticationInfoVo.getTeamUuidList(), authenticationInfoVo.getRoleUuidList(), null); + List currentUserAuthorizedChannelUuidList = channelMapper.getAuthorizedChannelUuidList(UserContext.get().getUserUuid(true), authenticationInfoVo.getTeamUuidList(), authenticationInfoVo.getRoleUuidList(), CatalogChannelAuthorityAction.REPORT.getValue(), null); /** 2021-10-11 开晚会时确认用户个人设置任务授权不包括服务上报权限 **/ // String agentUuid = userMapper.getUserUuidByAgentUuidAndFunc(UserContext.get().getUserUuid(true), "processtask"); // if(StringUtils.isNotBlank(agentUuid)){ diff --git a/src/main/java/neatlogic/module/process/api/catalog/relation/CatalogTreeApi.java b/src/main/java/neatlogic/module/process/api/catalog/relation/CatalogTreeApi.java index 8bff3e8e7..a413e95dc 100755 --- a/src/main/java/neatlogic/module/process/api/catalog/relation/CatalogTreeApi.java +++ b/src/main/java/neatlogic/module/process/api/catalog/relation/CatalogTreeApi.java @@ -102,7 +102,7 @@ public class CatalogTreeApi extends PrivateApiComponentBase { // } if(CollectionUtils.isNotEmpty(currentUserAuthorizedCatalogUuidList)) { //已授权的服务uuid - List currentUserAuthorizedChannelUuidList = channelMapper.getAuthorizedChannelUuidList(UserContext.get().getUserUuid(true), authenticationInfoVo.getTeamUuidList(), authenticationInfoVo.getRoleUuidList(), null); + List currentUserAuthorizedChannelUuidList = channelMapper.getAuthorizedChannelUuidList(UserContext.get().getUserUuid(true), authenticationInfoVo.getTeamUuidList(), authenticationInfoVo.getRoleUuidList(), CatalogChannelAuthorityAction.REPORT.getValue(), null); /** 2021-10-11 开晚会时确认用户个人设置任务授权不包括服务上报权限 **/ // if(StringUtils.isNotBlank(agentUuid)){ // AuthenticationInfoVo agentAuthenticationInfoVo = authenticationInfoService.getAuthenticationInfo(agentUuid); diff --git a/src/main/java/neatlogic/module/process/api/channel/ChannelGetApi.java b/src/main/java/neatlogic/module/process/api/channel/ChannelGetApi.java index 3122c595a..e9b73f039 100644 --- a/src/main/java/neatlogic/module/process/api/channel/ChannelGetApi.java +++ b/src/main/java/neatlogic/module/process/api/channel/ChannelGetApi.java @@ -5,6 +5,7 @@ import neatlogic.framework.auth.core.AuthAction; import neatlogic.framework.common.constvalue.ApiParamType; import neatlogic.framework.dto.AuthorityVo; import neatlogic.framework.process.auth.PROCESS_BASE; +import neatlogic.framework.process.constvalue.CatalogChannelAuthorityAction; import neatlogic.module.process.dao.mapper.catalog.ChannelMapper; import neatlogic.framework.process.dto.ChannelPriorityVo; import neatlogic.framework.process.dto.ChannelVo; @@ -18,6 +19,8 @@ import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; @Service @AuthAction(action = PROCESS_BASE.class) @@ -71,7 +74,10 @@ public class ChannelGetApi extends PrivateApiComponentBase { } channel.setPriorityUuidList(priorityUuidList); List authorityVoList = channelMapper.getChannelAuthorityListByChannelUuid(uuid); - channel.setAuthorityVoList(authorityVoList); + List viewAuthorityVoList = authorityVoList.stream().filter(e -> Objects.equals(e.getAction(), CatalogChannelAuthorityAction.VIEW.getValue())).collect(Collectors.toList()); + channel.setViewAuthorityList(AuthorityVo.getAuthorityList(viewAuthorityVoList)); + List reportAuthorityVoList = authorityVoList.stream().filter(e -> Objects.equals(e.getAction(), CatalogChannelAuthorityAction.REPORT.getValue())).collect(Collectors.toList()); + channel.setReportAuthorityList(AuthorityVo.getAuthorityList(reportAuthorityVoList)); if(channelMapper.checkChannelIsFavorite(UserContext.get().getUserUuid(true), uuid) == 0) { channel.setIsFavorite(0); }else { diff --git a/src/main/java/neatlogic/module/process/api/channel/ChannelSaveApi.java b/src/main/java/neatlogic/module/process/api/channel/ChannelSaveApi.java index 51b83b38a..4a27cc3da 100644 --- a/src/main/java/neatlogic/module/process/api/channel/ChannelSaveApi.java +++ b/src/main/java/neatlogic/module/process/api/channel/ChannelSaveApi.java @@ -79,6 +79,7 @@ public class ChannelSaveApi extends PrivateApiComponentBase { @Param(name = "defaultPriorityUuid", type = ApiParamType.STRING, desc = "common.defaultpriorityuuid"), @Param(name = "priorityUuidList", type = ApiParamType.JSONARRAY, desc = "nmrap.updateprioritysortapi.input.param.desc.prioritylist"), @Param(name = "authorityList", type = ApiParamType.JSONARRAY, desc = "common.authoritylist", help = "可多选,格式[\"user#userUuid\",\"team#teamUuid\",\"role#roleUuid\"]"), + @Param(name = "viewAuthorityList", type = ApiParamType.JSONARRAY, desc = "common.viewauthoritylist", help = "可多选,格式[\"user#userUuid\",\"team#teamUuid\",\"role#roleUuid\"]"), @Param(name = "channelTypeUuid", type = ApiParamType.STRING, isRequired = true, desc = "term.itsm.channeltypeuuid"), @Param(name = "config", type = ApiParamType.JSONOBJECT, desc = "common.config") }) @@ -88,7 +89,7 @@ public class ChannelSaveApi extends PrivateApiComponentBase { @Description(desc = "nmpac.channelsaveapi.getname") @Override public Object myDoService(JSONObject jsonObj) throws Exception { - ChannelVo channelVo = JSON.toJavaObject(jsonObj, ChannelVo.class); + ChannelVo channelVo = jsonObj.toJavaObject(ChannelVo.class); return channelService.saveChannel(channelVo); } diff --git a/src/main/java/neatlogic/module/process/api/channel/ChannelSearchApi.java b/src/main/java/neatlogic/module/process/api/channel/ChannelSearchApi.java index 2d53adff1..e4b0d8c83 100755 --- a/src/main/java/neatlogic/module/process/api/channel/ChannelSearchApi.java +++ b/src/main/java/neatlogic/module/process/api/channel/ChannelSearchApi.java @@ -7,6 +7,7 @@ import neatlogic.framework.auth.core.AuthAction; import neatlogic.framework.common.dto.BasePageVo; import neatlogic.framework.dto.AuthenticationInfoVo; import neatlogic.framework.process.auth.PROCESS_BASE; +import neatlogic.framework.process.constvalue.CatalogChannelAuthorityAction; import neatlogic.module.process.dao.mapper.catalog.ChannelTypeMapper; import neatlogic.framework.restful.constvalue.OperationTypeEnum; import neatlogic.framework.restful.annotation.*; @@ -92,7 +93,7 @@ public class ChannelSearchApi extends PrivateApiComponentBase { Integer isAuthenticate = jsonObj.getInteger("isAuthenticate"); if(Objects.equal(isAuthenticate, 1)) { AuthenticationInfoVo authenticationInfoVo = UserContext.get().getAuthenticationInfoVo(); - List authorizedChannelUuidList = channelMapper.getAuthorizedChannelUuidList(UserContext.get().getUserUuid(true), authenticationInfoVo.getTeamUuidList(), authenticationInfoVo.getRoleUuidList(), null); + List authorizedChannelUuidList = channelMapper.getAuthorizedChannelUuidList(UserContext.get().getUserUuid(true), authenticationInfoVo.getTeamUuidList(), authenticationInfoVo.getRoleUuidList(), CatalogChannelAuthorityAction.REPORT.getValue(), null); if(CollectionUtils.isNotEmpty(authorizedChannelUuidList)) { String channelUuid = jsonObj.getString("channelUuid"); if(StringUtils.isNotBlank(channelUuid) && channelMapper.checkChannelIsExists(channelUuid) == 0) { diff --git a/src/main/java/neatlogic/module/process/dao/mapper/catalog/ChannelMapper.java b/src/main/java/neatlogic/module/process/dao/mapper/catalog/ChannelMapper.java index 48281ae04..06563bddd 100644 --- a/src/main/java/neatlogic/module/process/dao/mapper/catalog/ChannelMapper.java +++ b/src/main/java/neatlogic/module/process/dao/mapper/catalog/ChannelMapper.java @@ -66,11 +66,15 @@ public interface ChannelMapper extends IChannelCrossoverMapper { List getChannelAuthorityListByChannelUuid(String uuid); List getAuthorizedChannelUuidList(@Param("userUuid") String userUuid, - @Param("teamUuidList") List teamUuidList, @Param("roleUuidList") List roleUuidList, - @Param("channelUuid") String channelUuid); + @Param("teamUuidList") List teamUuidList, + @Param("roleUuidList") List roleUuidList, + @Param("action") String action, + @Param("channelUuid") String channelUuid); List getActiveAuthorizedChannelUuidList(@Param("userUuid") String userUuid, - @Param("teamUuidList") List teamUuidList, @Param("roleUuidList") List roleUuidList, + @Param("teamUuidList") List teamUuidList, + @Param("roleUuidList") List roleUuidList, + @Param("action") String action, @Param("channelUuid") String channelUuid); List getAuthorizedChannelListByParentUuid(@Param("userUuid") String userUuid, diff --git a/src/main/java/neatlogic/module/process/dao/mapper/catalog/ChannelMapper.xml b/src/main/java/neatlogic/module/process/dao/mapper/catalog/ChannelMapper.xml index 031964def..ea5e6a061 100644 --- a/src/main/java/neatlogic/module/process/dao/mapper/catalog/ChannelMapper.xml +++ b/src/main/java/neatlogic/module/process/dao/mapper/catalog/ChannelMapper.xml @@ -391,7 +391,8 @@ resultType="neatlogic.framework.dto.AuthorityVo" useCache="false"> SELECT `channel_uuid` AS channelUuid, `type`, - `uuid` + `uuid`, + `action` FROM `channel_authority` WHERE `channel_uuid` = #{channelUuid} @@ -402,8 +403,12 @@ FROM `channel_authority` - `channel_uuid` = #{channelUuid} AND ( + AND `channel_uuid` = #{channelUuid} + + + AND `action` = #{action} + AND ( (type = 'common' AND `uuid` = 'alluser') OR (type = 'user' AND `uuid` = #{userUuid}) @@ -422,9 +427,7 @@ ) - - ) - + ) @@ -432,11 +435,15 @@ SELECT DISTINCT a.`channel_uuid` FROM `channel_authority` a - JOIN `channel` b ON b.`uuid` = a.`channel_uuid` AND b.`is_active` = 1 + JOIN `channel` b ON b.`uuid` = a.`channel_uuid`AND b.`is_active` = 1 - a.`channel_uuid` = #{channelUuid} AND ( + AND a.`channel_uuid` = #{channelUuid} + + AND a.`action` = #{action} + + AND ( (type = 'common' AND a.`uuid` = 'alluser') OR (type = 'user' AND a.`uuid` = #{userUuid}) @@ -455,9 +462,7 @@ ) - - ) - + ) @@ -481,6 +486,7 @@ LEFT JOIN `channel_user` cu ON cu.`channel_uuid` = c.`uuid` c.`is_active` =1 + and ca.`action` = 'report' and ((ca.type = 'common' AND ca.`uuid` = 'alluser') @@ -726,10 +732,12 @@ INSERT INTO `channel_authority` (`channel_uuid`, `type`, - `uuid`) + `uuid`, + `action`) VALUES (#{channelUuid}, #{authorityVo.type}, - #{authorityVo.uuid}) + #{authorityVo.uuid}, + #{authorityVo.action}) diff --git a/src/main/java/neatlogic/module/process/service/CatalogServiceImpl.java b/src/main/java/neatlogic/module/process/service/CatalogServiceImpl.java index f48f20a55..5ba0a66d4 100644 --- a/src/main/java/neatlogic/module/process/service/CatalogServiceImpl.java +++ b/src/main/java/neatlogic/module/process/service/CatalogServiceImpl.java @@ -67,7 +67,7 @@ public class CatalogServiceImpl implements CatalogService, ICatalogCrossoverServ List currentUserAuthorizedCatalogUuidList = catalogMapper.getAuthorizedCatalogUuidList(UserContext.get().getUserUuid(true), authenticationInfoVo.getTeamUuidList(), authenticationInfoVo.getRoleUuidList(), CatalogChannelAuthorityAction.REPORT.getValue(), null); if (CollectionUtils.isNotEmpty(currentUserAuthorizedCatalogUuidList)) { /* 查出当前用户所有已授权的服务uuid集合 **/ - List currentUserAuthorizedChannelUuidList = channelMapper.getAuthorizedChannelUuidList(UserContext.get().getUserUuid(true), authenticationInfoVo.getTeamUuidList(), authenticationInfoVo.getRoleUuidList(), null); + List currentUserAuthorizedChannelUuidList = channelMapper.getAuthorizedChannelUuidList(UserContext.get().getUserUuid(true), authenticationInfoVo.getTeamUuidList(), authenticationInfoVo.getRoleUuidList(), CatalogChannelAuthorityAction.REPORT.getValue(), null); if (CollectionUtils.isNotEmpty(currentUserAuthorizedChannelUuidList)) { Map uuidKeyMap = new HashMap<>(); //构造一个虚拟的root节点 @@ -114,9 +114,18 @@ public class CatalogServiceImpl implements CatalogService, ICatalogCrossoverServ @Override public boolean channelIsAuthority(String channelUuid, String userUuid, CatalogChannelAuthorityAction action) { + Integer isActive = null; + if (action == CatalogChannelAuthorityAction.REPORT) { + isActive = 1; + } AuthenticationInfoVo authenticationInfoVo = authenticationInfoService.getAuthenticationInfo(userUuid); /* 查出当前用户所有已授权的服务uuid集合 **/ - List channelUuidList = channelMapper.getActiveAuthorizedChannelUuidList(userUuid, authenticationInfoVo.getTeamUuidList(), authenticationInfoVo.getRoleUuidList(), channelUuid); + List channelUuidList = null; + if (action == CatalogChannelAuthorityAction.REPORT) { + channelUuidList = channelMapper.getActiveAuthorizedChannelUuidList(userUuid, authenticationInfoVo.getTeamUuidList(), authenticationInfoVo.getRoleUuidList(), action.getValue(), channelUuid); + } else { + channelUuidList = channelMapper.getAuthorizedChannelUuidList(userUuid, authenticationInfoVo.getTeamUuidList(), authenticationInfoVo.getRoleUuidList(), action.getValue(), channelUuid); + } /* 服务已授权 **/ if (channelUuidList.contains(channelUuid)) { ChannelVo channel = channelMapper.getChannelByUuid(channelUuid); @@ -127,10 +136,6 @@ public class CatalogServiceImpl implements CatalogService, ICatalogCrossoverServ if (catalogVo == null) { return false; } - Integer isActive = null; - if (action == CatalogChannelAuthorityAction.REPORT) { - isActive = 1; - } List catalogUuidList = new ArrayList<>(); List ancestorsAndSelfList = catalogMapper.getAncestorsAndSelfByLftRht(catalogVo.getLft(), catalogVo.getRht()); for (CatalogVo catalog : ancestorsAndSelfList) { @@ -154,7 +159,7 @@ public class CatalogServiceImpl implements CatalogService, ICatalogCrossoverServ List cataLogVoList = new ArrayList<>(); AuthenticationInfoVo authenticationInfoVo = UserContext.get().getAuthenticationInfoVo(); //已授权的服务uuid - List currentUserAuthorizedChannelUuidList = channelMapper.getAuthorizedChannelUuidList(UserContext.get().getUserUuid(true), authenticationInfoVo.getTeamUuidList(), authenticationInfoVo.getRoleUuidList(), null); + List currentUserAuthorizedChannelUuidList = channelMapper.getAuthorizedChannelUuidList(UserContext.get().getUserUuid(true), authenticationInfoVo.getTeamUuidList(), authenticationInfoVo.getRoleUuidList(), CatalogChannelAuthorityAction.REPORT.getValue(), null); if (CollectionUtils.isEmpty(currentUserAuthorizedChannelUuidList)) { return cataLogVoList; } @@ -193,7 +198,7 @@ public class CatalogServiceImpl implements CatalogService, ICatalogCrossoverServ JSONObject catalogParentJson = new JSONObject(); AuthenticationInfoVo authenticationInfoVo = UserContext.get().getAuthenticationInfoVo(); //已授权的服务uuid - List currentUserAuthorizedChannelUuidList = channelMapper.getAuthorizedChannelUuidList(UserContext.get().getUserUuid(true), authenticationInfoVo.getTeamUuidList(), authenticationInfoVo.getRoleUuidList(), null); + List currentUserAuthorizedChannelUuidList = channelMapper.getAuthorizedChannelUuidList(UserContext.get().getUserUuid(true), authenticationInfoVo.getTeamUuidList(), authenticationInfoVo.getRoleUuidList(), CatalogChannelAuthorityAction.REPORT.getValue(), null); if (CollectionUtils.isEmpty(currentUserAuthorizedChannelUuidList)) { return catalogParentJson; } diff --git a/src/main/java/neatlogic/module/process/service/ChannelServiceImpl.java b/src/main/java/neatlogic/module/process/service/ChannelServiceImpl.java index f7ad7816d..56cede69a 100644 --- a/src/main/java/neatlogic/module/process/service/ChannelServiceImpl.java +++ b/src/main/java/neatlogic/module/process/service/ChannelServiceImpl.java @@ -21,6 +21,7 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import neatlogic.framework.crossover.CrossoverServiceFactory; import neatlogic.framework.dto.AuthorityVo; +import neatlogic.framework.process.constvalue.CatalogChannelAuthorityAction; import neatlogic.framework.process.crossover.IProcessCrossoverMapper; import neatlogic.framework.process.dto.CatalogVo; import neatlogic.framework.process.dto.ChannelPriorityVo; @@ -117,12 +118,22 @@ public class ChannelServiceImpl implements ChannelService { channelMapper.insertChannelPriority(channelPriority); } } - List authorityList = channelVo.getAuthorityVoList(); - if (CollectionUtils.isNotEmpty(authorityList)) { - for (AuthorityVo authorityVo : authorityList) { + + List reportAuthorityList = channelVo.getReportAuthorityList(); + if (CollectionUtils.isNotEmpty(reportAuthorityList)) { + List authorityVoList = AuthorityVo.getAuthorityVoList(reportAuthorityList, CatalogChannelAuthorityAction.REPORT.getValue()); + for(AuthorityVo authorityVo : authorityVoList) { channelMapper.insertChannelAuthority(authorityVo, channelVo.getUuid()); } } + List viewAuthorityList = channelVo.getViewAuthorityList(); + if (CollectionUtils.isNotEmpty(viewAuthorityList)) { + List viewAuthorityVoList = AuthorityVo.getAuthorityVoList(viewAuthorityList, CatalogChannelAuthorityAction.VIEW.getValue()); + for(AuthorityVo authorityVo : viewAuthorityVoList) { + channelMapper.insertChannelAuthority(authorityVo, channelVo.getUuid()); + } + } + /* 转报设置逻辑,允许转报后,转报设置必填 **/ channelMapper.deleteChannelRelationBySource(channelVo.getUuid()); channelMapper.deleteChannelRelationAuthorityBySource(channelVo.getUuid()); diff --git a/src/main/resources/neatlogic/resources/process/changelog/2024-07-19/neatlogic_tenant.sql b/src/main/resources/neatlogic/resources/process/changelog/2024-07-19/neatlogic_tenant.sql new file mode 100644 index 000000000..8ead1d6c0 --- /dev/null +++ b/src/main/resources/neatlogic/resources/process/changelog/2024-07-19/neatlogic_tenant.sql @@ -0,0 +1,4 @@ +ALTER TABLE `channel_authority` + ADD COLUMN `action` ENUM('report','view') NOT NULL COMMENT '授权类型' AFTER `uuid`, + DROP PRIMARY KEY, + ADD PRIMARY KEY (`channel_uuid`, `type`, `uuid`, `action`); \ No newline at end of file diff --git a/src/main/resources/neatlogic/resources/process/changelog/2024-07-19/version.json b/src/main/resources/neatlogic/resources/process/changelog/2024-07-19/version.json new file mode 100644 index 000000000..4f1a59f35 --- /dev/null +++ b/src/main/resources/neatlogic/resources/process/changelog/2024-07-19/version.json @@ -0,0 +1,10 @@ +{ + "content":[ + { + "type":"新增功能", + "detail":[ + {"msg":"1.工单查看权限-服务通道"} + ] + } + ] +} diff --git a/src/main/resources/neatlogic/resources/process/sqlscript/ddl.sql b/src/main/resources/neatlogic/resources/process/sqlscript/ddl.sql index d045a8c12..412ea1903 100644 --- a/src/main/resources/neatlogic/resources/process/sqlscript/ddl.sql +++ b/src/main/resources/neatlogic/resources/process/sqlscript/ddl.sql @@ -58,7 +58,8 @@ CREATE TABLE IF NOT EXISTS `channel_authority` ( `channel_uuid` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '服务uuid', `type` enum('common','user','team','role') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '类型', `uuid` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'uuid', - PRIMARY KEY (`channel_uuid`, `type`, `uuid`) USING BTREE, + `action` enum('report','view') COLLATE utf8mb4_general_ci NOT NULL COMMENT '授权类型', + PRIMARY KEY (`channel_uuid`, `type`, `uuid`, `action`) USING BTREE, INDEX `idx_channel_uuid`(`channel_uuid`) USING BTREE, INDEX `idx_uuid`(`uuid`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '服务授权表'; -- Gitee From 90a61a22e17ad9e0ba77b1912970cd483da17032 Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Fri, 19 Jul 2024 14:56:26 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E5=90=8E=E7=AB=AF-?= =?UTF-8?q?=E5=B7=A5=E5=8D=95=E6=9F=A5=E7=9C=8B=E6=9D=83=E9=99=90-?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E9=80=9A=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1204167459176448]后端-工单查看权限-服务通道 http://192.168.0.96:8090/demo/rdm.html#/task-detail/939050947543040/939050947543050/1204167459176448 --- .../neatlogic/module/process/api/channel/ChannelSaveApi.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/neatlogic/module/process/api/channel/ChannelSaveApi.java b/src/main/java/neatlogic/module/process/api/channel/ChannelSaveApi.java index 4a27cc3da..cb3e46fa8 100644 --- a/src/main/java/neatlogic/module/process/api/channel/ChannelSaveApi.java +++ b/src/main/java/neatlogic/module/process/api/channel/ChannelSaveApi.java @@ -78,7 +78,7 @@ public class ChannelSaveApi extends PrivateApiComponentBase { @Param(name = "isNeedPriority", type = ApiParamType.INTEGER, isRequired = true, desc = "common.isneedpriority"), @Param(name = "defaultPriorityUuid", type = ApiParamType.STRING, desc = "common.defaultpriorityuuid"), @Param(name = "priorityUuidList", type = ApiParamType.JSONARRAY, desc = "nmrap.updateprioritysortapi.input.param.desc.prioritylist"), - @Param(name = "authorityList", type = ApiParamType.JSONARRAY, desc = "common.authoritylist", help = "可多选,格式[\"user#userUuid\",\"team#teamUuid\",\"role#roleUuid\"]"), + @Param(name = "reportAuthorityList", type = ApiParamType.JSONARRAY, desc = "common.reportauthoritylist", help = "可多选,格式[\"user#userUuid\",\"team#teamUuid\",\"role#roleUuid\"]"), @Param(name = "viewAuthorityList", type = ApiParamType.JSONARRAY, desc = "common.viewauthoritylist", help = "可多选,格式[\"user#userUuid\",\"team#teamUuid\",\"role#roleUuid\"]"), @Param(name = "channelTypeUuid", type = ApiParamType.STRING, isRequired = true, desc = "term.itsm.channeltypeuuid"), @Param(name = "config", type = ApiParamType.JSONOBJECT, desc = "common.config") -- Gitee