feat:(REQ-3282) 实现查询用户权限的接口

This commit is contained in:
李龙 2024-12-18 14:19:28 +08:00
parent 40aab97560
commit bbc702dcd4
19 changed files with 1388 additions and 150 deletions

View File

@ -201,6 +201,8 @@ public class ListRoleUserRelationParam {
private Long ouId; private Long ouId;
private Long personId; private Long personId;
private Long resourceId;
} }
} }

View File

@ -3,6 +3,10 @@ package cn.axzo.tyr.feign.enums;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;
/** /**
* 人员身份类型枚举 * 人员身份类型枚举
* *
@ -24,4 +28,14 @@ public enum IdentityTypeEnum {
private final Integer code; private final Integer code;
private final String message; private final String message;
private final String desc; private final String desc;
public static Optional<IdentityTypeEnum> fromCode(Integer code) {
if (Objects.isNull(code)) {
return Optional.empty();
}
return Arrays.stream(IdentityTypeEnum.values())
.filter(e -> Objects.equals(e.getCode(), code))
.findFirst();
}
} }

View File

@ -2,6 +2,11 @@ package cn.axzo.tyr.feign.enums;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;
/** /**
* @author tanjie@axzo.cn * @author tanjie@axzo.cn
@ -21,4 +26,13 @@ public enum RoleTypeEnum {
private final String value; private final String value;
private final String desc; private final String desc;
private final boolean isAdmin; private final boolean isAdmin;
public static Optional<RoleTypeEnum> fromValue(String value) {
if (StringUtils.isBlank(value)) {
return Optional.empty();
}
return Arrays.stream(RoleTypeEnum.values())
.filter(e -> Objects.equals(e.getValue(), value))
.findFirst();
}
} }

View File

@ -7,7 +7,9 @@ import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -18,20 +20,11 @@ import java.util.Set;
public class ListUserPermissionReq { public class ListUserPermissionReq {
/** /**
* 人员id * 不能给太多性能会有问题一般控制在5个以内合适
* 根据personId查询权限或者根据identityIdidentityType查询权限不能同时都为空
*/ */
private Long personId; @Valid
@NotEmpty(message = "userPermissions不能为空")
/** private List<UserPermission> userPermissions;
* 身份id
*/
private Long identityId;
/**
* 身份类型
*/
private IdentityTypeEnum identityType;
/** /**
* 权限code * 权限code
@ -44,12 +37,6 @@ public class ListUserPermissionReq {
*/ */
private String terminal; private String terminal;
/**
* 项目信息
*/
@NotEmpty(message = "workspaceOuPairs不能为空")
private List<WorkspaceOuPair> workspaceOuPairs;
/** /**
* app类型APP:原生H5:h5页面 * app类型APP:原生H5:h5页面
*/ */
@ -65,21 +52,52 @@ public class ListUserPermissionReq {
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public static class WorkspaceOuPair { public static class UserPermission {
/**
* 人员id
* 根据personId查询权限或者根据identityIdidentityType查询权限不能同时都为空
*/
private Long personId;
/**
* 身份id
*/
private Long identityId;
/**
* 身份类型
*/
private IdentityTypeEnum identityType;
/** /**
* 租户id * 租户id
*/ */
@NotNull(message = "workspaceId不能为空")
private Long workspaceId; private Long workspaceId;
/** /**
* 单位id * 单位id
*/ */
@NotNull(message = "ouId不能为空")
private Long ouId; private Long ouId;
/**
* 人岗架部门id
*/
private Long nodeId;
/** /**
* 根据权限标签去过滤角色对应的权限 * 根据权限标签去过滤角色对应的权限
* 如果没有指定值则会根据用户在当前workspaceId和ouId在人岗架的状态来解析 * 如果没有指定值则会根据用户在当前workspaceId和ouId在人岗架的状态来解析
*/ */
private Set<RolePermissionTagEnum> permissionTags; private Set<RolePermissionTagEnum> permissionTags;
public String buildPersonKey() {
return this.getPersonId() + "_" + this.getWorkspaceId() + "_" + this.getOuId();
}
public String buildIdentityKey() {
return this.getIdentityId() + "_" + this.getIdentityType().getCode() + "_" + this.getWorkspaceId() + "_" + this.getOuId();
}
} }
} }

View File

@ -25,9 +25,7 @@ public class PermissionResp {
private String featureCode; private String featureCode;
/** /**
* 新旧权限 * 权限点的类型
* 0表示id是saas_feature的id
* 1表示id是saas_feature_resource的id
*/ */
private Integer featureType; private Integer featureType;
@ -35,9 +33,4 @@ public class PermissionResp {
* 端信息 * 端信息
*/ */
private String terminal; private String terminal;
/**
* 权限的标签
*/
private Set<RolePermissionTagEnum> tags;
} }

View File

