refactor(用户组和权限): 权限显示
This commit is contained in:
parent
e320523eb7
commit
859c67cf98
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package io.metersphere.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class GroupJson {
|
||||
private List<GroupResource> resource;
|
||||
private List<GroupPermission> permissions;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package io.metersphere.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GroupPermission {
|
||||
private String id;
|
||||
private String name;
|
||||
private String resourceId;
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package io.metersphere.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class GroupPermissionDTO {
|
||||
private List<GroupResourceDTO> system;
|
||||
private List<GroupResourceDTO> organization;
|
||||
private List<GroupResourceDTO> workspace;
|
||||
private List<GroupResourceDTO> project;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package io.metersphere.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GroupResource {
|
||||
private String id;
|
||||
private String name;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package io.metersphere.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class GroupResourceDTO {
|
||||
private GroupResource resource;
|
||||
private List<GroupPermission> permissions;
|
||||
}
|
|
@ -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<GroupResource> resource = group.getResource();
|
||||
List<GroupPermission> 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<GroupResourceDTO> getResourcePermission(List<GroupResource> resource, List<GroupPermission> permissions, String type) {
|
||||
List<GroupResourceDTO> dto = new ArrayList<>();
|
||||
List<GroupResource> resources = resource.stream().filter(g -> g.getId().startsWith(type)).collect(Collectors.toList());
|
||||
for (GroupResource r : resources) {
|
||||
GroupResourceDTO resourceDTO = new GroupResourceDTO();
|
||||
resourceDTO.setResource(r);
|
||||
List<GroupPermission> collect = permissions
|
||||
.stream()
|
||||
.filter(p -> StringUtils.equals(r.getId(), p.getResourceId()))
|
||||
.collect(Collectors.toList());
|
||||
resourceDTO.setPermissions(collect);
|
||||
dto.add(resourceDTO);
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
|
||||
private Pager<List<GroupDTO>> getGroups(List<String> groupTypeList, EditGroupRequest request) {
|
||||
if (groupTypeList.contains(UserGroupType.SYSTEM)) {
|
||||
|
@ -131,5 +166,4 @@ public class GroupService {
|
|||
return PageUtils.setPageInfo(page, groups);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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": "报告"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -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: '用户组与权限'}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
<template>
|
||||
<el-dialog :close-on-click-modal="false" :visible.sync="dialogVisible" width="50%"
|
||||
title="设置权限"
|
||||
:destroy-on-close="true">
|
||||
<el-table
|
||||
:data="tableData"
|
||||
style="width: 100%">
|
||||
<el-table-column
|
||||
type="selection"
|
||||
width="55">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="func"
|
||||
label="功能菜单"
|
||||
width="180">
|
||||
</el-table-column>
|
||||
<!-- <el-table-column-->
|
||||
<!-- prop="operators"-->
|
||||
<!-- label="操作对象"-->
|
||||
<!-- width="180">-->
|
||||
<!-- <template v-slot:default="scope">-->
|
||||
<!-- <group-operator :operators="scope.row.operators"/>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column-->
|
||||
<!-- prop="permission"-->
|
||||
<!-- label="权限">-->
|
||||
<!-- <template v-slot:default="scope">-->
|
||||
<!-- {{scope.row.permissions}}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import GroupOperator from "@/business/components/settings/system/group/GroupOperator";
|
||||
|
||||
export default {
|
||||
name: "GroupPermission",
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
tableData: []
|
||||
}
|
||||
},
|
||||
components: {
|
||||
GroupOperator
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
this.dialogVisible = true;
|
||||
this.getGroupJson();
|
||||
},
|
||||
getGroupJson() {
|
||||
this.$get("/user/group/permission", result => {
|
||||
let data = result.data;
|
||||
let arr = [];
|
||||
this._getData("系统", data.system, arr);
|
||||
this._getData("组织", data.organization, arr);
|
||||
this._getData("工作空间", data.workspace, arr);
|
||||
this._getData("项目", data.project, arr);
|
||||
this.tableData = arr;
|
||||
})
|
||||
},
|
||||
_getData(type, data, arr) {
|
||||
let obj = {};
|
||||
obj.func = type;
|
||||
obj.operators = data.map(s => s.resource);
|
||||
obj.permissions = data.map(s => s.permissions);
|
||||
arr.push(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,30 @@
|
|||
<template>
|
||||
<div>
|
||||
<div v-for="(operator, index) in operators" :key="index" style="margin-top: 5px;">
|
||||
{{ operator.name }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "GroupOperator",
|
||||
props: {
|
||||
operators: {
|
||||
type: Array,
|
||||
default() {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
checked: false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,13 @@
|
|||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "GroupPermission"
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
|
@ -28,7 +28,12 @@
|
|||
<el-table-column prop="description" label="描述"/>
|
||||
<el-table-column :label="$t('commons.operating')">
|
||||
<template v-slot:default="scope">
|
||||
<ms-table-operator @editClick="edit(scope.row)" @deleteClick="del(scope.row)"/>
|
||||
<ms-table-operator @editClick="edit(scope.row)" @deleteClick="del(scope.row)">
|
||||
<template v-slot:behind>
|
||||
<ms-table-operator-button tip="复制" icon="el-icon-document-copy" @exec="copy(scope.row)"/>
|
||||
<ms-table-operator-button tip="设置权限" icon="el-icon-s-tools" @exec="setPermission(scope.row)"/>
|
||||
</template>
|
||||
</ms-table-operator>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -38,6 +43,8 @@
|
|||
</el-card>
|
||||
|
||||
<edit-user-group ref="editUserGroup" @refresh="initData"/>
|
||||
|
||||
<edit-permission ref="editPermission"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -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;
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue