diff --git a/backend/src/main/java/io/metersphere/controller/GroupController.java b/backend/src/main/java/io/metersphere/controller/GroupController.java index d10d63f0ed..0af578080a 100644 --- a/backend/src/main/java/io/metersphere/controller/GroupController.java +++ b/backend/src/main/java/io/metersphere/controller/GroupController.java @@ -4,6 +4,7 @@ import io.metersphere.base.domain.Group; import io.metersphere.commons.utils.Pager; import io.metersphere.controller.request.group.EditGroupRequest; import io.metersphere.dto.GroupDTO; +import io.metersphere.dto.GroupPermissionDTO; import io.metersphere.service.GroupService; import org.springframework.web.bind.annotation.*; @@ -40,4 +41,9 @@ public class GroupController { groupService.deleteGroup(id); } + @GetMapping("/permission") + public GroupPermissionDTO getGroupResource() { + return groupService.getGroupResource(); + } + } diff --git a/backend/src/main/java/io/metersphere/dto/GroupJson.java b/backend/src/main/java/io/metersphere/dto/GroupJson.java new file mode 100644 index 0000000000..63d07899a1 --- /dev/null +++ b/backend/src/main/java/io/metersphere/dto/GroupJson.java @@ -0,0 +1,12 @@ +package io.metersphere.dto; + + +import lombok.Data; + +import java.util.List; + +@Data +public class GroupJson { + private List resource; + private List permissions; +} diff --git a/backend/src/main/java/io/metersphere/dto/GroupPermission.java b/backend/src/main/java/io/metersphere/dto/GroupPermission.java new file mode 100644 index 0000000000..423893bef7 --- /dev/null +++ b/backend/src/main/java/io/metersphere/dto/GroupPermission.java @@ -0,0 +1,10 @@ +package io.metersphere.dto; + +import lombok.Data; + +@Data +public class GroupPermission { + private String id; + private String name; + private String resourceId; +} diff --git a/backend/src/main/java/io/metersphere/dto/GroupPermissionDTO.java b/backend/src/main/java/io/metersphere/dto/GroupPermissionDTO.java new file mode 100644 index 0000000000..acb2a4531e --- /dev/null +++ b/backend/src/main/java/io/metersphere/dto/GroupPermissionDTO.java @@ -0,0 +1,13 @@ +package io.metersphere.dto; + +import lombok.Data; + +import java.util.List; + +@Data +public class GroupPermissionDTO { + private List system; + private List organization; + private List workspace; + private List project; +} diff --git a/backend/src/main/java/io/metersphere/dto/GroupResource.java b/backend/src/main/java/io/metersphere/dto/GroupResource.java new file mode 100644 index 0000000000..061954c7e6 --- /dev/null +++ b/backend/src/main/java/io/metersphere/dto/GroupResource.java @@ -0,0 +1,9 @@ +package io.metersphere.dto; + +import lombok.Data; + +@Data +public class GroupResource { + private String id; + private String name; +} diff --git a/backend/src/main/java/io/metersphere/dto/GroupResourceDTO.java b/backend/src/main/java/io/metersphere/dto/GroupResourceDTO.java new file mode 100644 index 0000000000..5feee81462 --- /dev/null +++ b/backend/src/main/java/io/metersphere/dto/GroupResourceDTO.java @@ -0,0 +1,11 @@ +package io.metersphere.dto; + +import lombok.Data; + +import java.util.List; + +@Data +public class GroupResourceDTO { + private GroupResource resource; + private List permissions; +} diff --git a/backend/src/main/java/io/metersphere/service/GroupService.java b/backend/src/main/java/io/metersphere/service/GroupService.java index c6a6ed02c1..8d36891aba 100644 --- a/backend/src/main/java/io/metersphere/service/GroupService.java +++ b/backend/src/main/java/io/metersphere/service/GroupService.java @@ -1,5 +1,7 @@ package io.metersphere.service; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import io.metersphere.base.domain.*; @@ -13,18 +15,16 @@ import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.Pager; import io.metersphere.commons.utils.SessionUtils; import io.metersphere.controller.request.group.EditGroupRequest; -import io.metersphere.dto.GroupDTO; -import io.metersphere.dto.UserGroupDTO; -import org.apache.commons.collections.CollectionUtils; +import io.metersphere.dto.*; import org.apache.commons.lang3.BooleanUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.UUID; +import java.io.IOException; +import java.io.InputStream; +import java.util.*; import java.util.stream.Collectors; @Service @@ -78,8 +78,43 @@ public class GroupService { // todo use_group 关系 } + public GroupPermissionDTO getGroupResource() { + GroupPermissionDTO dto = new GroupPermissionDTO(); + InputStream permission = getClass().getResourceAsStream("/permission.json"); + if (permission == null) { + throw new RuntimeException("读取文件失败"); + } else { + GroupJson group = null; + try { + group = JSON.parseObject(permission, GroupJson.class); + List resource = group.getResource(); + List permissions = group.getPermissions(); + dto.setSystem(getResourcePermission(resource, permissions, "SYSTEM")); + dto.setOrganization(getResourcePermission(resource, permissions, "ORGANIZATION")); + dto.setWorkspace(getResourcePermission(resource, permissions, "WORKSPACE")); + dto.setProject(getResourcePermission(resource, permissions, "PROJECT")); + } catch (IOException e) { + e.printStackTrace(); + } + } + return dto; + } - + private List getResourcePermission(List resource, List permissions, String type) { + List dto = new ArrayList<>(); + List resources = resource.stream().filter(g -> g.getId().startsWith(type)).collect(Collectors.toList()); + for (GroupResource r : resources) { + GroupResourceDTO resourceDTO = new GroupResourceDTO(); + resourceDTO.setResource(r); + List collect = permissions + .stream() + .filter(p -> StringUtils.equals(r.getId(), p.getResourceId())) + .collect(Collectors.toList()); + resourceDTO.setPermissions(collect); + dto.add(resourceDTO); + } + return dto; + } private Pager> getGroups(List groupTypeList, EditGroupRequest request) { if (groupTypeList.contains(UserGroupType.SYSTEM)) { @@ -131,5 +166,4 @@ public class GroupService { return PageUtils.setPageInfo(page, groups); } - } diff --git a/backend/src/main/resources/permission.json b/backend/src/main/resources/permission.json new file mode 100644 index 0000000000..beb4b84aea --- /dev/null +++ b/backend/src/main/resources/permission.json @@ -0,0 +1,730 @@ +{ + "permissions": [ + { + "id": "SYSTEM_USER:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_USER" + }, + { + "id": "SYSTEM_USER:READ+CREATE", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_USER" + }, + { + "id": "SYSTEM_USER:READ+IMPORT", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_USER" + }, + { + "id": "SYSTEM_USER:READ+EDIT", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_USER" + }, { + "id": "SYSTEM_USER:READ+DELETE", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_USER" + }, + { + "id": "SYSTEM_USER:READ+EDIT_PASSWORD", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_USER" + }, + { + "id": "SYSTEM_ORGANIZATION:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_ORGANIZATION" + }, + { + "id": "SYSTEM_ORGANIZATION:READ+CREATE", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_ORGANIZATION" + }, + { + "id": "SYSTEM_ORGANIZATION:READ+EDIT", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_ORGANIZATION" + }, + { + "id": "SYSTEM_ORGANIZATION:READ+DELETE", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_ORGANIZATION" + }, + { + "id": "SYSTEM_WORKSPACE:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_WORKSPACE" + }, + { + "id": "SYSTEM_WORKSPACE:READ+CREATE", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_WORKSPACE" + }, + { + "id": "SYSTEM_WORKSPACE:READ+EDIT", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_WORKSPACE" + }, + { + "id": "SYSTEM_WORKSPACE:READ+DELETE", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_WORKSPACE" + }, + { + "id": "SYSTEM_GROUP:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_GROUP" + }, + { + "id": "SYSTEM_GROUP:READ+CREATE", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_GROUP" + }, + { + "id": "SYSTEM_GROUP:READ+EDIT", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_GROUP" + }, + { + "id": "SYSTEM_GROUP:READ+SETTING_PERMISSION", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_GROUP" + }, + { + "id": "SYSTEM_GROUP:READ+DELETE", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_GROUP" + }, + { + "id": "SYSTEM_SETTING:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_SETTING" + }, + { + "id": "SYSTEM_SETTING:READ+EDIT", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_SETTING" + }, + { + "id": "SYSTEM_SETTING:READ+AUTH_MANAGE", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_SETTING" + }, + { + "id": "SYSTEM_QUOTA:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_QUOTA" + }, + { + "id": "SYSTEM_QUOTA:READ+EDIT", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_QUOTA" + }, + { + "id": "SYSTEM_AUTH:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_AUTH" + }, + { + "id": "SYSTEM_AUTH:READ+EDIT", + "name": "$[{i18n_view_overview}]", + "resourceId": "SYSTEM_AUTH" + }, + { + "id": "ORGANIZATION_USER:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "ORGANIZATION_USER" + }, + { + "id": "ORGANIZATION_USER:READ+CREATE", + "name": "$[{i18n_view_overview}]", + "resourceId": "ORGANIZATION_USER" + }, + { + "id": "ORGANIZATION_USER:READ+EDIT", + "name": "$[{i18n_view_overview}]", + "resourceId": "ORGANIZATION_USER" + }, + { + "id": "ORGANIZATION_USER:READ+DELETE", + "name": "$[{i18n_view_overview}]", + "resourceId": "ORGANIZATION_USER" + }, + { + "id": "ORGANIZATION_WORKSPACE:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "ORGANIZATION_WORKSPACE" + }, + { + "id": "ORGANIZATION_WORKSPACE:READ+CREATE", + "name": "$[{i18n_view_overview}]", + "resourceId": "ORGANIZATION_WORKSPACE" + }, + { + "id": "ORGANIZATION_WORKSPACE:READ+EDIT", + "name": "$[{i18n_view_overview}]", + "resourceId": "ORGANIZATION_WORKSPACE" + }, + { + "id": "ORGANIZATION_WORKSPACE:READ+DELETE", + "name": "$[{i18n_view_overview}]", + "resourceId": "ORGANIZATION_WORKSPACE" + }, + { + "id": "ORGANIZATION_GROUP:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "ORGANIZATION_GROUP" + }, + { + "id": "ORGANIZATION_GROUP:READ+CREATE", + "name": "$[{i18n_view_overview}]", + "resourceId": "ORGANIZATION_GROUP" + }, + { + "id": "ORGANIZATION_GROUP:READ+EDIT", + "name": "$[{i18n_view_overview}]", + "resourceId": "ORGANIZATION_GROUP" + }, + { + "id": "ORGANIZATION_GROUP:READ+SETTING_PERMISSION", + "name": "$[{i18n_view_overview}]", + "resourceId": "ORGANIZATION_GROUP" + }, + { + "id": "ORGANIZATION_GROUP:READ+DELETE", + "name": "$[{i18n_view_overview}]", + "resourceId": "ORGANIZATION_GROUP" + }, + { + "id": "ORGANIZATION_SERVICE:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "ORGANIZATION_SERVICE" + }, + { + "id": "ORGANIZATION_SERVICE:READ+EDIT", + "name": "$[{i18n_view_overview}]", + "resourceId": "ORGANIZATION_SERVICE" + }, + { + "id": "ORGANIZATION_MESSAGE:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "ORGANIZATION_MESSAGE" + }, + { + "id": "ORGANIZATION_MESSAGE:READ+EDIT", + "name": "$[{i18n_view_overview}]", + "resourceId": "ORGANIZATION_MESSAGE" + }, + { + "id": "WORKSPACE_USER:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "WORKSPACE_USER" + }, + { + "id": "WORKSPACE_USER:READ+CREATE", + "name": "$[{i18n_view_overview}]", + "resourceId": "WORKSPACE_USER" + }, + { + "id": "WORKSPACE_USER:READ+EDIT", + "name": "$[{i18n_view_overview}]", + "resourceId": "WORKSPACE_USER" + }, + { + "id": "WORKSPACE_USER:READ+DELETE", + "name": "$[{i18n_view_overview}]", + "resourceId": "WORKSPACE_USER" + }, + { + "id": "WORKSPACE_TEMPLATE:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "WORKSPACE_TEMPLATE" + }, + { + "id": "WORKSPACE_TEMPLATE:READ+CUSTOM", + "name": "$[{i18n_view_overview}]", + "resourceId": "WORKSPACE_TEMPLATE" + }, + { + "id": "WORKSPACE_TEMPLATE:READ+CASE_TEMPLATE", + "name": "$[{i18n_view_overview}]", + "resourceId": "WORKSPACE_TEMPLATE" + }, + { + "id": "WORKSPACE_TEMPLATE:READ+ISSUE_TEMPLATE", + "name": "$[{i18n_view_overview}]", + "resourceId": "WORKSPACE_TEMPLATE" + }, + { + "id": "WORKSPACE_TEMPLATE:READ+REPORT_TEMPLATE", + "name": "$[{i18n_view_overview}]", + "resourceId": "WORKSPACE_TEMPLATE" + }, + { + "id": "PROJECT_USER:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_USER" + }, + { + "id": "PROJECT_USER:READ+CREATE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_USER" + }, + { + "id": "PROJECT_USER:READ+EDIT", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_USER" + }, + { + "id": "PROJECT_USER:READ+DELETE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_USER" + }, + { + "id": "PROJECT_MANAGER:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_MANAGER" + }, + { + "id": "PROJECT_MANAGER:READ+CREATE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_MANAGER" + }, + { + "id": "PROJECT_MANAGER:READ+EDIT", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_MANAGER" + }, + { + "id": "PROJECT_MANAGER:READ+DELETE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_MANAGER" + }, + { + "id": "PROJECT_ENVIRONMENT:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_ENVIRONMENT" + }, + { + "id": "PROJECT_ENVIRONMENT:READ+CREATE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_ENVIRONMENT" + }, + { + "id": "PROJECT_ENVIRONMENT:READ+EDIT", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_ENVIRONMENT" + }, + { + "id": "PROJECT_ENVIRONMENT:READ+DELETE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_ENVIRONMENT" + }, + { + "id": "PROJECT_ENVIRONMENT:READ+COPY", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_ENVIRONMENT" + }, + { + "id": "PROJECT_ENVIRONMENT:READ+IMPORT", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_ENVIRONMENT" + }, + { + "id": "PROJECT_ENVIRONMENT:READ+EXPORT", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_ENVIRONMENT" + }, + { + "id": "PROJECT_TRACK_CASE:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_TRACK_CASE" + }, + { + "id": "PROJECT_TRACK_CASE:READ+CREATE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_TRACK_CASE" + }, + { + "id": "PROJECT_TRACK_CASE:READ+EDIT", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_TRACK_CASE" + }, + { + "id": "PROJECT_TRACK_CASE:READ+DELETE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_TRACK_CASE" + }, + { + "id": "PROJECT_TRACK_CASE:READ+COPY", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_TRACK_CASE" + }, + { + "id": "PROJECT_TRACK_CASE:READ+IMPORT", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_TRACK_CASE" + }, + { + "id": "PROJECT_TRACK_CASE:READ+EXPORT", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_TRACK_CASE" + }, + { + "id": "PROJECT_TRACK_REVIEW:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_TRACK_REVIEW" + }, + { + "id": "PROJECT_TRACK_REVIEW:READ+CREATE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_TRACK_REVIEW" + }, + { + "id": "PROJECT_TRACK_REVIEW:READ+EDIT", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_TRACK_REVIEW" + }, + { + "id": "PROJECT_TRACK_REVIEW:READ+DELETE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_TRACK_REVIEW" + }, + { + "id": "PROJECT_TRACK_REVIEW:READ+RELEVANCE_OR_CANCEL", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_TRACK_REVIEW" + }, + { + "id": "PROJECT_TRACK_REVIEW:READ+REVIEW", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_TRACK_REVIEW" + }, + { + "id": "PROJECT_TRACK_REVIEW:READ+COMMENT", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_TRACK_REVIEW" + }, + { + "id": "PROJECT_TRACK_PLAN:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_TRACK_PLAN" + }, + { + "id": "PROJECT_TRACK_PLAN:READ+CREATE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_TRACK_PLAN" + }, + { + "id": "PROJECT_TRACK_PLAN:READ+EDIT", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_TRACK_PLAN" + }, + { + "id": "PROJECT_TRACK_PLAN:READ+DELETE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_TRACK_PLAN" + }, + { + "id": "PROJECT_TRACK_PLAN:READ+SCHEDULE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_TRACK_PLAN" + }, + { + "id": "PROJECT_TRACK_PLAN:READ+RELEVANCE_OR_CANCEL", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_TRACK_PLAN" + }, + { + "id": "PROJECT_API_DEFINITION:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_DEFINITION" + }, + { + "id": "PROJECT_API_DEFINITION:READ+CREATE_API", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_DEFINITION" + }, + { + "id": "PROJECT_API_DEFINITION:READ+EDIT_API", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_DEFINITION" + }, + { + "id": "PROJECT_API_DEFINITION:READ+DELETE_API", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_DEFINITION" + }, + { + "id": "PROJECT_API_DEFINITION:READ+CREATE_CASE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_DEFINITION" + }, + { + "id": "PROJECT_API_DEFINITION:READ+EDIT_CASE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_DEFINITION" + }, + { + "id": "PROJECT_API_DEFINITION:READ+DELETE_CASE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_DEFINITION" + }, + { + "id": "PROJECT_API_DEFINITION:READ+COPY_CASE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_DEFINITION" + }, + { + "id": "PROJECT_API_DEFINITION:READ+CREATE_PERFORMANCE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_DEFINITION" + }, + { + "id": "PROJECT_API_DEFINITION:READ+CREATE_PERFORMANCE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_DEFINITION" + }, + { + "id": "PROJECT_API_DEFINITION:READ+RUN", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_DEFINITION" + }, + { + "id": "PROJECT_API_DEFINITION:READ+DEBUG", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_DEFINITION" + }, + { + "id": "PROJECT_API_DEFINITION:READ+MOCK", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_DEFINITION" + }, + { + "id": "PROJECT_API_DEFINITION:READ+IMPORT_API", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_DEFINITION" + }, + { + "id": "PROJECT_API_DEFINITION:READ+EXPORT_API", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_DEFINITION" + }, + { + "id": "PROJECT_API_SCENARIO:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_SCENARIO" + }, + { + "id": "PROJECT_API_SCENARIO:READ+CREATE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_SCENARIO" + }, + { + "id": "PROJECT_API_SCENARIO:READ+EDIT", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_SCENARIO" + }, + { + "id": "PROJECT_API_SCENARIO:READ+DELETE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_SCENARIO" + }, + { + "id": "PROJECT_API_SCENARIO:READ+COPY", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_SCENARIO" + }, + { + "id": "PROJECT_API_SCENARIO:READ+RUN", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_SCENARIO" + }, + { + "id": "PROJECT_API_SCENARIO:READ+DEBUG", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_SCENARIO" + }, + { + "id": "PROJECT_API_SCENARIO:READ+SCHEDULE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_SCENARIO" + }, + { + "id": "PROJECT_API_SCENARIO:READ+CREATE_PERFORMANCE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_SCENARIO" + }, + { + "id": "PROJECT_API_SCENARIO:READ+IMPORT_SCENARIO", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_SCENARIO" + }, + { + "id": "PROJECT_API_SCENARIO:READ+EXPORT_SCENARIO", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_SCENARIO" + }, + { + "id": "PROJECT_API_SCENARIO:READ+MOVE_BATCH", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_SCENARIO" + }, + { + "id": "PROJECT_API_REPORT:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_REPORT" + }, + { + "id": "PROJECT_API_REPORT:READ+DELETE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_API_REPORT" + }, + { + "id": "PROJECT_PERFORMANCE_TEST:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_PERFORMANCE_TEST" + }, + { + "id": "PROJECT_PERFORMANCE_TEST:READ+CREATE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_PERFORMANCE_TEST" + }, + { + "id": "PROJECT_PERFORMANCE_TEST:READ+EDIT", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_PERFORMANCE_TEST" + }, + { + "id": "PROJECT_PERFORMANCE_TEST:READ+DELETE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_PERFORMANCE_TEST" + }, + { + "id": "PROJECT_PERFORMANCE_TEST:READ+COPY", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_PERFORMANCE_TEST" + }, + { + "id": "PROJECT_PERFORMANCE_TEST:READ+RUN", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_PERFORMANCE_TEST" + }, + { + "id": "PROJECT_PERFORMANCE_TEST:READ+SCHEDULE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_PERFORMANCE_TEST" + }, + { + "id": "PROJECT_PERFORMANCE_REPORT:READ", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_PERFORMANCE_REPORT" + }, + { + "id": "PROJECT_PERFORMANCE_REPORT:READ+DELETE", + "name": "$[{i18n_view_overview}]", + "resourceId": "PROJECT_PERFORMANCE_REPORT" + } + ], + "resource": [ + { + "id": "SYSTEM_USER", + "name": "用户" + }, + { + "id": "SYSTEM_ORGANIZATION", + "name": "组织" + }, + { + "id": "SYSTEM_WORKSPACE", + "name": "工作空间" + }, + { + "id": "SYSTEM_GROUP", + "name": "用户组与权限" + }, + { + "id": "SYSTEM_SETTING", + "name": "系统参数设置" + }, + { + "id": "SYSTEM_QUOTA", + "name": "配额管理" + }, + { + "id": "SYSTEM_AUTH", + "name": "授权管理" + }, + { + "id": "ORGANIZATION_USER", + "name": "成员" + }, + { + "id": "ORGANIZATION_WORKSPACE", + "name": "工作空间" + }, + { + "id": "ORGANIZATION_GROUP", + "name": "用户组与权限" + }, + { + "id": "ORGANIZATION_SERVICE", + "name": "服务集成" + }, + { + "id": "ORGANIZATION_MESSAGE", + "name": "消息设置" + }, + { + "id": "WORKSPACE_USER", + "name": "成员" + }, + { + "id": "WORKSPACE_TEMPLATE", + "name": "模版设置" + }, + { + "id": "PROJECT_USER", + "name": "成员" + }, + { + "id": "PROJECT_MANAGER", + "name": "项目管理" + }, + { + "id": "PROJECT_ENVIRONMENT", + "name": "环境设置" + }, + { + "id": "PROJECT_TRACK_CASE", + "name": "测试用例" + }, + { + "id": "PROJECT_TRACK_REVIEW", + "name": "测试评审" + }, + { + "id": "PROJECT_TRACK_PLAN", + "name": "测试计划" + }, + { + "id": "PROJECT_API_DEFINITION", + "name": "接口定义" + }, + { + "id": "PROJECT_API_SCENARIO", + "name": "接口自动化" + }, + { + "id": "PROJECT_API_REPORT", + "name": "测试报告" + }, + { + "id": "PROJECT_PERFORMANCE_TEST", + "name": "测试" + }, + { + "id": "PROJECT_PERFORMANCE_REPORT", + "name": "报告" + } + ] +} \ No newline at end of file diff --git a/frontend/src/business/components/settings/router.js b/frontend/src/business/components/settings/router.js index 746b50a887..e1946f011b 100644 --- a/frontend/src/business/components/settings/router.js +++ b/frontend/src/business/components/settings/router.js @@ -19,7 +19,7 @@ export default { }, { path: 'usergroup', - component: () => import('@/business/components/settings/system/UserGroup'), + component: () => import('@/business/components/settings/system/group/UserGroup'), meta: {system: true, title: '用户组与权限'} }, { diff --git a/frontend/src/business/components/settings/system/group/EditPermission.vue b/frontend/src/business/components/settings/system/group/EditPermission.vue new file mode 100644 index 0000000000..8ee2a9fa35 --- /dev/null +++ b/frontend/src/business/components/settings/system/group/EditPermission.vue @@ -0,0 +1,79 @@ + + + + + diff --git a/frontend/src/business/components/settings/system/EditUserGroup.vue b/frontend/src/business/components/settings/system/group/EditUserGroup.vue similarity index 100% rename from frontend/src/business/components/settings/system/EditUserGroup.vue rename to frontend/src/business/components/settings/system/group/EditUserGroup.vue diff --git a/frontend/src/business/components/settings/system/group/GroupOperator.vue b/frontend/src/business/components/settings/system/group/GroupOperator.vue new file mode 100644 index 0000000000..e5fb720137 --- /dev/null +++ b/frontend/src/business/components/settings/system/group/GroupOperator.vue @@ -0,0 +1,30 @@ + + + + + diff --git a/frontend/src/business/components/settings/system/group/GroupPermission.vue b/frontend/src/business/components/settings/system/group/GroupPermission.vue new file mode 100644 index 0000000000..f09322a59c --- /dev/null +++ b/frontend/src/business/components/settings/system/group/GroupPermission.vue @@ -0,0 +1,13 @@ + + + + + diff --git a/frontend/src/business/components/settings/system/UserGroup.vue b/frontend/src/business/components/settings/system/group/UserGroup.vue similarity index 76% rename from frontend/src/business/components/settings/system/UserGroup.vue rename to frontend/src/business/components/settings/system/group/UserGroup.vue index 00fe3847d9..c474d0517b 100644 --- a/frontend/src/business/components/settings/system/UserGroup.vue +++ b/frontend/src/business/components/settings/system/group/UserGroup.vue @@ -28,7 +28,12 @@ @@ -38,6 +43,8 @@ + + @@ -46,13 +53,19 @@ import MsTableHeader from "@/business/components/common/components/MsTableHeader import MsTableOperator from "@/business/components/common/components/MsTableOperator"; import MsTablePagination from "@/business/components/common/pagination/TablePagination"; import {USER_GROUP_SCOPE} from "@/common/js/table-constants"; -import EditUserGroup from "@/business/components/settings/system/EditUserGroup"; +import EditUserGroup from "@/business/components/settings/system/group/EditUserGroup"; +import MsTableOperatorButton from "@/business/components/common/components/MsTableOperatorButton"; +import EditPermission from "@/business/components/settings/system/group/EditPermission"; export default { name: "UserGroup", components: { EditUserGroup, - MsTableHeader, MsTableOperator, MsTablePagination + MsTableHeader, + MsTableOperator, + MsTablePagination, + MsTableOperatorButton, + EditPermission }, data() { return { @@ -66,6 +79,7 @@ export default { }, created() { this.initData(); + this.getGroupJson(); }, computed: { userGroupType() { @@ -93,6 +107,17 @@ export default { this.$success(this.$t('commons.delete_success')); this.initData(); }) + }, + copy(row) { + console.log(row) + }, + setPermission(row) { + this.$refs.editPermission.open(); + }, + getGroupJson() { + this.$get("/user/group/permission", result => { + let data = result.data; + }) } } }