@ -13,7 +13,6 @@ import java.util.List;
@AllArgsConstructor @AllArgsConstructor
public class UserPermissionResp { public class UserPermissionResp {
/** /**
* 人员id * 人员id
*/ */
@ -30,25 +29,24 @@ public class UserPermissionResp {
private String identityType; private String identityType;
/** /**
* 用户在项目的权限 * 项目id
*/ */
private List<WorkspacePermission> workspacePermissions; private Long workspaceId;
@Data /**
@Builder * 单位id
@AllArgsConstructor */
@NoArgsConstructor private Long ouId;
public static class WorkspacePermission {
private Long workspaceId; /**
* 部门id
*/
private Long nodeId;
private Long ouId; /**
* 是否是超管
*/
private Boolean isSuperAdmin;
/** private List<PermissionResp> permissions;
* 是否是超管
*/
private Boolean isSuperAdmin;
private List<PermissionResp> permissions;
}
} }

View File

@ -2,23 +2,32 @@ package cn.axzo.tyr.server.controller.v2;
import cn.axzo.foundation.exception.Axssert; import cn.axzo.foundation.exception.Axssert;
import cn.axzo.foundation.result.ApiResult; import cn.axzo.foundation.result.ApiResult;
import cn.axzo.tyr.client.model.enums.IdentityType;
import cn.axzo.tyr.client.model.roleuser.dto.SaasRoleUserV2DTO; import cn.axzo.tyr.client.model.roleuser.dto.SaasRoleUserV2DTO;
import cn.axzo.tyr.client.model.roleuser.req.ListRoleUserRelationParam; import cn.axzo.tyr.client.model.roleuser.req.ListRoleUserRelationParam;
import cn.axzo.tyr.feign.api.UserPermissionApi; import cn.axzo.tyr.feign.api.UserPermissionApi;
import cn.axzo.tyr.feign.enums.IdentityTypeEnum;
import cn.axzo.tyr.feign.enums.RolePermissionTagEnum;
import cn.axzo.tyr.feign.enums.RoleTypeEnum;
import cn.axzo.tyr.feign.req.ListPermissionUserReq; import cn.axzo.tyr.feign.req.ListPermissionUserReq;
import cn.axzo.tyr.feign.req.ListUserPermissionReq; import cn.axzo.tyr.feign.req.ListUserPermissionReq;
import cn.axzo.tyr.feign.resp.PermissionUserResp; import cn.axzo.tyr.feign.resp.PermissionUserResp;
import cn.axzo.tyr.feign.resp.UserPermissionResp; import cn.axzo.tyr.feign.resp.UserPermissionResp;
import cn.axzo.tyr.server.service.PermissionService; import cn.axzo.tyr.server.service.PermissionService;
import cn.axzo.tyr.server.service.PermissionTagService;
import cn.axzo.tyr.server.service.SaasRoleUserRelationService; import cn.axzo.tyr.server.service.SaasRoleUserRelationService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static cn.axzo.tyr.server.config.exception.BizResultCode.PARAM_ERROR; import static cn.axzo.tyr.server.config.exception.BizResultCode.PARAM_ERROR;
@ -31,6 +40,8 @@ public class UserPermissionController implements UserPermissionApi {
private PermissionService permissionService; private PermissionService permissionService;
@Autowired @Autowired
private SaasRoleUserRelationService saasRoleUserRelationService; private SaasRoleUserRelationService saasRoleUserRelationService;
@Autowired
private PermissionTagService permissionTagService;
@Override @Override
public ApiResult<List<UserPermissionResp>> listUserPermission(ListUserPermissionReq req) { public ApiResult<List<UserPermissionResp>> listUserPermission(ListUserPermissionReq req) {
@ -39,8 +50,24 @@ public class UserPermissionController implements UserPermissionApi {
List<SaasRoleUserV2DTO> saasRoleUsers = listRoleUserRelation(req); List<SaasRoleUserV2DTO> saasRoleUsers = listRoleUserRelation(req);
if (CollectionUtils.isEmpty(saasRoleUsers)) {
return ApiResult.success();
}
return null; assembleTag(req);
// 按照最细的维度进行用户的权限解析这样才能组装成其他维度的数据
List<PermissionService.UserParam> userParams = resolveUserParam(saasRoleUsers, req);
List<UserPermissionResp> userPermissionResps = permissionService.listUserPermission(PermissionService.ListUserPermissionParam.builder()
.featureCodes(req.getFeatureCodes())
.terminal(req.getTerminal())
.appType(req.getAppType())
.itemCode(req.getItemCode())
.users(userParams)
.build());
return ApiResult.success(userPermissionResps);
} }
@Override @Override
@ -50,29 +77,38 @@ public class UserPermissionController implements UserPermissionApi {
private void check(ListUserPermissionReq req) { private void check(ListUserPermissionReq req) {
Axssert.check(Objects.nonNull(req.getPersonId()) || Objects.nonNull(req.getIdentityId()), req.getUserPermissions().forEach(user -> {
PARAM_ERROR, PARAM_ERROR.getErrorMessage(), "personId 和 identityId不能同时为空"); if (Objects.nonNull(user.getPersonId()) && (Objects.nonNull(user.getIdentityId()) || Objects.nonNull(user.getIdentityType()))) {
throw PARAM_ERROR.toException(PARAM_ERROR.getErrorMessage(), "personId 和 identityId只能二选一");
}
if (Objects.nonNull(req.getIdentityId())) { Axssert.check(Objects.nonNull(user.getPersonId()) || Objects.nonNull(user.getIdentityId()),
Axssert.check(Objects.nonNull(req.getIdentityType()), PARAM_ERROR, PARAM_ERROR.getErrorMessage(), "personId 和 identityId不能同时为空");
PARAM_ERROR, PARAM_ERROR.getErrorMessage(), "identityType不能为空");
} if (Objects.nonNull(user.getIdentityId())) {
Axssert.check(Objects.nonNull(user.getIdentityType()),
PARAM_ERROR, PARAM_ERROR.getErrorMessage(), "identityType不能为空");
}
});
} }
private List<SaasRoleUserV2DTO> listRoleUserRelation(ListUserPermissionReq req) { private List<SaasRoleUserV2DTO> listRoleUserRelation(ListUserPermissionReq req) {
List<ListRoleUserRelationParam.BatchPerson> batchPersons = req.getUserPermissions().stream()
.map(user -> ListRoleUserRelationParam.BatchPerson.builder()
.personId(user.getPersonId())
.identityId(user.getIdentityId())
.identityType(Optional.ofNullable(user.getIdentityType())
.map(IdentityTypeEnum::getCode)
.orElse(null))
.workspaceId(user.getWorkspaceId())
.ouId(user.getOuId())
.resourceId(user.getNodeId())
.build())
.collect(Collectors.toList());
ListRoleUserRelationParam listRoleUserRelationParam = ListRoleUserRelationParam.builder() ListRoleUserRelationParam listRoleUserRelationParam = ListRoleUserRelationParam.builder()
.personId(req.getPersonId()) .batchPersons(batchPersons)
.identityId(req.getIdentityId())
.identityType(Optional.ofNullable(req.getIdentityType())
.map(e -> IdentityType.valueOf(e.name()))
.orElse(null))
.workspaceOuPairs(req.getWorkspaceOuPairs().stream()
.map(e -> ListRoleUserRelationParam.WorkspaceOuPair.builder()
.workspaceId(e.getWorkspaceId())
.ouId(e.getOuId())
.build())
.collect(Collectors.toList()))
.needRole(true) .needRole(true)
.build(); .build();
@ -80,4 +116,102 @@ public class UserPermissionController implements UserPermissionApi {
.filter(e -> e.getSaasRole() != null) .filter(e -> e.getSaasRole() != null)
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
private Set<PermissionService.RoleParam> resolveRoles(Map<String, List<SaasRoleUserV2DTO>> personIdRoleUserMap,
Map<String, List<SaasRoleUserV2DTO>> identityIdRoleUserMap,
ListUserPermissionReq.UserPermission userPermission) {
List<SaasRoleUserV2DTO> roleUsers = Lists.newArrayList();
if (Objects.nonNull(userPermission.getPersonId())) {
roleUsers = personIdRoleUserMap.get(userPermission.buildPersonKey());
}
if (Objects.nonNull(userPermission.getIdentityId()) && Objects.nonNull(userPermission.getIdentityType())) {
roleUsers = identityIdRoleUserMap.get(userPermission.buildIdentityKey());
}
if (CollectionUtils.isEmpty(roleUsers)) {
return Collections.emptySet();
}
return roleUsers.stream()
.filter(e -> {
if (Objects.isNull(userPermission.getNodeId())) {
return true;
}
return Objects.equals(userPermission.getNodeId(), e.getResourceId());
})
.map(e ->
PermissionService.RoleParam.builder()
.roleId(e.getRoleId())
.roleType(RoleTypeEnum.fromValue(e.getSaasRole().getRoleType()).orElse(null))
.cooperateShipTypes(e.getSaasRole().getProductUnitType())
.build())
.collect(Collectors.toSet());
}
private List<PermissionService.UserParam> resolveUserParam(List<SaasRoleUserV2DTO> saasRoleUsers,
ListUserPermissionReq req) {
// 因为入参可能是根据personId来查询也可能根据identityId和identityType来查询这里就需要组装多个map方便解析用户的role信息
Map<String, List<SaasRoleUserV2DTO>> personIdRoleUserMap = saasRoleUsers.stream()
.collect(Collectors.groupingBy(e -> e.getSaasRoleUser().getPersonId() + "_" + e.getWorkspaceId() + "_" + e.getOuId()));
Map<String, List<SaasRoleUserV2DTO>> identityIdRoleUserMap = saasRoleUsers.stream()
.collect(Collectors.groupingBy(e -> e.getIdentityId() + "_" + e.getIdentityType() + "_" + e.getWorkspaceId() + "_" + e.getOuId()));
return req.getUserPermissions().stream()
.map(user ->
PermissionService.UserParam.builder()
.identityId(user.getIdentityId())
.identityType(Optional.ofNullable(user.getIdentityType())
.map(IdentityTypeEnum::getCode)
.orElse(null))
.personId(user.getPersonId())
.workspaceId(user.getWorkspaceId())
.ouId(user.getOuId())
.nodeId(user.getNodeId())
.roles(resolveRoles(personIdRoleUserMap, identityIdRoleUserMap, user))
.tags(user.getPermissionTags())
.build())
.collect(Collectors.toList());
}
private void assembleTag(ListUserPermissionReq req) {
List<ListUserPermissionReq.UserPermission> needResolveTags = req.getUserPermissions().stream()
.filter(e -> CollectionUtils.isEmpty(e.getPermissionTags()))
.collect(Collectors.toList());
if (CollectionUtils.isEmpty(needResolveTags)) {
return;
}
PermissionTagService.ResolvePermissionTagParam resolvePermissionTagParam = PermissionTagService.ResolvePermissionTagParam.builder()
.personPermissions(needResolveTags.stream()
.map(e -> PermissionTagService.PersonPermission.builder()
.workspaceId(e.getWorkspaceId())
.ouId(e.getOuId())
.personId(e.getPersonId())
.build())
.collect(Collectors.toList()))
.build();
Map<String, PermissionTagService.ResolvePermissionDTO> resolvePermissions = permissionTagService.resolvePermissionTag(resolvePermissionTagParam).stream()
.collect(Collectors.toMap(e -> e.getPersonId() + "_" + e.getOuId() + "_" + e.getWorkspaceId(), Function.identity()));
req.getUserPermissions().forEach(e -> {
if (!CollectionUtils.isEmpty(e.getPermissionTags())) {
return;
}
PermissionTagService.ResolvePermissionDTO resolvePermissionDTO = resolvePermissions.get(e.getPersonId() + "_" + e.getOuId() + "_" + e.getWorkspaceId());
if (Objects.isNull(resolvePermissionDTO)) {
return;
}
e.setPermissionTags(resolvePermissionDTO.getTags().stream()
.map(tag -> RolePermissionTagEnum.valueOf(tag.name()))
.collect(Collectors.toSet()));
});
}
} }

View File

@ -14,7 +14,7 @@ import java.util.Set;
public interface PermissionService { public interface PermissionService {
Map<Long, List<UserPermissionResp>> listUserPermission(ListUserPermissionParam param); List<UserPermissionResp> listUserPermission(ListUserPermissionParam param);
@Data @Data
@Builder @Builder
@ -51,6 +51,11 @@ public interface PermissionService {
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
class UserParam { class UserParam {
private Long identityId;
private Integer identityType;
private Long personId; private Long personId;
private Set<RolePermissionTagEnum> tags; private Set<RolePermissionTagEnum> tags;
@ -58,6 +63,10 @@ public interface PermissionService {
private Set<RoleParam> roles; private Set<RoleParam> roles;
private Long workspaceId; private Long workspaceId;
private Long ouId;
private Long nodeId;
} }
@Data @Data

View File

@ -1,7 +1,8 @@
package cn.axzo.tyr.server.service.impl; package cn.axzo.tyr.server.service.impl;
import cn.axzo.tyr.client.model.res.IdentityAuthRes; import cn.axzo.tyr.feign.enums.IdentityTypeEnum;
import cn.axzo.tyr.feign.enums.RolePermissionTagEnum; import cn.axzo.tyr.feign.enums.RolePermissionTagEnum;
import cn.axzo.tyr.feign.enums.RoleTypeEnum;
import cn.axzo.tyr.feign.resp.PermissionResp; import cn.axzo.tyr.feign.resp.PermissionResp;
import cn.axzo.tyr.feign.resp.UserPermissionResp; import cn.axzo.tyr.feign.resp.UserPermissionResp;
import cn.axzo.tyr.server.service.PermissionService; import cn.axzo.tyr.server.service.PermissionService;
@ -51,28 +52,31 @@ public class PermissionServiceImpl implements PermissionService {
* *
*/ */
@Override @Override
public Map<Long, List<UserPermissionResp>> listUserPermission(ListUserPermissionParam param) { public List<UserPermissionResp> listUserPermission(ListUserPermissionParam param) {
if (CollectionUtils.isEmpty(param.getUsers())) { if (CollectionUtils.isEmpty(param.getUsers())) {
return Collections.emptyMap(); return Collections.emptyList();
} }
// 查询项目的权限 // 查询项目的权限
Map<Long, List<ProductPermissionCacheService.PermissionDTO>> workspacePermissionMap = listWorkspacePermission(param); Map<Long, List<ProductPermissionCacheService.PermissionDTO>> workspacePermissionMap = listWorkspacePermission(param);
if (Objects.isNull(workspacePermissionMap) || workspacePermissionMap.isEmpty()) { if (Objects.isNull(workspacePermissionMap) || workspacePermissionMap.isEmpty()) {
return Collections.emptyMap(); return Collections.emptyList();
} }
// 查询产品的端的所有菜单信息 // 查询产品的端的所有菜单信息
List<SaasFeatureResourceService.SaasFeatureResourceCache> allFeatureResources = listAllSaasFeature(workspacePermissionMap); List<SaasFeatureResourceService.SaasFeatureResourceCache> allFeatureResources = listAllSaasFeature(workspacePermissionMap);
if (CollectionUtils.isEmpty(allFeatureResources)) { if (CollectionUtils.isEmpty(allFeatureResources)) {
return Collections.emptyMap(); return Collections.emptyList();
} }
Set<Long> effectFeatureIds = allFeatureResources.stream()
.map(SaasFeatureResourceService.SaasFeatureResourceCache::getFeatureId)
.collect(Collectors.toSet());
// 查询角色的权限 // 查询角色的权限
Map<Long, List<RolePermissionCacheService.PermissionDTO>> rolePermissions = listRolePermission(param); Map<Long, List<RolePermissionCacheService.PermissionDTO>> rolePermissions = listRolePermission(param);
// 按照人去解析每个人的权限因为每个人的tag可能不一样 // 按照人去解析每个人的权限因为每个人的tag可能不一样
param.getUsers().stream() return param.getUsers().stream()
.map(user -> { .map(user -> {
if (CollectionUtils.isEmpty(user.getRoles())) { if (CollectionUtils.isEmpty(user.getRoles())) {
return null; return null;
@ -83,18 +87,44 @@ public class PermissionServiceImpl implements PermissionService {
return null; return null;
} }
// 用户在场时的管理员角色的权限 // 匹配用户在场时的管理员角色的权限管理员角色的权限是对应的项目的权限
Set<PermissionResp> adminRolePermission = resolveAdminRolePermission(workspacePermissions, user); Set<PermissionResp> adminRolePermissions = resolveAdminRolePermission(workspacePermissions, user);
// 用户普通角色的权限 // 匹配普通角色的权限需要根据角色配置的权限和项目的权限去匹配(单位类型tag等信息)
return null; Set<PermissionResp> normalRolePermissionPoints = resolveNormalRolePermission(workspacePermissions, user, rolePermissions);
Set<PermissionResp> notAuthPermissionPoints = resolveNotAuthPermission(workspacePermissions, allFeatureResources);
//组装返回值
//是否超管
boolean isSuperAdmin = user.getRoles().stream()
.anyMatch(f -> Objects.equals(RoleTypeEnum.SUPER_ADMIN, f.getRoleType()));
UserPermissionResp result = UserPermissionResp.builder()
.identityId(user.getIdentityId())
.identityType(IdentityTypeEnum.fromCode(user.getIdentityType())
.map(IdentityTypeEnum::name)
.orElse(null))
.personId(user.getPersonId())
.ouId(user.getOuId())
.workspaceId(user.getWorkspaceId())
.nodeId(user.getNodeId())
.isSuperAdmin(isSuperAdmin)
.build();
Set<PermissionResp> allPermissionPoints = Sets.newHashSet();
allPermissionPoints.addAll(adminRolePermissions);
allPermissionPoints.addAll(normalRolePermissionPoints);
allPermissionPoints.addAll(notAuthPermissionPoints);
result.setPermissions(allPermissionPoints.stream()
.filter(e -> effectFeatureIds.contains(e.getFeatureId()))
.collect(Collectors.toList()));
return result;
}) })
.filter(Objects::nonNull) .filter(Objects::nonNull)
.collect(Collectors.toList()); .collect(Collectors.toList());
return null;
} }
/** /**
@ -138,29 +168,31 @@ public class PermissionServiceImpl implements PermissionService {
} }
private Set<IdentityAuthRes.PermissionPoint> buildNoAuthPermission(List<ProductPermissionCacheService.PermissionDTO> productPermissions, private Set<PermissionResp> resolveNotAuthPermission(List<ProductPermissionCacheService.PermissionDTO> productPermissions,
List<SaasFeatureResourceService.SaasFeatureResourceCache> allFeatures) { List<SaasFeatureResourceService.SaasFeatureResourceCache> allFeatures) {
// 因为有权授权权限的权限点就需要有所有上层权限点的权限 // 因为有权授权权限的权限点就需要有所有上层权限点的权限
Set<Long> notAuthFeatureIds = allFeatures.stream() List<SaasFeatureResourceService.SaasFeatureResourceCache> notAuthFeatures = allFeatures.stream()
.filter(SaasFeatureResourceService.SaasFeatureResourceCache::isNotAuth) .filter(SaasFeatureResourceService.SaasFeatureResourceCache::isNotAuth)
.map(e -> Optional.ofNullable(e.getParentIds()) .collect(Collectors.toList());
.map(f -> {
f.add(e.getFeatureId()); Set<Long> notAuthFeatureIds = notAuthFeatures.stream()
return f; .map(SaasFeatureResourceService.SaasFeatureResourceCache::getFeatureId)
}) .collect(Collectors.toSet());
.orElseGet(() -> Sets.newHashSet(e.getFeatureId())))
Set<Long> notAuthParentFeatureIds = notAuthFeatures.stream()
.map(SaasFeatureResourceService.SaasFeatureResourceCache::getParentIds)
.flatMap(Collection::stream) .flatMap(Collection::stream)
.collect(Collectors.toSet()); .collect(Collectors.toSet());
notAuthFeatureIds.addAll(notAuthParentFeatureIds);
if (CollectionUtils.isEmpty(notAuthFeatureIds)) { if (CollectionUtils.isEmpty(notAuthFeatureIds)) {
return Collections.emptySet(); return Collections.emptySet();
} }
return productPermissions.stream() return productPermissions.stream()
.filter(productPermission -> notAuthFeatureIds.contains(productPermission.getFeatureId())) .filter(productPermission -> notAuthFeatureIds.contains(productPermission.getFeatureId()))
.map(e -> IdentityAuthRes.PermissionPoint.builder() .map(e -> PermissionResp.builder()
.featureCode(e.getFeatureCode()) .featureCode(e.getFeatureCode())
.featureId(e.getFeatureId()) .featureId(e.getFeatureId())
.terminal(e.getTerminal()) .terminal(e.getTerminal())
@ -169,60 +201,68 @@ public class PermissionServiceImpl implements PermissionService {
.collect(Collectors.toSet()); .collect(Collectors.toSet());
} }
private Set<IdentityAuthRes.PermissionPoint> resolveNormalRolePermission(List<ProductPermissionCacheService.PermissionDTO> workspacePermissions, /**
UserParam userParam) { * 根据角色的协同关系类型去匹配权限
* @param workspacePermissions
* @param userParam
* @param rolePermissionMap
* @return
*/
private Set<PermissionResp> resolveNormalRolePermission(List<ProductPermissionCacheService.PermissionDTO> workspacePermissions,
UserParam userParam,
Map<Long, List<RolePermissionCacheService.PermissionDTO>> rolePermissionMap) {
// 普通角色 Map<String, List<PermissionResp>> workspacePermissionMap = workspacePermissions.stream()
List<RoleParam> normalRoles = userParam.getRoles().stream() .collect(Collectors.groupingBy(ProductPermissionCacheService.PermissionDTO::getCooperateType,
.filter(role -> Objects.nonNull(role.getRoleType()) && !role.getRoleType().isAdmin()) Collectors.mapping(e -> PermissionResp.builder()
.collect(Collectors.toList()); .featureCode(e.getFeatureCode())
if (CollectionUtil.isEmpty(normalRoles)) { .featureId(e.getFeatureId())
log.info("no normal roles"); .terminal(e.getTerminal())
return Collections.emptySet(); .featureType(e.getFeatureType())
} .build(), Collectors.toList())));
return Collections.emptySet(); return userParam.getRoles().stream()
.map(role -> {
List<RolePermissionCacheService.PermissionDTO> rolePermissions = rolePermissionMap.get(role.getRoleId());
if (CollectionUtils.isEmpty(rolePermissions)) {
return null;
}
// return normalRoles.stream() List<PermissionResp> workspacePermissionsMatched = workspacePermissionMap.get(role.getCooperateShipTypes().toString());
// .map(role -> { if (CollectionUtils.isEmpty(workspacePermissionsMatched)) {
// return null;
// Set<String> rolePermissionFeatureCodes = Optional.ofNullable(rolePermissionMap.get(role.getId())) }
// .map(e -> e.stream()
// .filter(Objects::nonNull) Set<String> rolePermissionFeatureCodes = rolePermissions.stream()
// .filter(rolePermission -> { .filter(Objects::nonNull)
// if (CollectionUtils.isEmpty(workspaceOuPair.getTags()) || CollectionUtils.isEmpty(rolePermission.getTags())) { .filter(rolePermission -> {
// return true; if (CollectionUtils.isEmpty(userParam.getTags()) || CollectionUtils.isEmpty(rolePermission.getTags())) {
// } return true;
// }
// if (Sets.intersection(workspaceOuPair.getTags(), rolePermission.getTags()).isEmpty()) { Set<String> paramTags = userParam.getTags().stream()
// return false; .map(RolePermissionTagEnum::name)
// } .collect(Collectors.toSet());
//
// return true; Set<String> cacheTags = rolePermission.getTags().stream()
// }) .map(cn.axzo.tyr.client.model.enums.RolePermissionTagEnum::name)
// .map(RolePermissionCacheService.PermissionDTO::getFeatureCode) .collect(Collectors.toSet());
// .collect(Collectors.toSet())) return !Sets.intersection(paramTags, cacheTags).isEmpty();
// .orElseGet(Sets::newHashSet); })
// .map(RolePermissionCacheService.PermissionDTO::getFeatureCode)
// if (CollectionUtils.isEmpty(rolePermissionFeatureCodes)) { .collect(Collectors.toSet());
// return null;
// } if (CollectionUtils.isEmpty(rolePermissionFeatureCodes)) {
// return null;
// return productPermissions.stream() }
// .filter(productPermission -> Objects.equals(productPermission.getCooperateType(), String.valueOf(role.getProductUnitType())))
// .filter(productPermission -> rolePermissionFeatureCodes.contains(productPermission.getFeatureCode())) return workspacePermissionsMatched.stream()
// .map(e -> IdentityAuthRes.PermissionPoint.builder() .filter(productPermission -> rolePermissionFeatureCodes.contains(productPermission.getFeatureCode()))
// .featureCode(e.getFeatureCode()) .collect(Collectors.toSet());
// .featureId(e.getFeatureId())
// .terminal(e.getTerminal()) })
// .featureType(e.getFeatureType()) .filter(Objects::nonNull)
// .build()) .flatMap(Collection::stream)
// .collect(Collectors.toSet()); .collect(Collectors.toSet());
//
// })
// .filter(Objects::nonNull)
// .flatMap(Collection::stream)
// .collect(Collectors.toSet());
} }
private Map<Long, List<RolePermissionCacheService.PermissionDTO>> listRolePermission(ListUserPermissionParam param) { private Map<Long, List<RolePermissionCacheService.PermissionDTO>> listRolePermission(ListUserPermissionParam param) {

View File

@ -188,6 +188,7 @@ public class SaasRoleUserRelationServiceImpl extends ServiceImpl<SaasRoleUserRel
k.eq(Objects.nonNull(batchPerson.getIdentityType()), "identity_type", batchPerson.getIdentityType()); k.eq(Objects.nonNull(batchPerson.getIdentityType()), "identity_type", batchPerson.getIdentityType());
k.eq(Objects.nonNull(batchPerson.getWorkspaceId()), "workspace_id", batchPerson.getWorkspaceId()); k.eq(Objects.nonNull(batchPerson.getWorkspaceId()), "workspace_id", batchPerson.getWorkspaceId());
k.eq(Objects.nonNull(batchPerson.getOuId()), "ou_id", batchPerson.getOuId()); k.eq(Objects.nonNull(batchPerson.getOuId()), "ou_id", batchPerson.getOuId());
k.eq(Objects.nonNull(batchPerson.getResourceId()), "resource_id", batchPerson.getResourceId());
}); });
} }
}); });

View File

@ -2,6 +2,7 @@ package cn.axzo.tyr.base;
import cn.axzo.apollo.workspace.api.workspace.WorkspaceApi; import cn.axzo.apollo.workspace.api.workspace.WorkspaceApi;
import cn.axzo.basics.profiles.api.UserProfileServiceApi; import cn.axzo.basics.profiles.api.UserProfileServiceApi;
import cn.axzo.client.feign.FeatureCodeCachedApi;
import cn.axzo.framework.rocketmq.Event; import cn.axzo.framework.rocketmq.Event;
import cn.axzo.framework.rocketmq.EventProducer; import cn.axzo.framework.rocketmq.EventProducer;
import cn.axzo.maokai.api.client.OrgUserApi; import cn.axzo.maokai.api.client.OrgUserApi;
@ -52,6 +53,8 @@ public class TestConfig {
private UserProfileServiceApi userProfileServiceApi; private UserProfileServiceApi userProfileServiceApi;
@MockBean @MockBean
private OrgUserApi orgUserApi; private OrgUserApi orgUserApi;
@MockBean
private FeatureCodeCachedApi featureCodeCachedApi;
@Bean @Bean
@Primary @Primary

View File

@ -47,6 +47,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.List; import java.util.List;
import java.util.Objects;
import static cn.axzo.tyr.server.repository.entity.SaasPgroupPermissionRelation.NEW_FEATURE; import static cn.axzo.tyr.server.repository.entity.SaasPgroupPermissionRelation.NEW_FEATURE;
@ -1154,10 +1155,14 @@ class RoleUserV2ControllerTest extends BaseTest {
Assertions.assertEquals(listPermissionFromRoleGroupResps.get(1).getSimpleFeatureInfos().size(), 3); Assertions.assertEquals(listPermissionFromRoleGroupResps.get(1).getSimpleFeatureInfos().size(), 3);
Assertions.assertTrue(listPermissionFromRoleGroupResps.get(1).getSimpleFeatureInfos().containsAll(Sets.newHashSet(101744L, 101745L, 101746L))); Assertions.assertTrue(listPermissionFromRoleGroupResps.get(1).getSimpleFeatureInfos().containsAll(Sets.newHashSet(101744L, 101745L, 101746L)));
Assertions.assertEquals(listPermissionFromRoleGroupResps.get(1).getFeatureInfos().size(), 3); Assertions.assertEquals(listPermissionFromRoleGroupResps.get(1).getFeatureInfos().size(), 3);
Assertions.assertEquals(Lists.newArrayList(listPermissionFromRoleGroupResps.get(1).getFeatureInfos()).get(0).getFeatureId(), 101745L); ListPermissionFromRoleGroupResp.FeatureInfo featureInfo = listPermissionFromRoleGroupResps.get(1).getFeatureInfos().stream()
Assertions.assertEquals(Lists.newArrayList(listPermissionFromRoleGroupResps.get(1).getFeatureInfos()).get(0).getRelationType(), 1); .filter(e -> Objects.equals(e.getFeatureId(), 101745L))
Assertions.assertEquals(Lists.newArrayList(listPermissionFromRoleGroupResps.get(1).getFeatureInfos()).get(0).getTags().size(), 1); .findFirst()
Assertions.assertTrue(Lists.newArrayList(listPermissionFromRoleGroupResps.get(1).getFeatureInfos()).get(0).getTags() .get();
Assertions.assertEquals(featureInfo.getFeatureId(), 101745L);
Assertions.assertEquals(featureInfo.getRelationType(), 1);
Assertions.assertEquals(featureInfo.getTags().size(), 1);
Assertions.assertTrue(featureInfo.getTags()
.containsAll(Sets.newHashSet(cn.axzo.tyr.client.model.enums.RolePermissionTagEnum.JOINED))); .containsAll(Sets.newHashSet(cn.axzo.tyr.client.model.enums.RolePermissionTagEnum.JOINED)));

View File

@ -0,0 +1,832 @@
package cn.axzo.tyr.server.controller.v2;
import cn.axzo.client.feign.FeatureCodeCachedApi;
import cn.axzo.foundation.exception.BusinessException;
import cn.axzo.framework.domain.web.result.ApiListResult;
import cn.axzo.framework.domain.web.result.ApiResult;
import cn.axzo.maokai.api.client.OrgUserApi;
import cn.axzo.maokai.api.vo.response.OrgUserRes;
import cn.axzo.maokai.common.enums.OrgUserStatusEnum;
import cn.axzo.thrones.client.saas.ServicePkgClient;
import cn.axzo.thrones.client.saas.entity.serivicepgkproduct.ServicePkgProduct;
import cn.axzo.thrones.client.saas.entity.servicepkg.ServicePkgDetailRes;
import cn.axzo.tyr.base.BaseTest;
import cn.axzo.tyr.base.MysqlDataLoader;
import cn.axzo.tyr.client.model.enums.IdentityType;
import cn.axzo.tyr.client.model.enums.RolePermissionTagEnum;
import cn.axzo.tyr.client.model.req.IdentityAuthReq;
import cn.axzo.tyr.client.model.req.PermissionCheckReq;
import cn.axzo.tyr.client.model.res.IdentityAuthRes;
import cn.axzo.tyr.feign.enums.IdentityTypeEnum;
import cn.axzo.tyr.feign.req.ListUserPermissionReq;
import cn.axzo.tyr.feign.resp.UserPermissionResp;
import cn.axzo.tyr.server.service.PermissionQueryService;
import cn.axzo.tyr.server.service.TyrSaasAuthService;
import cn.azxo.framework.common.model.CommonResponse;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import org.apache.commons.collections.CollectionUtils;
import org.assertj.core.util.Lists;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.Map;
import java.util.Set;
import static cn.axzo.tyr.server.config.exception.BizResultCode.PARAM_ERROR;
import static cn.axzo.tyr.server.repository.entity.SaasPgroupPermissionRelation.NEW_FEATURE;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertThrows;
class UserPermissionControllerTest extends BaseTest {
@Autowired
private MysqlDataLoader mysqlDataLoader;
@Autowired
private UserPermissionController userPermissionController;
@Autowired
private PermissionQueryService permissionQueryService;
@Autowired
private OrgUserApi orgUserApi;
@Autowired
private FeatureCodeCachedApi featureCodeCachedApi;
@Autowired
private ServicePkgClient servicePkgClient;
@Autowired
private TyrSaasAuthService tyrSaasAuthService;
@BeforeEach
@Override
public void setup() {
super.setup();
mysqlDataLoader.loadFromClassName(getClass().getSimpleName());
MockitoAnnotations.initMocks(this);
Mockito.when(orgUserApi.listOrgUser(Mockito.any()))
.thenReturn(ApiListResult.ok(com.google.common.collect.Lists.newArrayList(OrgUserRes.builder()
.workspaceId(3L)
.ouId(4L)
.personId(1827L)
.status(OrgUserStatusEnum.JOINED)
.build(),
OrgUserRes.builder()
.workspaceId(3L)
.ouId(4L)
.personId(3470L)
.status(OrgUserStatusEnum.LEAVE)
.build())));
Map<String, Set<String>> featureCodeMap = Maps.newHashMap();
featureCodeMap.put("h5:cmp_user_manage_worker_page", Sets.newHashSet("h5:cmp_user_manage_worker_page"));
Mockito.when(featureCodeCachedApi.list(Mockito.eq(FeatureCodeCachedApi.ListFeatureCodeParam.builder()
.featureCodes(Sets.newHashSet("h5:cmp_user_manage_worker_page"))
.build())))
.thenReturn(ApiResult.ok(featureCodeMap));
featureCodeMap = Maps.newHashMap();
featureCodeMap.put("h5:cmp_user_manage_worker_page", Sets.newHashSet("h5:cmp_user_manage_worker_page"));
featureCodeMap.put("h5:cmp_user_manage_worker_jump_to_team_btn", Sets.newHashSet("h5:cmp_user_manage_worker_jump_to_team_btn"));
Mockito.when(featureCodeCachedApi.list(Mockito.eq(FeatureCodeCachedApi.ListFeatureCodeParam.builder()
.featureCodes(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.build())))
.thenReturn(ApiResult.ok(featureCodeMap));
ServicePkgDetailRes servicePkgDetail = new ServicePkgDetailRes();
servicePkgDetail.setSpaceId(3L);
ServicePkgProduct servicePkgProduct = new ServicePkgProduct();
servicePkgProduct.setProductId(2L);
servicePkgDetail.setProducts(com.google.common.collect.Lists.newArrayList(servicePkgProduct));
Mockito.when(servicePkgClient.getServicePkgDetailBySpaceId(Mockito.any()))
.thenReturn(CommonResponse.success(com.google.common.collect.Lists.newArrayList(servicePkgDetail)));
}
@Test
void listUserPermissionReplaceHasPermission() {
// old cn.axzo.tyr.client.feign.PermissionQueryApi#hasPermission
PermissionCheckReq permissionCheckReq = PermissionCheckReq.builder()
.personId(1827L)
.featureCodes(Lists.newArrayList("h5:cmp_user_manage_worker_page"))
.ouId(4L)
.workspaceId(3L)
.build();
boolean hasPermission = permissionQueryService.hasPermission(permissionCheckReq);
Assertions.assertTrue(hasPermission);
hasPermission = permissionQueryService.hasPermission(PermissionCheckReq.builder()
.personId(1827L)
.featureCodes(Lists.newArrayList("h5:cmp_user_manage_worker_page"))
.ouId(4L)
.workspaceId(4L)
.build());
Assertions.assertFalse(hasPermission);
hasPermission = permissionQueryService.hasPermission(PermissionCheckReq.builder()
.personId(1827L)
.featureCodes(Lists.newArrayList("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.ouId(4L)
.workspaceId(3L)
.build());
Assertions.assertTrue(hasPermission);
hasPermission = permissionQueryService.hasPermission(PermissionCheckReq.builder()
.personId(1827L)
.featureCodes(Lists.newArrayList("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.ouId(4L)
.workspaceId(3L)
.terminal("NT_CMP_APP_GENERAL")
.build());
Assertions.assertTrue(hasPermission);
hasPermission = permissionQueryService.hasPermission(PermissionCheckReq.builder()
.personId(1827L)
.featureCodes(Lists.newArrayList("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.ouId(4L)
.workspaceId(3L)
.terminal("NT_CMS_WEB_GENERAL")
.build());
Assertions.assertFalse(hasPermission);
hasPermission = permissionQueryService.hasPermission(PermissionCheckReq.builder()
.personId(1827L)
.featureCodes(Lists.newArrayList("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.ouId(4L)
.workspaceId(3L)
.tags(Sets.newHashSet(RolePermissionTagEnum.LEAVE))
.build());
Assertions.assertFalse(hasPermission);
hasPermission = permissionQueryService.hasPermission(PermissionCheckReq.builder()
.personId(1827L)
.featureCodes(Lists.newArrayList("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.ouId(4L)
.workspaceId(3L)
.tags(Sets.newHashSet(RolePermissionTagEnum.JOINED))
.build());
Assertions.assertTrue(hasPermission);
// old cn.axzo.tyr.client.feign.PermissionQueryApi#hasPermission
List<UserPermissionResp> userPermissionResps = userPermissionController.listUserPermission(ListUserPermissionReq.builder()
.featureCodes(Sets.newHashSet("h5:cmp_user_manage_worker_page"))
.userPermissions(Lists.newArrayList(ListUserPermissionReq.UserPermission.builder()
.personId(1827L)
.ouId(4L)
.workspaceId(3L)
.build()))
.build())
.getData();
Assertions.assertTrue(CollectionUtils.isNotEmpty(userPermissionResps));
Assertions.assertEquals(userPermissionResps.get(0).getPersonId(), 1827L);
Assertions.assertEquals(userPermissionResps.get(0).getOuId(), 4L);
Assertions.assertEquals(userPermissionResps.get(0).getWorkspaceId(), 3L);
Assertions.assertFalse(userPermissionResps.get(0).getIsSuperAdmin());
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().size(), 2);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getFeatureId(), 101744L);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getFeatureType(), 4);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getFeatureId(), 101745L);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getFeatureType(), 4);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getTerminal(), "NT_CMP_APP_GENERAL");
userPermissionResps = userPermissionController.listUserPermission(ListUserPermissionReq.builder()
.featureCodes(Sets.newHashSet("h5:cmp_user_manage_worker_page"))
.userPermissions(Lists.newArrayList(ListUserPermissionReq.UserPermission.builder()
.personId(1827L)
.ouId(4L)
.workspaceId(4L)
.build()))
.build())
.getData();
Assertions.assertTrue(CollectionUtils.isEmpty(userPermissionResps));
userPermissionResps = userPermissionController.listUserPermission(ListUserPermissionReq.builder()
.featureCodes(Sets.newHashSet("h5:cmp_user_manage_worker_page_2"))
.userPermissions(Lists.newArrayList(ListUserPermissionReq.UserPermission.builder()
.personId(1827L)
.ouId(4L)
.workspaceId(3L)
.build()))
.build())
.getData();
Assertions.assertTrue(CollectionUtils.isEmpty(userPermissionResps));
userPermissionResps = userPermissionController.listUserPermission(ListUserPermissionReq.builder()
.featureCodes(Sets.newHashSet("h5:cmp_user_manage_worker_on_site_audit_btn"))
.userPermissions(Lists.newArrayList(ListUserPermissionReq.UserPermission.builder()
.personId(1827L)
.ouId(4L)
.workspaceId(3L)
.build()))
.build())
.getData();
Assertions.assertTrue(CollectionUtils.isNotEmpty(userPermissionResps));
Assertions.assertEquals(userPermissionResps.get(0).getPersonId(), 1827L);
Assertions.assertEquals(userPermissionResps.get(0).getOuId(), 4L);
Assertions.assertEquals(userPermissionResps.get(0).getWorkspaceId(), 3L);
Assertions.assertFalse(userPermissionResps.get(0).getIsSuperAdmin());
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().size(), 0);
userPermissionResps = userPermissionController.listUserPermission(ListUserPermissionReq.builder()
.featureCodes(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.userPermissions(Lists.newArrayList(ListUserPermissionReq.UserPermission.builder()
.personId(1827L)
.ouId(4L)
.workspaceId(3L)
.build()))
.build())
.getData();
Assertions.assertTrue(CollectionUtils.isNotEmpty(userPermissionResps));
Assertions.assertEquals(userPermissionResps.get(0).getPersonId(), 1827L);
Assertions.assertEquals(userPermissionResps.get(0).getOuId(), 4L);
Assertions.assertEquals(userPermissionResps.get(0).getWorkspaceId(), 3L);
Assertions.assertFalse(userPermissionResps.get(0).getIsSuperAdmin());
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().size(), 3);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getFeatureId(), 101744L);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getFeatureCode(), "h5:cmp_user_manage_worker_jump_to_team_btn");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getFeatureType(), 4);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getFeatureId(), 101744L);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getFeatureType(), 4);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(2).getFeatureId(), 101745L);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(2).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(2).getFeatureType(), 4);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(2).getTerminal(), "NT_CMP_APP_GENERAL");
userPermissionResps = userPermissionController.listUserPermission(ListUserPermissionReq.builder()
.featureCodes(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.userPermissions(Lists.newArrayList(ListUserPermissionReq.UserPermission.builder()
.personId(1827L)
.ouId(4L)
.workspaceId(3L)
.build()))
.terminal("NT_CMS_WEB_GENERAL")
.build())
.getData();
Assertions.assertTrue(CollectionUtils.isEmpty(userPermissionResps));
userPermissionResps = userPermissionController.listUserPermission(ListUserPermissionReq.builder()
.featureCodes(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.userPermissions(Lists.newArrayList(ListUserPermissionReq.UserPermission.builder()
.personId(1827L)
.ouId(4L)
.workspaceId(3L)
.build()))
.terminal("NT_CMP_APP_GENERAL")
.build())
.getData();
Assertions.assertTrue(CollectionUtils.isNotEmpty(userPermissionResps));
Assertions.assertEquals(userPermissionResps.get(0).getPersonId(), 1827L);
Assertions.assertEquals(userPermissionResps.get(0).getOuId(), 4L);
Assertions.assertEquals(userPermissionResps.get(0).getWorkspaceId(), 3L);
Assertions.assertFalse(userPermissionResps.get(0).getIsSuperAdmin());
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().size(), 3);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getFeatureId(), 101744L);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getFeatureCode(), "h5:cmp_user_manage_worker_jump_to_team_btn");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getFeatureType(), 4);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getFeatureId(), 101744L);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getFeatureType(), 4);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(2).getFeatureId(), 101745L);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(2).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(2).getFeatureType(), 4);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(2).getTerminal(), "NT_CMP_APP_GENERAL");
userPermissionResps = userPermissionController.listUserPermission(ListUserPermissionReq.builder()
.featureCodes(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.userPermissions(Lists.newArrayList(ListUserPermissionReq.UserPermission.builder()
.personId(1827L)
.ouId(4L)
.workspaceId(3L)
.permissionTags(Sets.newHashSet(cn.axzo.tyr.feign.enums.RolePermissionTagEnum.LEAVE))
.build()))
.build())
.getData();
Assertions.assertTrue(CollectionUtils.isNotEmpty(userPermissionResps));
Assertions.assertEquals(userPermissionResps.get(0).getPersonId(), 1827L);
Assertions.assertEquals(userPermissionResps.get(0).getOuId(), 4L);
Assertions.assertEquals(userPermissionResps.get(0).getWorkspaceId(), 3L);
Assertions.assertFalse(userPermissionResps.get(0).getIsSuperAdmin());
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().size(), 0);
userPermissionResps = userPermissionController.listUserPermission(ListUserPermissionReq.builder()
.featureCodes(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.userPermissions(Lists.newArrayList(ListUserPermissionReq.UserPermission.builder()
.personId(1827L)
.ouId(4L)
.workspaceId(3L)
.permissionTags(Sets.newHashSet(cn.axzo.tyr.feign.enums.RolePermissionTagEnum.JOINED,
cn.axzo.tyr.feign.enums.RolePermissionTagEnum.LEAVE))
.build()))
.build())
.getData();
Assertions.assertTrue(CollectionUtils.isNotEmpty(userPermissionResps));
Assertions.assertEquals(userPermissionResps.get(0).getPersonId(), 1827L);
Assertions.assertEquals(userPermissionResps.get(0).getOuId(), 4L);
Assertions.assertEquals(userPermissionResps.get(0).getWorkspaceId(), 3L);
Assertions.assertFalse(userPermissionResps.get(0).getIsSuperAdmin());
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().size(), 3);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getFeatureId(), 101744L);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getFeatureCode(), "h5:cmp_user_manage_worker_jump_to_team_btn");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getFeatureType(), 4);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getFeatureId(), 101744L);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getFeatureType(), 4);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(2).getFeatureId(), 101745L);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(2).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(2).getFeatureType(), 4);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(2).getTerminal(), "NT_CMP_APP_GENERAL");
}
@Test
void listUserPermissionReplaceFindIdentityAuth() {
// old
IdentityAuthReq identityAuthReq = IdentityAuthReq.builder()
.personId(1827L)
.workspaceOusPairs(Lists.newArrayList(IdentityAuthReq.WorkspaceOuPair.builder()
.workspaceId(3L)
.ouId(4L)
.build()))
.featureCode(Sets.newHashSet("h5:cmp_user_manage_worker_page"))
.build();
IdentityAuthRes identityAuthMix = tyrSaasAuthService.findIdentityAuthMix(identityAuthReq);
Assertions.assertEquals(identityAuthMix.getPersonId(), 1827L);
Assertions.assertEquals(identityAuthMix.getPermissions().size(), 1);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getOuId(), 4L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getWorkspaceId(), 3L);
Assertions.assertFalse(identityAuthMix.getPermissions().get(0).isSuperAdmin());
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().size(), 2);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getFeatureId(), 101744L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getFeatureType(), 4);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(1).getFeatureId(), 101745L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(1).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(1).getFeatureType(), 4);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(1).getTerminal(), "NT_CMP_APP_GENERAL");
identityAuthReq = IdentityAuthReq.builder()
.personId(1827L)
.workspaceOusPairs(Lists.newArrayList(IdentityAuthReq.WorkspaceOuPair.builder()
.workspaceId(4L)
.ouId(4L)
.build()))
.featureCode(Sets.newHashSet("h5:cmp_user_manage_worker_page"))
.build();
identityAuthMix = tyrSaasAuthService.findIdentityAuthMix(identityAuthReq);
Assertions.assertEquals(identityAuthMix.getPersonId(), 1827L);
Assertions.assertEquals(identityAuthMix.getPermissions().size(), 1);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getOuId(), 4L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getWorkspaceId(), 4L);
Assertions.assertFalse(identityAuthMix.getPermissions().get(0).isSuperAdmin());
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().size(), 0);
identityAuthReq = IdentityAuthReq.builder()
.personId(1827L)
.workspaceOusPairs(Lists.newArrayList(IdentityAuthReq.WorkspaceOuPair.builder()
.workspaceId(3L)
.ouId(4L)
.build()))
.featureCode(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.build();
identityAuthMix = tyrSaasAuthService.findIdentityAuthMix(identityAuthReq);
Assertions.assertEquals(identityAuthMix.getPersonId(), 1827L);
Assertions.assertEquals(identityAuthMix.getPermissions().size(), 1);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getOuId(), 4L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getWorkspaceId(), 3L);
Assertions.assertFalse(identityAuthMix.getPermissions().get(0).isSuperAdmin());
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().size(), 3);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getFeatureId(), 101744L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getFeatureCode(), "h5:cmp_user_manage_worker_jump_to_team_btn");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getFeatureType(), 4);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(1).getFeatureId(), 101744L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(1).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(1).getFeatureType(), 4);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(1).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(2).getFeatureId(), 101745L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(2).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(2).getFeatureType(), 4);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(2).getTerminal(), "NT_CMP_APP_GENERAL");
identityAuthReq = IdentityAuthReq.builder()
.personId(1827L)
.workspaceOusPairs(Lists.newArrayList(IdentityAuthReq.WorkspaceOuPair.builder()
.workspaceId(3L)
.ouId(4L)
.build()))
.featureCode(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.terminal(Lists.newArrayList("NT_CMS_WEB_GENERAL"))
.build();
identityAuthMix = tyrSaasAuthService.findIdentityAuthMix(identityAuthReq);
Assertions.assertEquals(identityAuthMix.getPersonId(), 1827L);
Assertions.assertEquals(identityAuthMix.getPermissions().size(), 1);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getOuId(), 4L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getWorkspaceId(), 3L);
Assertions.assertFalse(identityAuthMix.getPermissions().get(0).isSuperAdmin());
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().size(), 0);
identityAuthReq = IdentityAuthReq.builder()
.personId(1827L)
.workspaceOusPairs(Lists.newArrayList(IdentityAuthReq.WorkspaceOuPair.builder()
.workspaceId(3L)
.ouId(4L)
.build()))
.featureCode(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.terminal(Lists.newArrayList("NT_CMP_APP_GENERAL"))
.build();
identityAuthMix = tyrSaasAuthService.findIdentityAuthMix(identityAuthReq);
Assertions.assertEquals(identityAuthMix.getPersonId(), 1827L);
Assertions.assertEquals(identityAuthMix.getPermissions().size(), 1);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getOuId(), 4L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getWorkspaceId(), 3L);
Assertions.assertFalse(identityAuthMix.getPermissions().get(0).isSuperAdmin());
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().size(), 3);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getFeatureId(), 101744L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getFeatureCode(), "h5:cmp_user_manage_worker_jump_to_team_btn");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getFeatureType(), 4);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(1).getFeatureId(), 101744L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(1).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(1).getFeatureType(), 4);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(1).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(2).getFeatureId(), 101745L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(2).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(2).getFeatureType(), 4);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(2).getTerminal(), "NT_CMP_APP_GENERAL");
identityAuthReq = IdentityAuthReq.builder()
.personId(1827L)
.workspaceOusPairs(Lists.newArrayList(IdentityAuthReq.WorkspaceOuPair.builder()
.workspaceId(3L)
.ouId(4L)
.build()))
.featureCode(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.appType("H5")
.build();
identityAuthMix = tyrSaasAuthService.findIdentityAuthMix(identityAuthReq);
Assertions.assertEquals(identityAuthMix.getPersonId(), 1827L);
Assertions.assertEquals(identityAuthMix.getPermissions().size(), 1);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getOuId(), 4L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getWorkspaceId(), 3L);
Assertions.assertFalse(identityAuthMix.getPermissions().get(0).isSuperAdmin());
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().size(), 3);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getFeatureId(), 101744L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getFeatureCode(), "h5:cmp_user_manage_worker_jump_to_team_btn");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getFeatureType(), 4);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(1).getFeatureId(), 101744L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(1).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(1).getFeatureType(), 4);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(1).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(2).getFeatureId(), 101745L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(2).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(2).getFeatureType(), 4);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(2).getTerminal(), "NT_CMP_APP_GENERAL");
identityAuthReq = IdentityAuthReq.builder()
.personId(1827L)
.workspaceOusPairs(Lists.newArrayList(IdentityAuthReq.WorkspaceOuPair.builder()
.workspaceId(3L)
.ouId(4L)
.build()))
.featureCode(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.appType("APP")
.build();
identityAuthMix = tyrSaasAuthService.findIdentityAuthMix(identityAuthReq);
Assertions.assertEquals(identityAuthMix.getPersonId(), 1827L);
Assertions.assertEquals(identityAuthMix.getPermissions().size(), 1);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getOuId(), 4L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getWorkspaceId(), 3L);
Assertions.assertFalse(identityAuthMix.getPermissions().get(0).isSuperAdmin());
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().size(), 0);
identityAuthReq = IdentityAuthReq.builder()
.personId(1827L)
.workspaceOusPairs(Lists.newArrayList(IdentityAuthReq.WorkspaceOuPair.builder()
.workspaceId(3L)
.ouId(4L)
.build()))
.featureCode(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.itemCode("h5:user_manage_D9B0187")
.build();
identityAuthMix = tyrSaasAuthService.findIdentityAuthMix(identityAuthReq);
Assertions.assertEquals(identityAuthMix.getPersonId(), 1827L);
Assertions.assertEquals(identityAuthMix.getPermissions().size(), 1);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getOuId(), 4L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getWorkspaceId(), 3L);
Assertions.assertFalse(identityAuthMix.getPermissions().get(0).isSuperAdmin());
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().size(), 0);
identityAuthReq = IdentityAuthReq.builder()
.personId(1827L)
.workspaceOusPairs(Lists.newArrayList(IdentityAuthReq.WorkspaceOuPair.builder()
.workspaceId(3L)
.ouId(4L)
.build()))
.featureCode(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.itemCode("h5:user_manage_D9B0186")
.build();
identityAuthMix = tyrSaasAuthService.findIdentityAuthMix(identityAuthReq);
Assertions.assertEquals(identityAuthMix.getPersonId(), 1827L);
Assertions.assertEquals(identityAuthMix.getPermissions().size(), 1);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getOuId(), 4L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getWorkspaceId(), 3L);
Assertions.assertFalse(identityAuthMix.getPermissions().get(0).isSuperAdmin());
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().size(), 3);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getFeatureId(), 101744L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getFeatureCode(), "h5:cmp_user_manage_worker_jump_to_team_btn");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getFeatureType(), 4);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(1).getFeatureId(), 101744L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(1).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(1).getFeatureType(), 4);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(1).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(2).getFeatureId(), 101745L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(2).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(2).getFeatureType(), 4);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(2).getTerminal(), "NT_CMP_APP_GENERAL");
identityAuthReq = IdentityAuthReq.builder()
.personId(1827L)
.workspaceOusPairs(Lists.newArrayList(IdentityAuthReq.WorkspaceOuPair.builder()
.workspaceId(3L)
.ouId(4L)
.build()))
.featureCode(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.featureId(Sets.newHashSet(101745L))
.itemCode("h5:user_manage_D9B0186")
.build();
identityAuthMix = tyrSaasAuthService.findIdentityAuthMix(identityAuthReq);
Assertions.assertEquals(identityAuthMix.getPersonId(), 1827L);
Assertions.assertEquals(identityAuthMix.getPermissions().size(), 1);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getOuId(), 4L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getWorkspaceId(), 3L);
Assertions.assertFalse(identityAuthMix.getPermissions().get(0).isSuperAdmin());
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().size(), 1);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getFeatureId(), 101745L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getFeatureType(), 4);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getTerminal(), "NT_CMP_APP_GENERAL");
identityAuthReq = IdentityAuthReq.builder()
.identityId(6L)
.identityType(IdentityType.PRACTITIONER)
.workspaceOusPairs(Lists.newArrayList(IdentityAuthReq.WorkspaceOuPair.builder()
.workspaceId(3L)
.ouId(4L)
.build()))
.featureCode(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.featureId(Sets.newHashSet(101745L))
.itemCode("h5:user_manage_D9B0186")
.build();
identityAuthMix = tyrSaasAuthService.findIdentityAuthMix(identityAuthReq);
Assertions.assertEquals(identityAuthMix.getIdentity(), 6L);
Assertions.assertEquals(identityAuthMix.getIdentityType(), IdentityType.PRACTITIONER);
Assertions.assertNull(identityAuthMix.getPersonId());
Assertions.assertEquals(identityAuthMix.getPermissions().size(), 1);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getOuId(), 4L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getWorkspaceId(), 3L);
Assertions.assertFalse(identityAuthMix.getPermissions().get(0).isSuperAdmin());
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().size(), 1);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getFeatureId(), 101745L);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getFeatureType(), 4);
Assertions.assertEquals(identityAuthMix.getPermissions().get(0).getPermissionPoint().get(0).getTerminal(), "NT_CMP_APP_GENERAL");
// old
List<UserPermissionResp> userPermissionResps = userPermissionController.listUserPermission(ListUserPermissionReq.builder()
.featureCodes(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.userPermissions(Lists.newArrayList(ListUserPermissionReq.UserPermission.builder()
.personId(1827L)
.ouId(4L)
.workspaceId(3L)
.build()))
.itemCode("h5:user_manage_D9B0186")
.build())
.getData();
Assertions.assertTrue(CollectionUtils.isNotEmpty(userPermissionResps));
Assertions.assertEquals(userPermissionResps.get(0).getPersonId(), 1827L);
Assertions.assertEquals(userPermissionResps.get(0).getOuId(), 4L);
Assertions.assertEquals(userPermissionResps.get(0).getWorkspaceId(), 3L);
Assertions.assertFalse(userPermissionResps.get(0).getIsSuperAdmin());
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().size(), 3);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getFeatureId(), 101744L);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getFeatureCode(), "h5:cmp_user_manage_worker_jump_to_team_btn");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getFeatureType(), 4);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getFeatureId(), 101744L);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getFeatureType(), 4);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(2).getFeatureId(), 101745L);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(2).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(2).getFeatureType(), 4);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(2).getTerminal(), "NT_CMP_APP_GENERAL");
userPermissionResps = userPermissionController.listUserPermission(ListUserPermissionReq.builder()
.featureCodes(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.userPermissions(Lists.newArrayList(ListUserPermissionReq.UserPermission.builder()
.personId(1827L)
.ouId(4L)
.workspaceId(3L)
.build()))
.appType("APP")
.build())
.getData();
Assertions.assertTrue(CollectionUtils.isEmpty(userPermissionResps));
userPermissionResps = userPermissionController.listUserPermission(ListUserPermissionReq.builder()
.featureCodes(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.userPermissions(Lists.newArrayList(ListUserPermissionReq.UserPermission.builder()
.personId(1827L)
.ouId(4L)
.workspaceId(3L)
.build()))
.appType("H5")
.build())
.getData();
Assertions.assertTrue(CollectionUtils.isNotEmpty(userPermissionResps));
Assertions.assertEquals(userPermissionResps.get(0).getPersonId(), 1827L);
Assertions.assertEquals(userPermissionResps.get(0).getOuId(), 4L);
Assertions.assertEquals(userPermissionResps.get(0).getWorkspaceId(), 3L);
Assertions.assertFalse(userPermissionResps.get(0).getIsSuperAdmin());
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().size(), 3);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getFeatureId(), 101744L);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getFeatureCode(), "h5:cmp_user_manage_worker_jump_to_team_btn");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getFeatureType(), 4);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getFeatureId(), 101744L);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getFeatureType(), 4);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(2).getFeatureId(), 101745L);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(2).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(2).getFeatureType(), 4);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(2).getTerminal(), "NT_CMP_APP_GENERAL");
}
@Test
void listUserPermission() {
BusinessException businessException = assertThrows(BusinessException.class, () -> {
userPermissionController.listUserPermission(ListUserPermissionReq.builder()
.featureCodes(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.userPermissions(Lists.newArrayList(ListUserPermissionReq.UserPermission.builder()
.personId(1827L)
.identityId(11L)
.ouId(4L)
.workspaceId(3L)
.build()))
.appType("H5")
.build())
.getData();
});
Assertions.assertEquals(businessException.getErrorCode(), PARAM_ERROR.getErrorCode());
Assertions.assertEquals(businessException.getErrorMsg(), "参数错误:personId 和 identityId只能二选一");
businessException = assertThrows(BusinessException.class, () -> {
userPermissionController.listUserPermission(ListUserPermissionReq.builder()
.featureCodes(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.userPermissions(Lists.newArrayList(ListUserPermissionReq.UserPermission.builder()
.personId(1827L)
.identityType(IdentityTypeEnum.OPERATOR)
.ouId(4L)
.workspaceId(3L)
.build()))
.appType("H5")
.build())
.getData();
});
Assertions.assertEquals(businessException.getErrorCode(), PARAM_ERROR.getErrorCode());
Assertions.assertEquals(businessException.getErrorMsg(), "参数错误:personId 和 identityId只能二选一");
businessException = assertThrows(BusinessException.class, () -> {
userPermissionController.listUserPermission(ListUserPermissionReq.builder()
.featureCodes(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.userPermissions(Lists.newArrayList(ListUserPermissionReq.UserPermission.builder()
.personId(1827L)
.identityId(2424L)
.identityType(IdentityTypeEnum.OPERATOR)
.ouId(4L)
.workspaceId(3L)
.build()))
.appType("H5")
.build())
.getData();
});
Assertions.assertEquals(businessException.getErrorCode(), PARAM_ERROR.getErrorCode());
Assertions.assertEquals(businessException.getErrorMsg(), "参数错误:personId 和 identityId只能二选一");
businessException = assertThrows(BusinessException.class, () -> {
userPermissionController.listUserPermission(ListUserPermissionReq.builder()
.featureCodes(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.userPermissions(Lists.newArrayList(ListUserPermissionReq.UserPermission.builder()
.ouId(4L)
.workspaceId(3L)
.build()))
.appType("H5")
.build())
.getData();
});
Assertions.assertEquals(businessException.getErrorCode(), PARAM_ERROR.getErrorCode());
Assertions.assertEquals(businessException.getErrorMsg(), "参数错误:personId 和 identityId不能同时为空");
businessException = assertThrows(BusinessException.class, () -> {
userPermissionController.listUserPermission(ListUserPermissionReq.builder()
.featureCodes(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.userPermissions(Lists.newArrayList(ListUserPermissionReq.UserPermission.builder()
.identityId(123L)
.ouId(4L)
.workspaceId(3L)
.build()))
.appType("H5")
.build())
.getData();
});
Assertions.assertEquals(businessException.getErrorCode(), PARAM_ERROR.getErrorCode());
Assertions.assertEquals(businessException.getErrorMsg(), "参数错误:identityType不能为空");
businessException = assertThrows(BusinessException.class, () -> {
userPermissionController.listUserPermission(ListUserPermissionReq.builder()
.featureCodes(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.userPermissions(Lists.newArrayList(ListUserPermissionReq.UserPermission.builder()
.identityType(IdentityTypeEnum.OPERATOR)
.ouId(4L)
.workspaceId(3L)
.build()))
.appType("H5")
.build())
.getData();
});
Assertions.assertEquals(businessException.getErrorCode(), PARAM_ERROR.getErrorCode());
Assertions.assertEquals(businessException.getErrorMsg(), "参数错误:personId 和 identityId不能同时为空");
List<UserPermissionResp> userPermissionResps = userPermissionController.listUserPermission(ListUserPermissionReq.builder()
.featureCodes(Sets.newHashSet("h5:cmp_user_manage_worker_page", "h5:cmp_user_manage_worker_jump_to_team_btn"))
.userPermissions(Lists.newArrayList(ListUserPermissionReq.UserPermission.builder()
.personId(1827L)
.ouId(4L)
.workspaceId(3L)
.build(),
ListUserPermissionReq.UserPermission.builder()
.identityId(8L)
.identityType(IdentityTypeEnum.PRACTITIONER)
.ouId(4L)
.workspaceId(3L)
.build()))
.appType("H5")
.build())
.getData();
Assertions.assertTrue(CollectionUtils.isNotEmpty(userPermissionResps));
Assertions.assertEquals(userPermissionResps.get(0).getPersonId(), 1827L);
Assertions.assertEquals(userPermissionResps.get(0).getOuId(), 4L);
Assertions.assertEquals(userPermissionResps.get(0).getWorkspaceId(), 3L);
Assertions.assertFalse(userPermissionResps.get(0).getIsSuperAdmin());
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().size(), 3);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getFeatureId(), 101744L);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getFeatureCode(), "h5:cmp_user_manage_worker_jump_to_team_btn");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getFeatureType(), 4);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(0).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getFeatureId(), 101744L);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getFeatureType(), 4);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(1).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(2).getFeatureId(), 101745L);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(2).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(2).getFeatureType(), 4);
Assertions.assertEquals(userPermissionResps.get(0).getPermissions().get(2).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(userPermissionResps.get(1).getIdentityId(), 8L);
Assertions.assertEquals(userPermissionResps.get(1).getIdentityType(), IdentityTypeEnum.PRACTITIONER.name());
Assertions.assertEquals(userPermissionResps.get(1).getOuId(), 4L);
Assertions.assertEquals(userPermissionResps.get(1).getWorkspaceId(), 3L);
Assertions.assertFalse(userPermissionResps.get(0).getIsSuperAdmin());
Assertions.assertEquals(userPermissionResps.get(1).getPermissions().size(), 3);
Assertions.assertEquals(userPermissionResps.get(1).getPermissions().get(0).getFeatureId(), 101744L);
Assertions.assertEquals(userPermissionResps.get(1).getPermissions().get(0).getFeatureCode(), "h5:cmp_user_manage_worker_jump_to_team_btn");
Assertions.assertEquals(userPermissionResps.get(1).getPermissions().get(0).getFeatureType(), 4);
Assertions.assertEquals(userPermissionResps.get(1).getPermissions().get(0).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(userPermissionResps.get(1).getPermissions().get(1).getFeatureId(), 101744L);
Assertions.assertEquals(userPermissionResps.get(1).getPermissions().get(1).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(userPermissionResps.get(1).getPermissions().get(1).getFeatureType(), 4);
Assertions.assertEquals(userPermissionResps.get(1).getPermissions().get(1).getTerminal(), "NT_CMP_APP_GENERAL");
Assertions.assertEquals(userPermissionResps.get(1).getPermissions().get(2).getFeatureId(), 101745L);
Assertions.assertEquals(userPermissionResps.get(1).getPermissions().get(2).getFeatureCode(), "h5:cmp_user_manage_worker_page");
Assertions.assertEquals(userPermissionResps.get(1).getPermissions().get(2).getFeatureType(), 4);
Assertions.assertEquals(userPermissionResps.get(1).getPermissions().get(2).getTerminal(), "NT_CMP_APP_GENERAL");
}
}

View File

@ -94,4 +94,4 @@ INSERT INTO saas_feature_resource (id, feature_code, feature_name, feature_type,
VALUES (693, 'oms:detail_backPay_btn', '查看投诉详情', 4, 'NT_OMS_WEB', 1, 612, '528,611,612,693,', 0, '', 0, 'oms:detail_backPay_btn', 0, 1, '', 1, '/home/complain-manage/backPayDetail', 1, ' ', 1, 0, null, 1, 1, '2024-06-07 10:55:16', '2024-12-05 17:45:22', 9000399478, 9000398292, 0); VALUES (693, 'oms:detail_backPay_btn', '查看投诉详情', 4, 'NT_OMS_WEB', 1, 612, '528,611,612,693,', 0, '', 0, 'oms:detail_backPay_btn', 0, 1, '', 1, '/home/complain-manage/backPayDetail', 1, ' ', 1, 0, null, 1, 1, '2024-06-07 10:55:16', '2024-12-05 17:45:22', 9000399478, 9000398292, 0);
#-->SaasRoleUserRelationServiceImplTest.sql #-->RoleControllerTest.sql

View File

@ -46,4 +46,4 @@ INSERT INTO saas_role_group (id, workspace_type_code, ou_type_code, name, worksp
VALUES (57, '6', '6', 'OMS超管组', -1, -1, 0, 9, 'omsSuperAdminGroup', '', 0, '2024-04-17 11:38:28', '2024-09-10 10:18:45', '57,'); VALUES (57, '6', '6', 'OMS超管组', -1, -1, 0, 9, 'omsSuperAdminGroup', '', 0, '2024-04-17 11:38:28', '2024-09-10 10:18:45', '57,');
#-->SaasRoleUserRelationServiceImplTest.sql #-->RoleGroupControllerTest.sql

View File

@ -94,4 +94,4 @@ VALUES (469, 'oms:msgPush_page', '消息推送(新版)', 2, 'NT_OMS_WEB', 0, 76,
INSERT INTO saas_feature_resource (id, feature_code, feature_name, feature_type, terminal, component_type, parent_id, path, workspace_type, workspace_types, version, uni_code, display_order, status, icon, redirect_type, link_url, link_type, link_ext, app_item_id, sync_version, extra, auth_type, sub_auth_type, create_at, update_at, create_by, update_by, is_delete) INSERT INTO saas_feature_resource (id, feature_code, feature_name, feature_type, terminal, component_type, parent_id, path, workspace_type, workspace_types, version, uni_code, display_order, status, icon, redirect_type, link_url, link_type, link_ext, app_item_id, sync_version, extra, auth_type, sub_auth_type, create_at, update_at, create_by, update_by, is_delete)
VALUES (693, 'oms:detail_backPay_btn', '查看投诉详情', 4, 'NT_OMS_WEB', 1, 612, '528,611,612,693,', 0, '', 0, 'oms:detail_backPay_btn', 0, 1, '', 1, '/home/complain-manage/backPayDetail', 1, ' ', 1, 0, null, 1, 1, '2024-06-07 10:55:16', '2024-12-05 17:45:22', 9000399478, 9000398292, 0); VALUES (693, 'oms:detail_backPay_btn', '查看投诉详情', 4, 'NT_OMS_WEB', 1, 612, '528,611,612,693,', 0, '', 0, 'oms:detail_backPay_btn', 0, 1, '', 1, '/home/complain-manage/backPayDetail', 1, ' ', 1, 0, null, 1, 1, '2024-06-07 10:55:16', '2024-12-05 17:45:22', 9000399478, 9000398292, 0);
#-->SaasRoleUserRelationServiceImplTest.sql #-->RoleServiceTest.sql

View File

@ -22,4 +22,4 @@ VALUES (197520, 28802, 24425, 3, 24511, 3, 4, 0, 0, 0, '2024-01-18 16:36:16', '2
INSERT INTO saas_role_user_relation (id, identity_id, role_id, identity_type, natural_person_id, workspace_id, ou_id, resource_type, resource_id, is_delete, create_at, update_at, create_by, update_by, job_type) INSERT INTO saas_role_user_relation (id, identity_id, role_id, identity_type, natural_person_id, workspace_id, ou_id, resource_type, resource_id, is_delete, create_at, update_at, create_by, update_by, job_type)
VALUES (1157572, 40, 101101, 3, 2232, 3, 4, 0, 0, 0, '2024-09-27 09:39:49', '2024-09-27 09:39:48', 0, 0, 2); VALUES (1157572, 40, 101101, 3, 2232, 3, 4, 0, 0, 0, '2024-09-27 09:39:49', '2024-09-27 09:39:48', 0, 0, 2);
#-->SaasRoleUserRelationServiceImplTest.sql #-->RoleUserServiceTest.sql

View File

@ -172,4 +172,4 @@ INSERT INTO saas_page_element (id, group_code, code, name, type, link_url, termi
VALUES (369216, 'h5:cmp_user_manage_on_site_audit_page', 'h5:cmp_user_manage_on_site_audit_page', '人员管理-进场审核', 'PAGE', '__UNI__D9B0186#/pages/labour/enterAudit/index', 'NT_CMP_APP_GENERAL', '2024-08-29 09:18:42', '2024-11-28 16:09:41', 0, '', 'H5', 0, 'h5:user_manage_D9B0186', '', '__UNI__D9B0186', '人员管理H5', '{"applications": [{"type": "IOS", "minVersion": 0}, {"type": "ANDROID", "minVersion": 0}]}', null, null); VALUES (369216, 'h5:cmp_user_manage_on_site_audit_page', 'h5:cmp_user_manage_on_site_audit_page', '人员管理-进场审核', 'PAGE', '__UNI__D9B0186#/pages/labour/enterAudit/index', 'NT_CMP_APP_GENERAL', '2024-08-29 09:18:42', '2024-11-28 16:09:41', 0, '', 'H5', 0, 'h5:user_manage_D9B0186', '', '__UNI__D9B0186', '人员管理H5', '{"applications": [{"type": "IOS", "minVersion": 0}, {"type": "ANDROID", "minVersion": 0}]}', null, null);
#-->SaasRoleUserRelationServiceImplTest.sql #-->RoleUserV2ControllerTest.sql

View File

@ -0,0 +1,175 @@
#-->DEFAULT
INSERT INTO saas_role (id, NAME, description, role_type, role_code, workspace_id, owner_ou_id, product_unit_type, workspace_type, is_delete, create_at, update_at, create_by, update_by, fit_ou_type_bit, fit_ou_node_type_bit, position_template_id, project_team_manage_role_resource_id, from_pre_role_id, job_code, is_display, sort, enabled)
VALUES (101100, '超级管理员', '超级管理员', 'super_admin', 'ou_superadmin', 0, 0, 7, 1, 0, '2024-09-25 21:47:42', '2024-09-29 17:17:27', 2051297, 2051297, 1, 65535, 0, null, 0, '', 1, 0, 1);
INSERT INTO saas_role (id, NAME, description, role_type, role_code, workspace_id, owner_ou_id, product_unit_type, workspace_type, is_delete, create_at, update_at, create_by, update_by, fit_ou_type_bit, fit_ou_node_type_bit, position_template_id, project_team_manage_role_resource_id, from_pre_role_id, job_code, is_display, sort, enabled)
VALUES (101101, '超级管理员', '超级管理员', 'super_admin', 'pro_superadmin', 0, 0, 1, 2, 0, '2024-09-25 21:47:42', '2024-09-29 17:17:27', 2051297, 2051297, 1, 65535, 0, null, 0, '', 1, 0, 1);
INSERT INTO saas_role (id, NAME, description, role_type, role_code, workspace_id, owner_ou_id, product_unit_type, workspace_type, is_delete, create_at, update_at, create_by, update_by, fit_ou_type_bit, fit_ou_node_type_bit, position_template_id, project_team_manage_role_resource_id, from_pre_role_id, job_code, is_display, sort, enabled)
VALUES (101102, '超级管理员', '超级管理员', 'super_admin', 'oms_superadmin', 0, 0, 6, 6, 0, '2024-09-25 21:47:42', '2024-09-29 17:17:27', 2051297, 2051297, 1, 65535, 0, null, 0, '', 1, 0, 1);
INSERT INTO saas_role (id, NAME, description, role_type, role_code, workspace_id, owner_ou_id, product_unit_type, workspace_type, is_delete, create_at, update_at, create_by, update_by, fit_ou_type_bit, fit_ou_node_type_bit, position_template_id, project_team_manage_role_resource_id, from_pre_role_id, job_code, is_display, sort, enabled)
VALUES (101103, '超级管理员', '超级管理员', 'super_admin', 'zw_superadmin', 0, 0, 3, 3, 0, '2024-09-25 21:47:42', '2024-09-29 17:17:27', 2051297, 2051297, 1, 65535, 0, null, 0, '', 1, 0, 1);
INSERT INTO saas_role (id, NAME, description, role_type, role_code, workspace_id, owner_ou_id, product_unit_type, workspace_type, is_delete, create_at, update_at, create_by, update_by, fit_ou_type_bit, fit_ou_node_type_bit, position_template_id, project_team_manage_role_resource_id, from_pre_role_id, job_code, is_display, sort, enabled)
VALUES (100920, '工人管理', '', 'init', 'cms:zb_worker——management', -1, -1, 1, 2, 0, '2024-09-25 11:51:57', '2024-09-26 10:43:06', 154587, 154587, 1, 65535, 0, null, 0, '', 1, 4, 1);
INSERT INTO saas_role (id, NAME, description, role_type, role_code, workspace_id, owner_ou_id, product_unit_type, workspace_type, is_delete, create_at, update_at, create_by, update_by, fit_ou_type_bit, fit_ou_node_type_bit, position_template_id, project_team_manage_role_resource_id, from_pre_role_id, job_code, is_display, sort, enabled)
VALUES (100921, '查看组织架构', 'ff', 'init', 'cms:zb_org_view', -1, -1, 1, 2, 0, '2024-09-25 11:51:57', '2024-09-26 10:43:06', 154587, 154587, 1, 65535, 0, null, 0, '', 1, 5, 1);
INSERT INTO saas_role (id, NAME, description, role_type, role_code, workspace_id, owner_ou_id, product_unit_type, workspace_type, is_delete, create_at, update_at, create_by, update_by, fit_ou_type_bit, fit_ou_node_type_bit, position_template_id, project_team_manage_role_resource_id, from_pre_role_id, job_code, is_display, sort, enabled)
VALUES (100923, '查看合约', 'dd', 'init', 'cms:zb_contact_view', -1, -1, 1, 2, 0, '2024-09-25 11:51:58', '2024-09-26 10:43:06', 154587, 154587, 1, 65535, 0, null, 0, '', 1, 2, 1);
INSERT INTO saas_role_user_relation (id, identity_id, role_id, identity_type, natural_person_id, workspace_id, ou_id, resource_type, resource_id, is_delete, create_at, update_at, create_by, update_by, job_type)
VALUES (1157571, 40, 101101, 3, 2232, 8, 1, 0, 0, 0, '2024-09-27 09:39:49', '2024-09-27 09:39:48', 0, 0, 2);
INSERT INTO saas_role_user_relation (id, identity_id, role_id, identity_type, natural_person_id, workspace_id, ou_id, resource_type, resource_id, is_delete, create_at, update_at, create_by, update_by, job_type)
VALUES (1157572, 40, 101101, 3, 2232, 3, 4, 0, 0, 0, '2024-09-27 09:39:49', '2024-09-27 09:39:48', 0, 0, 2);
INSERT INTO saas_role_user_relation (id, identity_id, role_id, identity_type, natural_person_id, workspace_id, ou_id, resource_type, resource_id, is_delete, create_at, update_at, create_by, update_by, job_type)
VALUES (545048, 6, 100921, 3, 1827, 3, 4, 0, 0, 0, '2024-09-26 11:31:34', '2024-09-26 11:31:33', 0, 0, 2);
INSERT INTO saas_role_user_relation (id, identity_id, role_id, identity_type, natural_person_id, workspace_id, ou_id, resource_type, resource_id, is_delete, create_at, update_at, create_by, update_by, job_type)
VALUES (545301, 8, 100921, 3, 2107, 3, 4, 0, 0, 0, '2024-09-26 11:31:35', '2024-09-26 11:31:34', 0, 0, 2);
INSERT INTO saas_role_user_relation (id, identity_id, role_id, identity_type, natural_person_id, workspace_id, ou_id, resource_type, resource_id, is_delete, create_at, update_at, create_by, update_by, job_type)
VALUES (544214, 14, 100921, 3, 0, 3, 4, 0, 0, 0, '2024-09-26 11:31:32', '2024-09-26 11:31:32', 1, 2, 2);
INSERT INTO saas_role_user_relation (id, identity_id, role_id, identity_type, natural_person_id, workspace_id, ou_id, resource_type, resource_id, is_delete, create_at, update_at, create_by, update_by, job_type)
VALUES (545447, 17, 100921, 3, 3135, 3, 4, 0, 0, 0, '2024-09-26 11:31:35', '2024-09-26 11:31:34', 0, 0, 2);
INSERT INTO saas_role_user_relation (id, identity_id, role_id, identity_type, natural_person_id, workspace_id, ou_id, resource_type, resource_id, is_delete, create_at, update_at, create_by, update_by, job_type)
VALUES (545448, 17, 100920, 3, 3135, 3, 4, 0, 0, 0, '2024-09-26 11:31:35', '2024-09-26 11:31:34', 0, 0, 2);
INSERT INTO saas_role_user_relation (id, identity_id, role_id, identity_type, natural_person_id, workspace_id, ou_id, resource_type, resource_id, is_delete, create_at, update_at, create_by, update_by, job_type)
VALUES (544216, 18, 100921, 3, 0, 3, 4, 0, 0, 0, '2024-09-26 11:31:32', '2024-09-26 11:31:32', 0, 0, 2);
INSERT INTO saas_role_user_relation (id, identity_id, role_id, identity_type, natural_person_id, workspace_id, ou_id, resource_type, resource_id, is_delete, create_at, update_at, create_by, update_by, job_type)
VALUES (544451, 36, 100921, 3, 3470, 3, 4, 0, 0, 0, '2024-09-26 11:31:33', '2024-09-26 11:31:32', 0, 0, 2);
INSERT INTO saas_role_user_relation (id, identity_id, role_id, identity_type, natural_person_id, workspace_id, ou_id, resource_type, resource_id, is_delete, create_at, update_at, create_by, update_by, job_type)
VALUES (544452, 36, 100920, 3, 3470, 3, 4, 0, 0, 0, '2024-09-26 11:31:33', '2024-09-26 11:31:32', 0, 0, 2);
INSERT INTO saas_role_user_relation (id, identity_id, role_id, identity_type, natural_person_id, workspace_id, ou_id, resource_type, resource_id, is_delete, create_at, update_at, create_by, update_by, job_type)
VALUES (544453, 36, 100923, 3, 3470, 3, 4, 0, 0, 0, '2024-09-26 11:31:33', '2024-09-26 11:31:32', 0, 0, 2);
INSERT INTO saas_role_user_relation (id, identity_id, role_id, identity_type, natural_person_id, workspace_id, ou_id, resource_type, resource_id, is_delete, create_at, update_at, create_by, update_by, job_type)
VALUES (544687, 429, 100921, 3, 5267, 3, 4, 0, 0, 0, '2024-09-26 11:31:33', '2024-09-26 11:31:33', 0, 0, 2);
INSERT INTO saas_role_user_relation (id, identity_id, role_id, identity_type, natural_person_id, workspace_id, ou_id, resource_type, resource_id, is_delete, create_at, update_at, create_by, update_by, job_type)
VALUES (544688, 429, 100921, 3, 5267, 5, 6, 0, 0, 0, '2024-09-26 11:31:33', '2024-09-26 11:31:33', 0, 0, 2);
INSERT INTO saas_pgroup_role_relation (id, role_id, group_id, is_delete, create_at, update_at, create_by, update_by)
VALUES (2290971, 100920, 1211, 0, '2024-09-25 11:51:57', '2024-09-26 10:43:27', 154587, 154587);
INSERT INTO saas_pgroup_role_relation (id, role_id, group_id, is_delete, create_at, update_at, create_by, update_by)
VALUES (2290972, 100921, 1212, 0, '2024-09-25 11:51:57', '2024-09-26 10:43:27', 154587, 154587);
INSERT INTO saas_pgroup_role_relation (id, role_id, group_id, is_delete, create_at, update_at, create_by, update_by)
VALUES (2290974, 100923, 1214, 0, '2024-09-25 11:51:58', '2024-09-26 10:43:27', 154587, 154587);
INSERT INTO saas_pgroup_permission_relation (id, group_id, feature_id, is_delete, create_at, update_at, create_by, update_by, type, feature_type, terminal, tags)
VALUES (5208030, 1211, 101744, 0, '2024-09-25 21:34:42', '2024-11-09 08:51:59', 2051297, 2051297, 1, 4, 'NT_CMP_APP_GENERAL', '["JOINED"]');
INSERT INTO saas_pgroup_permission_relation (id, group_id, feature_id, is_delete, create_at, update_at, create_by, update_by, type, feature_type, terminal, tags)
VALUES (5208040, 1211, 101745, 0, '2024-09-25 21:34:42', '2024-11-09 08:51:59', 2051297, 2051297, 1, 4, 'NT_CMP_APP_GENERAL', '["JOINED"]');
INSERT INTO saas_pgroup_permission_relation (id, group_id, feature_id, is_delete, create_at, update_at, create_by, update_by, type, feature_type, terminal, tags)
VALUES (5208043, 1211, 101746, 0, '2024-09-25 21:34:42', '2024-11-09 08:51:59', 2051297, 2051297, 1, 4, 'NT_CMP_APP_GENERAL', '["JOINED"]');
INSERT INTO saas_pgroup_permission_relation (id, group_id, feature_id, is_delete, create_at, update_at, create_by, update_by, type, feature_type, terminal, tags)
VALUES (5208031, 1212, 101744, 0, '2024-09-25 21:34:42', '2024-11-09 08:51:59', 2051297, 2051297, 1, 4, 'NT_CMP_APP_GENERAL', '["JOINED"]');
INSERT INTO saas_pgroup_permission_relation (id, group_id, feature_id, is_delete, create_at, update_at, create_by, update_by, type, feature_type, terminal, tags)
VALUES (5208055, 1212, 101749, 0, '2024-09-25 21:34:42', '2024-11-09 08:51:59', 2051297, 2051297, 1, 4, 'NT_CMP_APP_GENERAL', '["JOINED"]');
INSERT INTO saas_pgroup_permission_relation (id, group_id, feature_id, is_delete, create_at, update_at, create_by, update_by, type, feature_type, terminal, tags)
VALUES (5205310, 1212, 100835, 0, '2024-09-25 21:34:42', '2024-11-09 08:51:59', 2051297, 9000404386, 1, 1, 'NT_CMS_WEB_GENERAL', '["JOINED"]');
INSERT INTO saas_pgroup_permission_relation (id, group_id, feature_id, is_delete, create_at, update_at, create_by, update_by, type, feature_type, terminal, tags)
VALUES (5206538, 1214, 101048, 0, '2024-09-25 21:34:42', '2024-11-09 08:51:59', 2051297, 9000404204, 1, 2, 'NT_CMS_WEB_GENERAL', '["JOINED"]');
INSERT INTO saas_pgroup_permission_relation (id, group_id, feature_id, is_delete, create_at, update_at, create_by, update_by, type, feature_type, terminal, tags)
VALUES (5206556, 1214, 101053, 0, '2024-09-25 21:34:42', '2024-11-09 08:51:59', 2051297, 9000404204, 1, 4, 'NT_CMS_WEB_GENERAL', '["JOINED"]');
INSERT INTO saas_pgroup_permission_relation (id, group_id, feature_id, is_delete, create_at, update_at, create_by, update_by, type, feature_type, terminal, tags)
VALUES (5206562, 1214, 101054, 0, '2024-09-25 21:34:42', '2024-11-09 08:51:59', 2051297, 9000404204, 1, 4, 'NT_CMS_WEB_GENERAL', '["JOINED"]');
INSERT INTO saas_feature_resource (id, feature_code, feature_name, feature_type, terminal, component_type, parent_id, path, workspace_type, workspace_types, version, uni_code, display_order, status, icon, redirect_type, link_url, link_type, link_ext, app_item_id, sync_version, extra, auth_type, sub_auth_type, create_at, update_at, create_by, update_by, is_delete)
VALUES (100835, 'cms:project_9103', '项目', 1, 'NT_CMS_WEB_GENERAL', 0, 100000, '100000,100835,', 0, '', 0, 'cms:project_9103', 1, 1, 'https://axzo-public.oss-cn-chengdu.aliyuncs.com/oms/oms/d4137963b9f54c7787afa7ef52d95540.svg', 1, '/', 0, '', 0, 0, '{"moreIcon": "https://axzo-public.oss-cn-chengdu.aliyuncs.com/oms/oms/cc474a2dc1884b6081f33d470a2e03e6.svg", "activeIcon": "https://axzo-public.oss-cn-chengdu.aliyuncs.com/oms/oms/3e69eb003de64682a2e88c4d9da5ed1d.svg"}', 0, 0, '2024-06-01 14:50:52', '2024-10-29 11:29:10', 59926, 9000404098, 0);
INSERT INTO saas_feature_resource (id, feature_code, feature_name, feature_type, terminal, component_type, parent_id, path, workspace_type, workspace_types, version, uni_code, display_order, status, icon, redirect_type, link_url, link_type, link_ext, app_item_id, sync_version, extra, auth_type, sub_auth_type, create_at, update_at, create_by, update_by, is_delete)
VALUES (101048, 'cms:pro_contract_management_7701', '合约管理', 2, 'NT_CMS_WEB_GENERAL', 0, 100883, '100000,100835,100883,101048,', 2, '2', 0, 'cms:pro_contract_management_7701', 0, 1, '', 1, '/netConstruction/construction/contract-manage', 0, '', 0, 0, null, 1, 0, '2024-06-18 16:35:35', '2024-10-21 11:24:41', 59926, 9000404204, 0);
INSERT INTO saas_feature_resource (id, feature_code, feature_name, feature_type, terminal, component_type, parent_id, path, workspace_type, workspace_types, version, uni_code, display_order, status, icon, redirect_type, link_url, link_type, link_ext, app_item_id, sync_version, extra, auth_type, sub_auth_type, create_at, update_at, create_by, update_by, is_delete)
VALUES (101053, 'cms:pro_contract_price_authority_7706', '查看合约价格信息', 4, 'NT_CMS_WEB_GENERAL', 5, 101054, '100000,100835,100883,101048,101054,101053,', 0, '', 0, 'cms:pro_contract_price_authority_7706', 4, 1, '', 1, '', 0, '', 0, 0, null, 1, 1, '2024-07-12 14:02:46', '2024-10-21 11:24:43', 59926, 9000404204, 0);
INSERT INTO saas_feature_resource (id, feature_code, feature_name, feature_type, terminal, component_type, parent_id, path, workspace_type, workspace_types, version, uni_code, display_order, status, icon, redirect_type, link_url, link_type, link_ext, app_item_id, sync_version, extra, auth_type, sub_auth_type, create_at, update_at, create_by, update_by, is_delete)
VALUES (101054, 'cms:pro_contract_detail_7707', '合约详情', 4, 'NT_CMS_WEB_GENERAL', 1, 101048, '100000,100835,100883,101048,101054,', 0, '', 0, 'cms:pro_contract_detail_7707', 3, 1, '', 1, '/', 0, '', 0, 0, null, 1, 1, '2024-07-04 16:27:16', '2024-10-21 11:24:42', 185732, 9000404204, 0);
INSERT INTO saas_feature_resource (id, feature_code, feature_name, feature_type, terminal, component_type, parent_id, path, workspace_type, workspace_types, version, uni_code, display_order, status, icon, redirect_type, link_url, link_type, link_ext, app_item_id, sync_version, extra, auth_type, sub_auth_type, create_at, update_at, create_by, update_by, is_delete)
VALUES (101744, 'cmp:pro_team_list_0443', '查看班组列表', 4, 'NT_CMP_APP_GENERAL', 5, 101741, '636,101437,101445,101573,101741,101744,', 0, '', 0, 'cmp:pro_team_list_0443', 2, 1, '', 1, '', 0, '', 0, 0, null, 1, 1, '2024-08-13 10:39:22', '2024-08-28 10:53:36', 86256, 25923, 0);
INSERT INTO saas_feature_resource (id, feature_code, feature_name, feature_type, terminal, component_type, parent_id, path, workspace_type, workspace_types, version, uni_code, display_order, status, icon, redirect_type, link_url, link_type, link_ext, app_item_id, sync_version, extra, auth_type, sub_auth_type, create_at, update_at, create_by, update_by, is_delete)
VALUES (101745, 'cmp:pro_worker_invite_recorder_0445', '查看工人入场申请', 4, 'NT_CMP_APP_GENERAL', 5, 101741, '636,101437,101445,101573,101741,101745,', 0, '', 0, 'cmp:pro_worker_invite_recorder_0445', 3, 1, '', 1, '', 0, '', 0, 0, null, 1, 1, '2024-08-13 10:40:29', '2024-08-28 10:53:36', 86256, 25923, 0);
INSERT INTO saas_feature_resource (id, feature_code, feature_name, feature_type, terminal, component_type, parent_id, path, workspace_type, workspace_types, version, uni_code, display_order, status, icon, redirect_type, link_url, link_type, link_ext, app_item_id, sync_version, extra, auth_type, sub_auth_type, create_at, update_at, create_by, update_by, is_delete)
VALUES (101746, 'cmp:pro_team_leader_invite_recorder_0446', '班组长入场申请记录', 4, 'NT_CMP_APP_GENERAL', 5, 101741, '636,101437,101445,101573,101741,101746,', 0, '', 0, 'cmp:pro_team_leader_invite_recorder_0446', 4, 1, '', 1, '', 0, '', 0, 0, null, 1, 1, '2024-08-13 10:40:50', '2024-08-28 10:53:36', 86256, 25923, 0);
INSERT INTO saas_feature_resource (id, feature_code, feature_name, feature_type, terminal, component_type, parent_id, path, workspace_type, workspace_types, version, uni_code, display_order, status, icon, redirect_type, link_url, link_type, link_ext, app_item_id, sync_version, extra, auth_type, sub_auth_type, create_at, update_at, create_by, update_by, is_delete)
VALUES (101749, 'cmp:pro_team_index_0449', '查看班组详情', 4, 'NT_CMP_APP_GENERAL', 5, 101741, '636,101437,101445,101573,101741,101749,', 0, '', 0, 'cmp:pro_team_index_0449', 7, 1, '', 1, '', 0, '', 0, 0, null, 1, 1, '2024-08-13 10:41:28', '2024-08-28 10:53:37', 86256, 25923, 0);
INSERT INTO saas_role_group_relation (id, role_id, saas_role_group_id, is_delete, create_at, update_at) VALUES (369, 100920, 104, 0, '2024-09-25 11:51:57', '2024-09-26 10:43:27');
INSERT INTO saas_role_group_relation (id, role_id, saas_role_group_id, is_delete, create_at, update_at) VALUES (370, 100921, 106, 0, '2024-09-25 11:51:57', '2024-09-26 10:43:27');
INSERT INTO saas_role_group_relation (id, role_id, saas_role_group_id, is_delete, create_at, update_at) VALUES (372, 100923, 105, 0, '2024-09-25 11:51:58', '2024-09-26 10:43:27');
INSERT INTO saas_role_group (id, workspace_type_code, ou_type_code, name, workspace_id, ou_id, parent_id, sort, code, category_code, is_delete, create_at, update_at, path)
VALUES (104, '2', '1', '组织架构', -1, -1, 14, 4, 'cms:zb_org_group', '', 0, '2024-09-25 11:51:55', '2024-09-25 11:51:55', '14,104,');
INSERT INTO saas_role_group (id, workspace_type_code, ou_type_code, name, workspace_id, ou_id, parent_id, sort, code, category_code, is_delete, create_at, update_at, path)
VALUES (105, '2', '1', '成本管理', -1, -1, 14, 5, 'cms:zb_cost_group', '', 0, '2024-09-25 11:51:55', '2024-09-25 11:51:55', '14,105,');
INSERT INTO saas_role_group (id, workspace_type_code, ou_type_code, name, workspace_id, ou_id, parent_id, sort, code, category_code, is_delete, create_at, update_at, path)
VALUES (106, '2', '1', '工人管理', -1, -1, 105, 5, 'cms:zb_cost_group2', '', 0, '2024-09-25 11:51:55', '2024-09-25 11:51:55', '14,105,106,');
INSERT INTO product_module (id, icon, product_type, product_name, dict_workspace_type_id, dict_workspace_type_code, status, common_product, remark, auth_type, ou_type, is_delete, create_by, create_at, update_at, update_by, category, version, max_person_count, max_workspace_count, price, skus, material)
VALUES (2, 'https://axzo-public.oss-cn-chengdu.aliyuncs.com/oms/test/1695286111017-Snipaste_09-13 16-24.png', 2, '项目基础', 2, '2', 1, 1, '', 1, null, 0, 0, '2022-08-17 19:46:11', '2024-12-12 15:37:27', 89601, 'GENERAL_SERVICE', 0, 0, 0, 0, NULL, NULL);
INSERT INTO saas_product_module_feature_relation (id, product_module_id, dict_code_id, dict_code, feature_id, is_delete, create_at, update_at, create_by, update_by, type, feature_type, terminal)
VALUES (1257742, 2, 7, '1', 101744, 0, '2024-08-20 17:54:00', '2024-08-20 17:54:00', 0, 0, 1, 0, '');
INSERT INTO saas_product_module_feature_relation (id, product_module_id, dict_code_id, dict_code, feature_id, is_delete, create_at, update_at, create_by, update_by, type, feature_type, terminal)
VALUES (1257743, 2, 7, '1', 101745, 0, '2024-08-20 17:54:00', '2024-08-20 17:54:00', 0, 0, 1, 0, '');
INSERT INTO saas_product_module_feature_relation (id, product_module_id, dict_code_id, dict_code, feature_id, is_delete, create_at, update_at, create_by, update_by, type, feature_type, terminal)
VALUES (1257744, 2, 7, '1', 101746, 0, '2024-08-20 17:54:00', '2024-08-20 17:54:00', 0, 0, 1, 0, '');
INSERT INTO saas_product_module_feature_relation (id, product_module_id, dict_code_id, dict_code, feature_id, is_delete, create_at, update_at, create_by, update_by, type, feature_type, terminal)
VALUES (1257745, 2, 7, '1', 4443, 0, '2024-08-20 17:54:00', '2024-08-20 17:54:00', 0, 0, 1, 0, '');
INSERT INTO saas_product_module_feature_relation (id, product_module_id, dict_code_id, dict_code, feature_id, is_delete, create_at, update_at, create_by, update_by, type, feature_type, terminal)
VALUES (1257746, 2, 7, '1', 4416, 0, '2024-08-20 17:54:00', '2024-08-20 17:54:00', 0, 0, 1, 0, '');
INSERT INTO saas_product_module_feature_relation (id, product_module_id, dict_code_id, dict_code, feature_id, is_delete, create_at, update_at, create_by, update_by, type, feature_type, terminal)
VALUES (1257747, 2, 7, '1', 4417, 0, '2024-08-20 17:54:00', '2024-08-20 17:54:00', 0, 0, 1, 0, '');
INSERT INTO saas_product_module_feature_relation (id, product_module_id, dict_code_id, dict_code, feature_id, is_delete, create_at, update_at, create_by, update_by, type, feature_type, terminal)
VALUES (1257748, 2, 7, '1', 4418, 0, '2024-08-20 17:54:00', '2024-08-20 17:54:00', 0, 0, 1, 0, '');
INSERT INTO saas_product_module_feature_relation (id, product_module_id, dict_code_id, dict_code, feature_id, is_delete, create_at, update_at, create_by, update_by, type, feature_type, terminal)
VALUES (1257749, 2, 7, '1', 4419, 0, '2024-08-20 17:54:00', '2024-08-20 17:54:00', 0, 0, 1, 0, '');
INSERT INTO saas_product_module_feature_relation (id, product_module_id, dict_code_id, dict_code, feature_id, is_delete, create_at, update_at, create_by, update_by, type, feature_type, terminal)
VALUES (1257750, 2, 7, '1', 4420, 0, '2024-08-20 17:54:00', '2024-08-20 17:54:00', 0, 0, 1, 0, '');
INSERT INTO saas_product_module_feature_relation (id, product_module_id, dict_code_id, dict_code, feature_id, is_delete, create_at, update_at, create_by, update_by, type, feature_type, terminal)
VALUES (1257751, 2, 7, '1', 912, 0, '2024-08-20 17:54:00', '2024-08-20 17:54:00', 0, 0, 1, 0, '');
INSERT INTO saas_page_element_feature_resource_relation (id, page_element_code, feature_resource_uni_code, type, terminal, create_at, update_at, create_by, update_by, is_delete)
VALUES (14744, 'cms:pro_construction_contract_management', 'cms:pro_contract_management_7701', 1, 'NT_CMS_WEB_GENERAL', '2024-07-10 20:39:15', '2024-07-10 20:39:15', null, null, 0);
INSERT INTO saas_page_element_feature_resource_relation (id, page_element_code, feature_resource_uni_code, type, terminal, create_at, update_at, create_by, update_by, is_delete)
VALUES (18070, 'cms:pro_construction_contract_management', 'cms:pro_contract_management_7701', 0, 'NT_CMS_WEB_GENERAL', '2024-07-16 09:56:12', '2024-07-16 09:56:11', 25923, null, 0);
INSERT INTO saas_page_element_feature_resource_relation (id, page_element_code, feature_resource_uni_code, type, terminal, create_at, update_at, create_by, update_by, is_delete)
VALUES (18079, 'cms:pro_construction_contract_detail', 'cms:pro_contract_detail_7707', 0, 'NT_CMS_WEB_GENERAL', '2024-07-16 09:56:12', '2024-07-16 09:56:11', 25923, null, 0);
INSERT INTO saas_page_element_feature_resource_relation (id, page_element_code, feature_resource_uni_code, type, terminal, create_at, update_at, create_by, update_by, is_delete)
VALUES (18080, 'cms:pro_construction_contract_detail_inventory_submit_audit', 'cms:pro_contract_detail_7707', 0, 'NT_CMS_WEB_GENERAL', '2024-07-16 09:56:12', '2024-07-16 09:56:11', 25923, null, 0);
INSERT INTO saas_page_element_feature_resource_relation (id, page_element_code, feature_resource_uni_code, type, terminal, create_at, update_at, create_by, update_by, is_delete)
VALUES (24219, 'h5:cmp_user_manage_worker_jump_to_team_btn', 'cmp:pro_team_list_0443', 0, 'NT_CMP_APP_GENERAL', '2024-08-28 10:53:36', '2024-08-28 10:53:36', 25923, null, 0);
INSERT INTO saas_page_element_feature_resource_relation (id, page_element_code, feature_resource_uni_code, type, terminal, create_at, update_at, create_by, update_by, is_delete)
VALUES (24220, 'h5:cmp_user_manage_worker_page', 'cmp:pro_team_list_0443', 0, 'NT_CMP_APP_GENERAL', '2024-08-28 10:53:36', '2024-08-28 10:53:36', 25923, null, 0);
INSERT INTO saas_page_element_feature_resource_relation (id, page_element_code, feature_resource_uni_code, type, terminal, create_at, update_at, create_by, update_by, is_delete)
VALUES (24221, 'h5:cmp_user_manage_worker_labor_audit_btn', 'cmp:pro_worker_invite_recorder_0445', 0, 'NT_CMP_APP_GENERAL', '2024-08-28 10:53:36', '2024-08-28 10:53:36', 25923, null, 0);
INSERT INTO saas_page_element_feature_resource_relation (id, page_element_code, feature_resource_uni_code, type, terminal, create_at, update_at, create_by, update_by, is_delete)
VALUES (24222, 'h5:cmp_user_manage_worker_page', 'cmp:pro_worker_invite_recorder_0445', 0, 'NT_CMP_APP_GENERAL', '2024-08-28 10:53:36', '2024-08-28 10:53:36', 25923, null, 0);
INSERT INTO saas_page_element_feature_resource_relation (id, page_element_code, feature_resource_uni_code, type, terminal, create_at, update_at, create_by, update_by, is_delete)
VALUES (24223, 'h5:cmp_user_manage_labor_audit_page', 'cmp:pro_worker_invite_recorder_0445', 0, 'NT_CMP_APP_GENERAL', '2024-08-28 10:53:36', '2024-08-28 10:53:36', 25923, null, 0);
INSERT INTO saas_page_element_feature_resource_relation (id, page_element_code, feature_resource_uni_code, type, terminal, create_at, update_at, create_by, update_by, is_delete)
VALUES (24224, 'h5:cmp_user_manage_labor_audit_detail_btn', 'cmp:pro_worker_invite_recorder_0445', 0, 'NT_CMP_APP_GENERAL', '2024-08-28 10:53:36', '2024-08-28 10:53:36', 25923, null, 0);
INSERT INTO saas_page_element_feature_resource_relation (id, page_element_code, feature_resource_uni_code, type, terminal, create_at, update_at, create_by, update_by, is_delete)
VALUES (24225, 'h5:cmp_user_manage_worker_on_site_audit_btn', 'cmp:pro_team_leader_invite_recorder_0446', 0, 'NT_CMP_APP_GENERAL', '2024-08-28 10:53:36', '2024-08-28 10:53:36', 25923, null, 0);
INSERT INTO saas_page_element (id, group_code, code, name, type, link_url, terminal, create_at, update_at, is_delete, create_name, app_type, version, item_code, link_ext, app_id, item_name, ext, create_by, update_by)
VALUES (718447, 'cms:pro_construction_contract_management', 'cms:pro_construction_contract_management', '合约管理', 'PAGE', '/netConstruction/construction/contract-manage', 'NT_CMS_WEB_GENERAL', '2024-10-29 15:07:38', '2024-12-03 14:55:23', 0, '杜才伟-18682489918', 'PC', 0, 'CMS_COMMON', '', '', '单位组织', '{"applications": [{"type": "IOS", "minVersion": 0}, {"type": "ANDROID", "minVersion": 0}]}', null, 9000404098);
INSERT INTO saas_page_element (id, group_code, code, name, type, link_url, terminal, create_at, update_at, is_delete, create_name, app_type, version, item_code, link_ext, app_id, item_name, ext, create_by, update_by)
VALUES (718451, 'cms:pro_construction_contract_detail', 'cms:pro_construction_contract_detail', '合约详情', 'PAGE', '/netConstruction/construction/contract-manage/contract-detail', 'NT_CMS_WEB_GENERAL', '2024-10-29 15:07:38', '2024-12-03 14:55:23', 0, '杜才伟-18682489918', 'PC', 0, 'CMS_COMMON', '', '', '单位组织', '{"applications": [{"type": "IOS", "minVersion": 0}, {"type": "ANDROID", "minVersion": 0}]}', null, 9000404098);
INSERT INTO saas_page_element (id, group_code, code, name, type, link_url, terminal, create_at, update_at, is_delete, create_name, app_type, version, item_code, link_ext, app_id, item_name, ext, create_by, update_by)
VALUES (718455, 'cms:pro_construction_contract_detail', 'cms:pro_construction_contract_detail_inventory_submit_audit', '合约详情-提交审批', 'COMPONENT', '', 'NT_CMS_WEB_GENERAL', '2024-10-29 15:07:38', '2024-12-03 14:55:25', 0, '杜才伟-18682489918', 'PC', 0, 'CMS_COMMON', '', '', '单位组织', '{"applications": [{"type": "IOS", "minVersion": 0}, {"type": "ANDROID", "minVersion": 0}]}', null, 9000404098);
INSERT INTO saas_page_element (id, group_code, code, name, type, link_url, terminal, create_at, update_at, is_delete, create_name, app_type, version, item_code, link_ext, app_id, item_name, ext, create_by, update_by)
VALUES (369205, 'h5:cmp_user_manage_worker_page', 'h5:cmp_user_manage_worker_jump_to_team_btn', '人员管理-施工人员-跳转班组', 'COMPONENT', '', 'NT_CMP_APP_GENERAL', '2024-08-29 09:18:41', '2024-11-28 16:09:41', 0, '', 'H5', 0, 'h5:user_manage_D9B0186', '', '__UNI__D9B0186', '人员管理H5', '{"applications": [{"type": "IOS", "minVersion": 0}, {"type": "ANDROID", "minVersion": 0}]}', null, null);
INSERT INTO saas_page_element (id, group_code, code, name, type, link_url, terminal, create_at, update_at, is_delete, create_name, app_type, version, item_code, link_ext, app_id, item_name, ext, create_by, update_by)
VALUES (369197, 'h5:cmp_user_manage_worker_page', 'h5:cmp_user_manage_worker_page', '人员管理-施工人员', 'PAGE', '__UNI__D9B0186#/pages/worker/index', 'NT_CMP_APP_GENERAL', '2024-08-29 09:18:40', '2024-11-28 16:09:41', 0, '', 'H5', 0, 'h5:user_manage_D9B0186', '', '__UNI__D9B0186', '人员管理H5', '{"applications": [{"type": "IOS", "minVersion": 0}, {"type": "ANDROID", "minVersion": 0}]}', null, null);
INSERT INTO saas_page_element (id, group_code, code, name, type, link_url, terminal, create_at, update_at, is_delete, create_name, app_type, version, item_code, link_ext, app_id, item_name, ext, create_by, update_by)
VALUES (369202, 'h5:cmp_user_manage_worker_page', 'h5:cmp_user_manage_worker_labor_audit_btn', '人员管理-施工人员-劳务审核', 'COMPONENT', '', 'NT_CMP_APP_GENERAL', '2024-08-29 09:18:41', '2024-11-28 16:09:41', 0, '', 'H5', 0, 'h5:user_manage_D9B0186', '', '__UNI__D9B0186', '人员管理H5', '{"applications": [{"type": "IOS", "minVersion": 0}, {"type": "ANDROID", "minVersion": 0}]}', null, null);
INSERT INTO saas_page_element (id, group_code, code, name, type, link_url, terminal, create_at, update_at, is_delete, create_name, app_type, version, item_code, link_ext, app_id, item_name, ext, create_by, update_by)
VALUES (369218, 'h5:cmp_user_manage_labor_audit_page', 'h5:cmp_user_manage_labor_audit_page', '人员管理-劳务审核', 'PAGE', '__UNI__D9B0186#/pages/labour/verify/index', 'NT_CMP_APP_GENERAL', '2024-08-29 09:18:42', '2024-11-28 16:09:41', 0, '', 'H5', 0, 'h5:user_manage_D9B0186', '', '__UNI__D9B0186', '人员管理H5', '{"applications": [{"type": "IOS", "minVersion": 0}, {"type": "ANDROID", "minVersion": 0}]}', null, null);
INSERT INTO saas_page_element (id, group_code, code, name, type, link_url, terminal, create_at, update_at, is_delete, create_name, app_type, version, item_code, link_ext, app_id, item_name, ext, create_by, update_by)
VALUES (369219, 'h5:cmp_user_manage_labor_audit_page', 'h5:cmp_user_manage_labor_audit_detail_btn', '人员管理-劳务审核-详情', 'COMPONENT', '', 'NT_CMP_APP_GENERAL', '2024-08-29 09:18:42', '2024-11-28 16:09:41', 0, '', 'H5', 0, 'h5:user_manage_D9B0186', '', '__UNI__D9B0186', '人员管理H5', '{"applications": [{"type": "IOS", "minVersion": 0}, {"type": "ANDROID", "minVersion": 0}]}', null, null);
INSERT INTO saas_page_element (id, group_code, code, name, type, link_url, terminal, create_at, update_at, is_delete, create_name, app_type, version, item_code, link_ext, app_id, item_name, ext, create_by, update_by)
VALUES (369203, 'h5:cmp_user_manage_worker_page', 'h5:cmp_user_manage_worker_on_site_audit_btn', '人员管理-施工人员-进场审核', 'COMPONENT', '', 'NT_CMP_APP_GENERAL', '2024-08-29 09:18:41', '2024-11-28 16:09:41', 0, '', 'H5', 0, 'h5:user_manage_D9B0186', '', '__UNI__D9B0186', '人员管理H5', '{"applications": [{"type": "IOS", "minVersion": 0}, {"type": "ANDROID", "minVersion": 0}]}', null, null);
INSERT INTO saas_page_element (id, group_code, code, name, type, link_url, terminal, create_at, update_at, is_delete, create_name, app_type, version, item_code, link_ext, app_id, item_name, ext, create_by, update_by)
VALUES (369216, 'h5:cmp_user_manage_on_site_audit_page', 'h5:cmp_user_manage_on_site_audit_page', '人员管理-进场审核', 'PAGE', '__UNI__D9B0186#/pages/labour/enterAudit/index', 'NT_CMP_APP_GENERAL', '2024-08-29 09:18:42', '2024-11-28 16:09:41', 0, '', 'H5', 0, 'h5:user_manage_D9B0186', '', '__UNI__D9B0186', '人员管理H5', '{"applications": [{"type": "IOS", "minVersion": 0}, {"type": "ANDROID", "minVersion": 0}]}', null, null);
#-->UserPermissionControllerTest.sql