refactor(系统设置, 用户组和权限): 处理冲突
This commit is contained in:
parent
232e8d09f3
commit
131ec1ff76
|
@ -0,0 +1,140 @@
|
||||||
|
package io.metersphere.commons.constants;
|
||||||
|
|
||||||
|
public class PermissionConstants {
|
||||||
|
|
||||||
|
public static final String SYSTEM_USER_READ = "SYSTEM_USER:READ";
|
||||||
|
public static final String SYSTEM_USER_READ_CREATE = "SYSTEM_USER:READ+CREATE";
|
||||||
|
public static final String SYSTEM_USER_READ_IMPORT = "SYSTEM_USER:READ+IMPORT";
|
||||||
|
public static final String SYSTEM_USER_READ_EDIT = "SYSTEM_USER:READ+EDIT";
|
||||||
|
public static final String SYSTEM_USER_READ_DELETE = "SYSTEM_USER:READ+DELETE";
|
||||||
|
public static final String SYSTEM_USER_READ_EDIT_PASSWORD = "SYSTEM_USER:READ+EDIT_PASSWORD";
|
||||||
|
|
||||||
|
public static final String SYSTEM_ORGANIZATION_READ = "SYSTEM_ORGANIZATION:READ";
|
||||||
|
public static final String SYSTEM_ORGANIZATION_READ_CREATE = "SYSTEM_ORGANIZATION:READ+CREATE";
|
||||||
|
public static final String SYSTEM_ORGANIZATION_READ_EDIT = "SYSTEM_ORGANIZATION:READ+EDIT";
|
||||||
|
public static final String SYSTEM_ORGANIZATION_READ_DELETE = "SYSTEM_ORGANIZATION:READ+DELETE";
|
||||||
|
|
||||||
|
public static final String SYSTEM_WORKSPACE_READ = "SYSTEM_WORKSPACE:READ";
|
||||||
|
public static final String SYSTEM_WORKSPACE_READ_CREATE = "SYSTEM_WORKSPACE:READ+CREATE";
|
||||||
|
public static final String SYSTEM_WORKSPACE_READ_EDIT = "SYSTEM_WORKSPACE:READ+EDIT";
|
||||||
|
public static final String SYSTEM_WORKSPACE_READ_DELETE = "SYSTEM_WORKSPACE:READ+DELETE";
|
||||||
|
|
||||||
|
public static final String SYSTEM_GROUP_READ = "SYSTEM_GROUP:READ";
|
||||||
|
public static final String SYSTEM_GROUP_READ_CREATE = "SYSTEM_GROUP:READ+CREATE";
|
||||||
|
public static final String SYSTEM_GROUP_READ_EDIT = "SYSTEM_GROUP:READ+EDIT";
|
||||||
|
public static final String SYSTEM_GROUP_READ_SETTING_PERMISSION = "SYSTEM_GROUP:READ+SETTING_PERMISSION";
|
||||||
|
public static final String SYSTEM_GROUP_READ_DELETE = "SYSTEM_GROUP:READ+DELETE";
|
||||||
|
|
||||||
|
|
||||||
|
public static final String SYSTEM_SETTING_READ = "SYSTEM_SETTING:READ";
|
||||||
|
public static final String SYSTEM_SETTING_READ_EDIT = "SYSTEM_SETTING:READ+EDIT";
|
||||||
|
public static final String SYSTEM_SETTING_READ_AUTH_MANAGE = "SYSTEM_SETTING:READ+AUTH_MANAGE";
|
||||||
|
public static final String SYSTEM_QUOTA_READ = "SYSTEM_QUOTA:READ";
|
||||||
|
public static final String SYSTEM_QUOTA_READ_EDIT = "SYSTEM_QUOTA:READ+EDIT";
|
||||||
|
public static final String SYSTEM_AUTH_READ = "SYSTEM_AUTH:READ";
|
||||||
|
public static final String SYSTEM_AUTH_READ_EDIT = "SYSTEM_AUTH:READ+EDIT";
|
||||||
|
|
||||||
|
|
||||||
|
public static final String ORGANIZATION_USER_READ = "ORGANIZATION_USER:READ";
|
||||||
|
public static final String ORGANIZATION_USER_READ_CREATE = "ORGANIZATION_USER:READ+CREATE";
|
||||||
|
public static final String ORGANIZATION_USER_READ_EDIT = "ORGANIZATION_USER:READ+EDIT";
|
||||||
|
public static final String ORGANIZATION_USER_READ_DELETE = "ORGANIZATION_USER:READ+DELETE";
|
||||||
|
public static final String ORGANIZATION_WORKSPACE_READ = "ORGANIZATION_WORKSPACE:READ";
|
||||||
|
public static final String ORGANIZATION_WORKSPACE_READ_CREATE = "ORGANIZATION_WORKSPACE:READ+CREATE";
|
||||||
|
public static final String ORGANIZATION_WORKSPACE_READ_EDIT = "ORGANIZATION_WORKSPACE:READ+EDIT";
|
||||||
|
public static final String ORGANIZATION_WORKSPACE_READ_DELETE = "ORGANIZATION_WORKSPACE:READ+DELETE";
|
||||||
|
public static final String ORGANIZATION_GROUP_READ = "ORGANIZATION_GROUP:READ";
|
||||||
|
public static final String ORGANIZATION_GROUP_READ_CREATE = "ORGANIZATION_GROUP:READ+CREATE";
|
||||||
|
public static final String ORGANIZATION_GROUP_READ_EDIT = "ORGANIZATION_GROUP:READ+EDIT";
|
||||||
|
public static final String ORGANIZATION_GROUP_READ_SETTING_PERMISSION = "ORGANIZATION_GROUP:READ+SETTING_PERMISSION";
|
||||||
|
public static final String ORGANIZATION_GROUP_READ_DELETE = "ORGANIZATION_GROUP:READ+DELETE";
|
||||||
|
public static final String ORGANIZATION_SERVICE_READ = "ORGANIZATION_SERVICE:READ";
|
||||||
|
public static final String ORGANIZATION_SERVICE_READ_EDIT = "ORGANIZATION_SERVICE:READ+EDIT";
|
||||||
|
public static final String ORGANIZATION_MESSAGE_READ = "ORGANIZATION_MESSAGE:READ";
|
||||||
|
public static final String ORGANIZATION_MESSAGE_READ_EDIT = "ORGANIZATION_MESSAGE:READ+EDIT";
|
||||||
|
|
||||||
|
|
||||||
|
public static final String WORKSPACE_USER_READ = "WORKSPACE_USER:READ";
|
||||||
|
public static final String WORKSPACE_USER_READ_CREATE = "WORKSPACE_USER:READ+CREATE";
|
||||||
|
public static final String WORKSPACE_USER_READ_EDIT = "WORKSPACE_USER:READ+EDIT";
|
||||||
|
public static final String WORKSPACE_USER_READ_DELETE = "WORKSPACE_USER:READ+DELETE";
|
||||||
|
public static final String WORKSPACE_TEMPLATE_READ = "WORKSPACE_TEMPLATE:READ";
|
||||||
|
public static final String WORKSPACE_TEMPLATE_READ_CASE_TEMPLATE = "WORKSPACE_TEMPLATE:READ+CASE_TEMPLATE";
|
||||||
|
public static final String WORKSPACE_TEMPLATE_READ_ISSUE_TEMPLATE = "WORKSPACE_TEMPLATE:READ+ISSUE_TEMPLATE";
|
||||||
|
public static final String WORKSPACE_TEMPLATE_READ_CUSTOM = "WORKSPACE_TEMPLATE:READ+CUSTOM";
|
||||||
|
public static final String WORKSPACE_TEMPLATE_READ_REPORT_TEMPLATE = "WORKSPACE_TEMPLATE:READ+REPORT_TEMPLATE";
|
||||||
|
|
||||||
|
|
||||||
|
public static final String PROJECT_USER_READ = "PROJECT_USER:READ";
|
||||||
|
public static final String PROJECT_USER_READ_CREATE = "PROJECT_USER:READ+CREATE";
|
||||||
|
public static final String PROJECT_USER_READ_EDIT = "PROJECT_USER:READ+EDIT";
|
||||||
|
public static final String PROJECT_USER_READ_DELETE = "PROJECT_USER:READ+DELETE";
|
||||||
|
public static final String PROJECT_MANAGER_READ = "PROJECT_MANAGER:READ";
|
||||||
|
public static final String PROJECT_MANAGER_READ_ = "PROJECT_MANAGER:READ+CREATE";
|
||||||
|
public static final String PROJECT_MANAGER_READ_EDIT = "PROJECT_MANAGER:READ+EDIT";
|
||||||
|
public static final String PROJECT_MANAGER_READ_DELETE = "PROJECT_MANAGER:READ+DELETE";
|
||||||
|
public static final String PROJECT_ENVIRONMENT_READ = "PROJECT_ENVIRONMENT:READ";
|
||||||
|
public static final String PROJECT_ENVIRONMENT_READ_ = "PROJECT_ENVIRONMENT:READ+CREATE";
|
||||||
|
public static final String PROJECT_ENVIRONMENT_READ_EDIT = "PROJECT_ENVIRONMENT:READ+EDIT";
|
||||||
|
public static final String PROJECT_ENVIRONMENT_READ_DELETE = "PROJECT_ENVIRONMENT:READ+DELETE";
|
||||||
|
public static final String PROJECT_ENVIRONMENT_READ_COPY = "PROJECT_ENVIRONMENT:READ+COPY";
|
||||||
|
public static final String PROJECT_ENVIRONMENT_READ_IMPORT = "PROJECT_ENVIRONMENT:READ+IMPORT";
|
||||||
|
public static final String PROJECT_ENVIRONMENT_READ_EXPORT = "PROJECT_ENVIRONMENT:READ+EXPORT";
|
||||||
|
public static final String PROJECT_TRACK_CASE_READ = "PROJECT_TRACK_CASE:READ";
|
||||||
|
public static final String PROJECT_TRACK_CASE_READ_ = "PROJECT_TRACK_CASE:READ+CREATE";
|
||||||
|
public static final String PROJECT_TRACK_CASE_READ_EDIT = "PROJECT_TRACK_CASE:READ+EDIT";
|
||||||
|
public static final String PROJECT_TRACK_CASE_READ_DELETE = "PROJECT_TRACK_CASE:READ+DELETE";
|
||||||
|
public static final String PROJECT_TRACK_CASE_READ_COPY = "PROJECT_TRACK_CASE:READ+COPY";
|
||||||
|
public static final String PROJECT_TRACK_CASE_READ_IMPORT = "PROJECT_TRACK_CASE:READ+IMPORT";
|
||||||
|
public static final String PROJECT_TRACK_CASE_READ_EXPORT = "PROJECT_TRACK_CASE:READ+EXPORT";
|
||||||
|
public static final String PROJECT_TRACK_REVIEW_READ = "PROJECT_TRACK_REVIEW:READ";
|
||||||
|
public static final String PROJECT_TRACK_REVIEW_READ_ = "PROJECT_TRACK_REVIEW:READ+CREATE";
|
||||||
|
public static final String PROJECT_TRACK_REVIEW_READ_EDIT = "PROJECT_TRACK_REVIEW:READ+EDIT";
|
||||||
|
public static final String PROJECT_TRACK_REVIEW_READ_DELETE = "PROJECT_TRACK_REVIEW:READ+DELETE";
|
||||||
|
public static final String PROJECT_TRACK_REVIEW_READ_COMMENT = "PROJECT_TRACK_REVIEW:READ+COMMENT";
|
||||||
|
public static final String PROJECT_TRACK_REVIEW_READ_RELEVANCE_OR_CANCEL = "PROJECT_TRACK_REVIEW:READ+RELEVANCE_OR_CANCEL";
|
||||||
|
public static final String PROJECT_TRACK_PLAN_READ = "PROJECT_TRACK_PLAN:READ";
|
||||||
|
public static final String PROJECT_TRACK_PLAN_READ_ = "PROJECT_TRACK_PLAN:READ+CREATE";
|
||||||
|
public static final String PROJECT_TRACK_PLAN_READ_EDIT = "PROJECT_TRACK_PLAN:READ+EDIT";
|
||||||
|
public static final String PROJECT_TRACK_PLAN_READ_DELETE = "PROJECT_TRACK_PLAN:READ+DELETE";
|
||||||
|
public static final String PROJECT_TRACK_PLAN_READ_SCHEDULE = "PROJECT_TRACK_PLAN:READ+SCHEDULE";
|
||||||
|
public static final String PROJECT_TRACK_PLAN_READ_RELEVANCE_OR_CANCEL = "PROJECT_TRACK_PLAN:READ+RELEVANCE_OR_CANCEL";
|
||||||
|
public static final String PROJECT_API_DEFINITION_READ = "PROJECT_API_DEFINITION:READ";
|
||||||
|
public static final String PROJECT_API_DEFINITION_READ_ = "PROJECT_API_DEFINITION:READ+CREATE_API";
|
||||||
|
public static final String PROJECT_API_DEFINITION_READ_EDIT_API = "PROJECT_API_DEFINITION:READ+EDIT_API";
|
||||||
|
public static final String PROJECT_API_DEFINITION_READ_DELETE_API = "PROJECT_API_DEFINITION:READ+DELETE_API";
|
||||||
|
public static final String PROJECT_API_DEFINITION_READ_CREATE_CASE = "PROJECT_API_DEFINITION:READ+CREATE_CASE";
|
||||||
|
public static final String PROJECT_API_DEFINITION_READ_EDIT_CASE = "PROJECT_API_DEFINITION:READ+EDIT_CASE";
|
||||||
|
public static final String PROJECT_API_DEFINITION_READ_DELETE_CASE = "PROJECT_API_DEFINITION:READ+DELETE_CASE";
|
||||||
|
public static final String PROJECT_API_DEFINITION_READ_COPY_CASE = "PROJECT_API_DEFINITION:READ+COPY_CASE";
|
||||||
|
public static final String PROJECT_API_DEFINITION_READ_IMPORT_API = "PROJECT_API_DEFINITION:READ+IMPORT_API";
|
||||||
|
public static final String PROJECT_API_DEFINITION_READ_EXPORT_API = "PROJECT_API_DEFINITION:READ+EXPORT_API";
|
||||||
|
public static final String PROJECT_API_DEFINITION_READ_CREATE_PERFORMANCE = "PROJECT_API_DEFINITION:READ+CREATE_PERFORMANCE";
|
||||||
|
public static final String PROJECT_API_DEFINITION_READ_RUN = "PROJECT_API_DEFINITION:READ+RUN";
|
||||||
|
public static final String PROJECT_API_DEFINITION_READ_DEBUG = "PROJECT_API_DEFINITION:READ+DEBUG";
|
||||||
|
public static final String PROJECT_API_DEFINITION_READ_MOCK = "PROJECT_API_DEFINITION:READ+MOCK";
|
||||||
|
public static final String PROJECT_API_SCENARIO_READ = "PROJECT_API_SCENARIO:READ";
|
||||||
|
public static final String PROJECT_API_SCENARIO_READ_ = "PROJECT_API_SCENARIO:READ+CREATE";
|
||||||
|
public static final String PROJECT_API_SCENARIO_READ_EDIT = "PROJECT_API_SCENARIO:READ+EDIT";
|
||||||
|
public static final String PROJECT_API_SCENARIO_READ_DELETE = "PROJECT_API_SCENARIO:READ+DELETE";
|
||||||
|
public static final String PROJECT_API_SCENARIO_READ_COPY = "PROJECT_API_SCENARIO:READ+COPY";
|
||||||
|
public static final String PROJECT_API_SCENARIO_READ_RUN = "PROJECT_API_SCENARIO:READ+RUN";
|
||||||
|
public static final String PROJECT_API_SCENARIO_READ_DEBUG = "PROJECT_API_SCENARIO:READ+DEBUG";
|
||||||
|
public static final String PROJECT_API_SCENARIO_READ_SCHEDULE = "PROJECT_API_SCENARIO:READ+SCHEDULE";
|
||||||
|
public static final String PROJECT_API_SCENARIO_READ_IMPORT_SCENARIO = "PROJECT_API_SCENARIO:READ+IMPORT_SCENARIO";
|
||||||
|
public static final String PROJECT_API_SCENARIO_READ_EXPORT_SCENARIO = "PROJECT_API_SCENARIO:READ+EXPORT_SCENARIO";
|
||||||
|
public static final String PROJECT_API_SCENARIO_READ_MOVE_BATCH = "PROJECT_API_SCENARIO:READ+MOVE_BATCH";
|
||||||
|
public static final String PROJECT_API_SCENARIO_READ_CREATE_PERFORMANCE = "PROJECT_API_SCENARIO:READ+CREATE_PERFORMANCE";
|
||||||
|
public static final String PROJECT_API_REPORT_READ = "PROJECT_API_REPORT:READ";
|
||||||
|
public static final String PROJECT_API_REPORT_READ_DELETE = "PROJECT_API_REPORT:READ+DELETE";
|
||||||
|
public static final String PROJECT_PERFORMANCE_TEST_READ = "PROJECT_PERFORMANCE_TEST:READ";
|
||||||
|
public static final String PROJECT_PERFORMANCE_TEST_READ_ = "PROJECT_PERFORMANCE_TEST:READ+CREATE";
|
||||||
|
public static final String PROJECT_PERFORMANCE_TEST_READ_EDIT = "PROJECT_PERFORMANCE_TEST:READ+EDIT";
|
||||||
|
public static final String PROJECT_PERFORMANCE_TEST_READ_DELETE = "PROJECT_PERFORMANCE_TEST:READ+DELETE";
|
||||||
|
public static final String PROJECT_PERFORMANCE_TEST_READ_COPY = "PROJECT_PERFORMANCE_TEST:READ+COPY";
|
||||||
|
public static final String PROJECT_PERFORMANCE_TEST_READ_RUN = "PROJECT_PERFORMANCE_TEST:READ+RUN";
|
||||||
|
public static final String PROJECT_PERFORMANCE_TEST_READ_SCHEDULE = "PROJECT_PERFORMANCE_TEST:READ+SCHEDULE";
|
||||||
|
public static final String PROJECT_PERFORMANCE_REPORT_READ = "PROJECT_PERFORMANCE_REPORT:READ";
|
||||||
|
public static final String PROJECT_PERFORMANCE_REPORT_READ_DELETE = "PROJECT_PERFORMANCE_REPORT:READ+DELETE";
|
||||||
|
|
||||||
|
}
|
|
@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping("/user/group")
|
@RequestMapping("/user/group")
|
||||||
|
@ -26,6 +27,11 @@ public class GroupController {
|
||||||
return groupService.getGroupList(request);
|
return groupService.getGroupList(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/get")
|
||||||
|
public List<Group> getGroupByType(@RequestBody EditGroupRequest request) {
|
||||||
|
return groupService.getGroupByType(request);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
public Group addGroup(@RequestBody EditGroupRequest request) {
|
public Group addGroup(@RequestBody EditGroupRequest request) {
|
||||||
return groupService.addGroup(request);
|
return groupService.addGroup(request);
|
||||||
|
@ -51,5 +57,10 @@ public class GroupController {
|
||||||
groupService.editGroupPermission(editGroupRequest);
|
groupService.editGroupPermission(editGroupRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/all/{userId}")
|
||||||
|
public List<Map<String, Object>> getAllUserGroup(@PathVariable("userId") String userId) {
|
||||||
|
return groupService.getAllUserGroup(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import io.metersphere.commons.utils.PageUtils;
|
||||||
import io.metersphere.commons.utils.Pager;
|
import io.metersphere.commons.utils.Pager;
|
||||||
import io.metersphere.controller.request.OrganizationRequest;
|
import io.metersphere.controller.request.OrganizationRequest;
|
||||||
import io.metersphere.dto.OrganizationMemberDTO;
|
import io.metersphere.dto.OrganizationMemberDTO;
|
||||||
|
import io.metersphere.dto.OrganizationResource;
|
||||||
import io.metersphere.log.annotation.MsAuditLog;
|
import io.metersphere.log.annotation.MsAuditLog;
|
||||||
import io.metersphere.service.OrganizationService;
|
import io.metersphere.service.OrganizationService;
|
||||||
import io.metersphere.service.UserService;
|
import io.metersphere.service.UserService;
|
||||||
|
@ -76,4 +77,9 @@ public class OrganizationController {
|
||||||
public void updateOrgMember(@RequestBody OrganizationMemberDTO memberDTO) {
|
public void updateOrgMember(@RequestBody OrganizationMemberDTO memberDTO) {
|
||||||
organizationService.updateOrgMember(memberDTO);
|
organizationService.updateOrgMember(memberDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list/resource/{groupId}/{type}")
|
||||||
|
public OrganizationResource listResource(@PathVariable String groupId, @PathVariable String type) {
|
||||||
|
return organizationService.listResource(groupId, type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,12 @@ public class UserController {
|
||||||
return userService.getUserRole(userId);
|
return userService.getUserRole(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/special/user/group/{userId}")
|
||||||
|
@RequiresRoles(RoleConstants.ADMIN)
|
||||||
|
public UserGroupPermissionDTO getUserGroup(@PathVariable("userId") String userId) {
|
||||||
|
return userService.getUserGroup(userId);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/special/delete/{userId}")
|
@GetMapping("/special/delete/{userId}")
|
||||||
@RequiresRoles(RoleConstants.ADMIN)
|
@RequiresRoles(RoleConstants.ADMIN)
|
||||||
@MsAuditLog(module = "system_user", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#userId)", msClass = UserService.class)
|
@MsAuditLog(module = "system_user", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#userId)", msClass = UserService.class)
|
||||||
|
|
|
@ -13,5 +13,6 @@ import java.util.Map;
|
||||||
public class UserRequest extends User {
|
public class UserRequest extends User {
|
||||||
|
|
||||||
private List<Map<String, Object>> roles = new ArrayList<>();
|
private List<Map<String, Object>> roles = new ArrayList<>();
|
||||||
|
private List<Map<String, Object>> groups = new ArrayList<>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package io.metersphere.dto;
|
package io.metersphere.dto;
|
||||||
|
|
||||||
|
import io.metersphere.base.domain.Group;
|
||||||
|
import io.metersphere.base.domain.UserGroupPermission;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -8,4 +10,8 @@ import java.util.List;
|
||||||
public class GroupResourceDTO {
|
public class GroupResourceDTO {
|
||||||
private GroupResource resource;
|
private GroupResource resource;
|
||||||
private List<GroupPermission> permissions;
|
private List<GroupPermission> permissions;
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
private Group group;
|
||||||
|
private List<UserGroupPermission> userGroupPermissions;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package io.metersphere.dto;
|
||||||
|
|
||||||
|
import io.metersphere.base.domain.Organization;
|
||||||
|
import io.metersphere.base.domain.Project;
|
||||||
|
import io.metersphere.base.domain.Workspace;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class OrganizationResource {
|
||||||
|
private List<Organization> organizations = new ArrayList<>();
|
||||||
|
private List<Workspace> workspaces = new ArrayList<>();
|
||||||
|
private List<Project> projects = new ArrayList<>();
|
||||||
|
}
|
|
@ -1,8 +1,6 @@
|
||||||
package io.metersphere.dto;
|
package io.metersphere.dto;
|
||||||
|
|
||||||
import io.metersphere.base.domain.Role;
|
import io.metersphere.base.domain.*;
|
||||||
import io.metersphere.base.domain.User;
|
|
||||||
import io.metersphere.base.domain.UserRole;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@ -17,6 +15,10 @@ public class UserDTO extends User {
|
||||||
|
|
||||||
private List<UserRole> userRoles = new ArrayList<>();
|
private List<UserRole> userRoles = new ArrayList<>();
|
||||||
|
|
||||||
|
private List<UserGroup> userGroups = new ArrayList<>();
|
||||||
|
private List<Group> groups = new ArrayList<>();
|
||||||
|
private List<GroupResourceDTO> groupPermissions = new ArrayList<>();
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package io.metersphere.dto;
|
||||||
|
|
||||||
|
import io.metersphere.base.domain.Group;
|
||||||
|
import io.metersphere.base.domain.UserGroup;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UserGroupPermissionDTO {
|
||||||
|
List<GroupResourceDTO> list = new ArrayList<>();
|
||||||
|
List<Group> groups = new ArrayList<>();
|
||||||
|
List<UserGroup> userGroups = new ArrayList<>();
|
||||||
|
}
|
|
@ -63,6 +63,8 @@ public class LocalRealm extends AuthorizingRealm {
|
||||||
UserDTO userDTO = userService.getUserDTO(userId);
|
UserDTO userDTO = userService.getUserDTO(userId);
|
||||||
Set<String> roles = userDTO.getRoles().stream().map(Role::getId).collect(Collectors.toSet());
|
Set<String> roles = userDTO.getRoles().stream().map(Role::getId).collect(Collectors.toSet());
|
||||||
authorizationInfo.setRoles(roles);
|
authorizationInfo.setRoles(roles);
|
||||||
|
Set<String> userPermission = userService.getUserPermission(userId);
|
||||||
|
authorizationInfo.setStringPermissions(userPermission);
|
||||||
return authorizationInfo;
|
return authorizationInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import io.metersphere.base.domain.*;
|
import io.metersphere.base.domain.*;
|
||||||
import io.metersphere.base.mapper.GroupMapper;
|
import io.metersphere.base.mapper.GroupMapper;
|
||||||
|
import io.metersphere.base.mapper.UserGroupMapper;
|
||||||
import io.metersphere.base.mapper.UserGroupPermissionMapper;
|
import io.metersphere.base.mapper.UserGroupPermissionMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtGroupMapper;
|
import io.metersphere.base.mapper.ext.ExtGroupMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtUserGroupMapper;
|
import io.metersphere.base.mapper.ext.ExtUserGroupMapper;
|
||||||
|
@ -46,6 +47,10 @@ public class GroupService {
|
||||||
private SqlSessionFactory sqlSessionFactory;
|
private SqlSessionFactory sqlSessionFactory;
|
||||||
@Resource
|
@Resource
|
||||||
private UserGroupPermissionMapper userGroupPermissionMapper;
|
private UserGroupPermissionMapper userGroupPermissionMapper;
|
||||||
|
@Resource
|
||||||
|
private UserGroupMapper userGroupMapper;
|
||||||
|
@Resource
|
||||||
|
private OrganizationService organizationService;
|
||||||
|
|
||||||
private static final Map<String, List<String>> map = new HashMap<String, List<String>>(4){{
|
private static final Map<String, List<String>> map = new HashMap<String, List<String>>(4){{
|
||||||
put(UserGroupType.SYSTEM, Arrays.asList(UserGroupType.SYSTEM, UserGroupType.ORGANIZATION, UserGroupType.WORKSPACE, UserGroupType.PROJECT));
|
put(UserGroupType.SYSTEM, Arrays.asList(UserGroupType.SYSTEM, UserGroupType.ORGANIZATION, UserGroupType.WORKSPACE, UserGroupType.PROJECT));
|
||||||
|
@ -152,6 +157,53 @@ public class GroupService {
|
||||||
sqlSession.flushStatements();
|
sqlSession.flushStatements();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Group> getGroupByType(EditGroupRequest request) {
|
||||||
|
List<Group> list = new ArrayList<>();
|
||||||
|
GroupExample example = new GroupExample();
|
||||||
|
GroupExample.Criteria criteria = example.createCriteria();
|
||||||
|
String type = request.getType();
|
||||||
|
if (StringUtils.isBlank(type)) {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!StringUtils.equals(type, UserGroupType.SYSTEM)) {
|
||||||
|
criteria.andTypeEqualTo(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
return groupMapper.selectByExample(example);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Map<String, Object>> getAllUserGroup(String userId) {
|
||||||
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
UserGroupExample userGroupExample = new UserGroupExample();
|
||||||
|
userGroupExample.createCriteria().andUserIdEqualTo(userId);
|
||||||
|
List<UserGroup> userGroups = userGroupMapper.selectByExample(userGroupExample);
|
||||||
|
List<String> groupsIds = userGroups.stream().map(UserGroup::getGroupId).collect(Collectors.toList());
|
||||||
|
for (int i = 0; i < groupsIds.size(); i++) {
|
||||||
|
String id = groupsIds.get(i);
|
||||||
|
Group group = groupMapper.selectByPrimaryKey(id);
|
||||||
|
String type = group.getType();
|
||||||
|
Map<String, Object> map = new HashMap<>(2);
|
||||||
|
map.put("type", id + "+" + type);
|
||||||
|
OrganizationResource organizationResource = organizationService.listResource(id, group.getType());
|
||||||
|
List<String> collect = userGroups.stream().filter(ugp -> ugp.getGroupId().equals(id)).map(UserGroup::getSourceId).collect(Collectors.toList());
|
||||||
|
map.put("ids", collect);
|
||||||
|
if (StringUtils.equals(type, UserGroupType.ORGANIZATION)) {
|
||||||
|
map.put("organizations", organizationResource.getOrganizations());
|
||||||
|
}
|
||||||
|
if (StringUtils.equals(type, UserGroupType.WORKSPACE)) {
|
||||||
|
map.put("workspaces", organizationResource.getOrganizations());
|
||||||
|
}
|
||||||
|
if (StringUtils.equals(type, UserGroupType.PROJECT)) {
|
||||||
|
map.put("projects", organizationResource.getOrganizations());
|
||||||
|
}
|
||||||
|
list.add(map);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private List<GroupResourceDTO> getResourcePermission(List<GroupResource> resource, List<GroupPermission> permissions, String type, List<String> permissionList) {
|
private List<GroupResourceDTO> getResourcePermission(List<GroupResource> resource, List<GroupPermission> permissions, String type, List<String> permissionList) {
|
||||||
List<GroupResourceDTO> dto = new ArrayList<>();
|
List<GroupResourceDTO> dto = new ArrayList<>();
|
||||||
List<GroupResource> resources = resource.stream().filter(g -> g.getId().startsWith(type)).collect(Collectors.toList());
|
List<GroupResource> resources = resource.stream().filter(g -> g.getId().startsWith(type)).collect(Collectors.toList());
|
||||||
|
@ -168,6 +220,7 @@ public class GroupService {
|
||||||
.filter(p -> StringUtils.equals(r.getId(), p.getResourceId()))
|
.filter(p -> StringUtils.equals(r.getId(), p.getResourceId()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
resourceDTO.setPermissions(collect);
|
resourceDTO.setPermissions(collect);
|
||||||
|
resourceDTO.setType(r.getId().split("_")[0]);
|
||||||
dto.add(resourceDTO);
|
dto.add(resourceDTO);
|
||||||
}
|
}
|
||||||
return dto;
|
return dto;
|
||||||
|
|
|
@ -2,18 +2,17 @@ package io.metersphere.service;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import io.metersphere.base.domain.*;
|
import io.metersphere.base.domain.*;
|
||||||
import io.metersphere.base.mapper.OrganizationMapper;
|
import io.metersphere.base.mapper.*;
|
||||||
import io.metersphere.base.mapper.UserMapper;
|
|
||||||
import io.metersphere.base.mapper.UserRoleMapper;
|
|
||||||
import io.metersphere.base.mapper.WorkspaceMapper;
|
|
||||||
import io.metersphere.base.mapper.ext.ExtOrganizationMapper;
|
import io.metersphere.base.mapper.ext.ExtOrganizationMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtUserRoleMapper;
|
import io.metersphere.base.mapper.ext.ExtUserRoleMapper;
|
||||||
import io.metersphere.commons.constants.RoleConstants;
|
import io.metersphere.commons.constants.RoleConstants;
|
||||||
|
import io.metersphere.commons.constants.UserGroupType;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.user.SessionUser;
|
import io.metersphere.commons.user.SessionUser;
|
||||||
import io.metersphere.commons.utils.SessionUtils;
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
import io.metersphere.controller.request.OrganizationRequest;
|
import io.metersphere.controller.request.OrganizationRequest;
|
||||||
import io.metersphere.dto.OrganizationMemberDTO;
|
import io.metersphere.dto.OrganizationMemberDTO;
|
||||||
|
import io.metersphere.dto.OrganizationResource;
|
||||||
import io.metersphere.dto.UserDTO;
|
import io.metersphere.dto.UserDTO;
|
||||||
import io.metersphere.dto.UserRoleHelpDTO;
|
import io.metersphere.dto.UserRoleHelpDTO;
|
||||||
import io.metersphere.i18n.Translator;
|
import io.metersphere.i18n.Translator;
|
||||||
|
@ -51,6 +50,10 @@ public class OrganizationService {
|
||||||
private WorkspaceService workspaceService;
|
private WorkspaceService workspaceService;
|
||||||
@Resource
|
@Resource
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
@Resource
|
||||||
|
private ProjectMapper projectMapper;
|
||||||
|
@Resource
|
||||||
|
private GroupMapper groupMapper;
|
||||||
|
|
||||||
public Organization addOrganization(Organization organization) {
|
public Organization addOrganization(Organization organization) {
|
||||||
checkOrganization(organization);
|
checkOrganization(organization);
|
||||||
|
@ -199,6 +202,55 @@ public class OrganizationService {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OrganizationResource listResource(String groupId, String type) {
|
||||||
|
Group group = groupMapper.selectByPrimaryKey(groupId);
|
||||||
|
final String orgId = group.getScopeId();
|
||||||
|
OrganizationResource resource = new OrganizationResource();
|
||||||
|
if (!StringUtils.equals("global", orgId)) {
|
||||||
|
Organization organization = organizationMapper.selectByPrimaryKey(orgId);
|
||||||
|
if (organization == null) {
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.equals(UserGroupType.ORGANIZATION, type)) {
|
||||||
|
OrganizationExample organizationExample = new OrganizationExample();
|
||||||
|
OrganizationExample.Criteria criteria = organizationExample.createCriteria();
|
||||||
|
if (!StringUtils.equals(orgId, "global")) {
|
||||||
|
criteria.andIdEqualTo(orgId);
|
||||||
|
}
|
||||||
|
List<Organization> organizations = organizationMapper.selectByExample(organizationExample);
|
||||||
|
resource.setOrganizations(organizations);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.equals(UserGroupType.WORKSPACE, type)) {
|
||||||
|
WorkspaceExample workspaceExample = new WorkspaceExample();
|
||||||
|
WorkspaceExample.Criteria criteria = workspaceExample.createCriteria();
|
||||||
|
if (!StringUtils.equals(orgId, "global")) {
|
||||||
|
criteria.andOrganizationIdEqualTo(orgId);
|
||||||
|
}
|
||||||
|
List<Workspace> workspaces = workspaceMapper.selectByExample(workspaceExample);
|
||||||
|
resource.setWorkspaces(workspaces);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.equals(UserGroupType.PROJECT, type)) {
|
||||||
|
ProjectExample projectExample = new ProjectExample();
|
||||||
|
ProjectExample.Criteria pc = projectExample.createCriteria();
|
||||||
|
WorkspaceExample workspaceExample = new WorkspaceExample();
|
||||||
|
WorkspaceExample.Criteria criteria = workspaceExample.createCriteria();
|
||||||
|
if (!StringUtils.equals(orgId, "global")) {
|
||||||
|
criteria.andOrganizationIdEqualTo(orgId);
|
||||||
|
List<Workspace> workspaces = workspaceMapper.selectByExample(workspaceExample);
|
||||||
|
List<String> list = workspaces.stream().map(Workspace::getId).collect(Collectors.toList());
|
||||||
|
pc.andWorkspaceIdIn(list);
|
||||||
|
}
|
||||||
|
List<Project> projects = projectMapper.selectByExample(projectExample);
|
||||||
|
resource.setProjects(projects);
|
||||||
|
}
|
||||||
|
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
public String getLogDetails(OrganizationMemberDTO memberDTO) {
|
public String getLogDetails(OrganizationMemberDTO memberDTO) {
|
||||||
String orgId = memberDTO.getOrganizationId();
|
String orgId = memberDTO.getOrganizationId();
|
||||||
String userId = memberDTO.getId();
|
String userId = memberDTO.getId();
|
||||||
|
|
|
@ -23,10 +23,7 @@ import io.metersphere.controller.request.member.UserRequest;
|
||||||
import io.metersphere.controller.request.organization.AddOrgMemberRequest;
|
import io.metersphere.controller.request.organization.AddOrgMemberRequest;
|
||||||
import io.metersphere.controller.request.organization.QueryOrgMemberRequest;
|
import io.metersphere.controller.request.organization.QueryOrgMemberRequest;
|
||||||
import io.metersphere.controller.request.resourcepool.UserBatchProcessRequest;
|
import io.metersphere.controller.request.resourcepool.UserBatchProcessRequest;
|
||||||
import io.metersphere.dto.OrganizationMemberDTO;
|
import io.metersphere.dto.*;
|
||||||
import io.metersphere.dto.UserDTO;
|
|
||||||
import io.metersphere.dto.UserRoleDTO;
|
|
||||||
import io.metersphere.dto.WorkspaceDTO;
|
|
||||||
import io.metersphere.excel.domain.*;
|
import io.metersphere.excel.domain.*;
|
||||||
import io.metersphere.excel.listener.EasyExcelListener;
|
import io.metersphere.excel.listener.EasyExcelListener;
|
||||||
import io.metersphere.excel.listener.UserDataListener;
|
import io.metersphere.excel.listener.UserDataListener;
|
||||||
|
@ -40,6 +37,9 @@ import io.metersphere.notice.domain.UserDetail;
|
||||||
import io.metersphere.security.MsUserToken;
|
import io.metersphere.security.MsUserToken;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.ibatis.session.ExecutorType;
|
||||||
|
import org.apache.ibatis.session.SqlSession;
|
||||||
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.apache.shiro.authc.*;
|
import org.apache.shiro.authc.*;
|
||||||
import org.apache.shiro.authz.UnauthorizedException;
|
import org.apache.shiro.authz.UnauthorizedException;
|
||||||
|
@ -82,6 +82,14 @@ public class UserService {
|
||||||
@Resource
|
@Resource
|
||||||
private ExtOrganizationMapper extOrganizationMapper;
|
private ExtOrganizationMapper extOrganizationMapper;
|
||||||
@Resource
|
@Resource
|
||||||
|
private UserGroupMapper userGroupMapper;
|
||||||
|
@Resource
|
||||||
|
private UserGroupPermissionMapper userGroupPermissionMapper;
|
||||||
|
@Resource
|
||||||
|
private GroupMapper groupMapper;
|
||||||
|
@Resource
|
||||||
|
private SqlSessionFactory sqlSessionFactory;
|
||||||
|
@Resource
|
||||||
private UserRoleService userRoleService;
|
private UserRoleService userRoleService;
|
||||||
|
|
||||||
public List<UserDetail> queryTypeByIds(List<String> userIds) {
|
public List<UserDetail> queryTypeByIds(List<String> userIds) {
|
||||||
|
@ -106,13 +114,52 @@ public class UserService {
|
||||||
} else {
|
} else {
|
||||||
createUser(user);
|
createUser(user);
|
||||||
}
|
}
|
||||||
List<Map<String, Object>> roles = user.getRoles();
|
// List<Map<String, Object>> roles = user.getRoles();
|
||||||
if (!roles.isEmpty()) {
|
// if (!roles.isEmpty()) {
|
||||||
insertUserRole(roles, user.getId());
|
// insertUserRole(roles, user.getId());
|
||||||
|
// }
|
||||||
|
List<Map<String, Object>> groups = user.getGroups();
|
||||||
|
if (!groups.isEmpty()) {
|
||||||
|
insertUserGroup(groups, user.getId());
|
||||||
}
|
}
|
||||||
return getUserDTO(user.getId());
|
return getUserDTO(user.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void insertUserGroup(List<Map<String, Object>> groups, String userId) {
|
||||||
|
for (Map<String, Object> map : groups) {
|
||||||
|
String idType = (String) map.get("type");
|
||||||
|
String[] arr = idType.split("\\+");
|
||||||
|
String groupId = arr[0];
|
||||||
|
String type = arr[1];
|
||||||
|
if (StringUtils.equals(type, UserGroupType.SYSTEM)) {
|
||||||
|
UserGroup userGroup = new UserGroup();
|
||||||
|
userGroup.setId(UUID.randomUUID().toString());
|
||||||
|
userGroup.setUserId(userId);
|
||||||
|
userGroup.setGroupId(groupId);
|
||||||
|
userGroup.setSourceId("system");
|
||||||
|
userGroup.setCreateTime(System.currentTimeMillis());
|
||||||
|
userGroup.setUpdateTime(System.currentTimeMillis());
|
||||||
|
userGroupMapper.insertSelective(userGroup);
|
||||||
|
} else {
|
||||||
|
List<String> ids = (List<String>) map.get("ids");
|
||||||
|
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||||
|
UserGroupMapper mapper = sqlSession.getMapper(UserGroupMapper.class);
|
||||||
|
for (String id : ids) {
|
||||||
|
UserGroup userGroup = new UserGroup();
|
||||||
|
userGroup.setId(UUID.randomUUID().toString());
|
||||||
|
userGroup.setUserId(userId);
|
||||||
|
userGroup.setGroupId(groupId);
|
||||||
|
userGroup.setSourceId(id);
|
||||||
|
userGroup.setCreateTime(System.currentTimeMillis());
|
||||||
|
userGroup.setUpdateTime(System.currentTimeMillis());
|
||||||
|
mapper.insertSelective(userGroup);
|
||||||
|
}
|
||||||
|
sqlSession.flushStatements();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public User selectUser(String userId, String email) {
|
public User selectUser(String userId, String email) {
|
||||||
User user = userMapper.selectByPrimaryKey(userId);
|
User user = userMapper.selectByPrimaryKey(userId);
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
|
@ -234,9 +281,41 @@ public class UserService {
|
||||||
UserRoleDTO userRole = getUserRole(userId);
|
UserRoleDTO userRole = getUserRole(userId);
|
||||||
userDTO.setUserRoles(Optional.ofNullable(userRole.getUserRoles()).orElse(new ArrayList<>()));
|
userDTO.setUserRoles(Optional.ofNullable(userRole.getUserRoles()).orElse(new ArrayList<>()));
|
||||||
userDTO.setRoles(Optional.ofNullable(userRole.getRoles()).orElse(new ArrayList<>()));
|
userDTO.setRoles(Optional.ofNullable(userRole.getRoles()).orElse(new ArrayList<>()));
|
||||||
|
UserGroupPermissionDTO dto = getUserGroupPermission(userId);
|
||||||
|
userDTO.setUserGroups(dto.getUserGroups());
|
||||||
|
userDTO.setGroups(dto.getGroups());
|
||||||
|
userDTO.setGroupPermissions(dto.getList());
|
||||||
return userDTO;
|
return userDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private UserGroupPermissionDTO getUserGroupPermission(String userId) {
|
||||||
|
UserGroupPermissionDTO permissionDTO = new UserGroupPermissionDTO();
|
||||||
|
List<GroupResourceDTO> list = new ArrayList<>();
|
||||||
|
UserGroupExample userGroupExample = new UserGroupExample();
|
||||||
|
userGroupExample.createCriteria().andUserIdEqualTo(userId);
|
||||||
|
List<UserGroup> userGroups = userGroupMapper.selectByExample(userGroupExample);
|
||||||
|
if (CollectionUtils.isEmpty(userGroups)) {
|
||||||
|
return permissionDTO;
|
||||||
|
}
|
||||||
|
permissionDTO.setUserGroups(userGroups);
|
||||||
|
List<String> groupList = userGroups.stream().map(UserGroup::getGroupId).collect(Collectors.toList());
|
||||||
|
GroupExample groupExample = new GroupExample();
|
||||||
|
groupExample.createCriteria().andIdIn(groupList);
|
||||||
|
List<Group> groups = groupMapper.selectByExample(groupExample);
|
||||||
|
permissionDTO.setGroups(groups);
|
||||||
|
for (Group gp : groups) {
|
||||||
|
GroupResourceDTO dto = new GroupResourceDTO();
|
||||||
|
dto.setGroup(gp);
|
||||||
|
UserGroupPermissionExample userGroupPermissionExample = new UserGroupPermissionExample();
|
||||||
|
userGroupPermissionExample.createCriteria().andGroupIdEqualTo(gp.getId());
|
||||||
|
List<UserGroupPermission> userGroupPermissions = userGroupPermissionMapper.selectByExample(userGroupPermissionExample);
|
||||||
|
dto.setUserGroupPermissions(userGroupPermissions);
|
||||||
|
list.add(dto);
|
||||||
|
}
|
||||||
|
permissionDTO.setList(list);
|
||||||
|
return permissionDTO;
|
||||||
|
}
|
||||||
|
|
||||||
public UserDTO getLoginUser(String userId, List<String> list) {
|
public UserDTO getLoginUser(String userId, List<String> list) {
|
||||||
UserExample example = new UserExample();
|
UserExample example = new UserExample();
|
||||||
example.createCriteria().andIdEqualTo(userId).andSourceIn(list);
|
example.createCriteria().andIdEqualTo(userId).andSourceIn(list);
|
||||||
|
@ -308,6 +387,10 @@ public class UserService {
|
||||||
example.createCriteria().andUserIdEqualTo(userId);
|
example.createCriteria().andUserIdEqualTo(userId);
|
||||||
userRoleMapper.deleteByExample(example);
|
userRoleMapper.deleteByExample(example);
|
||||||
|
|
||||||
|
UserGroupExample userGroupExample = new UserGroupExample();
|
||||||
|
userGroupExample.createCriteria().andUserIdEqualTo(userId);
|
||||||
|
userGroupMapper.deleteByExample(userGroupExample);
|
||||||
|
|
||||||
userMapper.deleteByPrimaryKey(userId);
|
userMapper.deleteByPrimaryKey(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -861,6 +944,39 @@ public class UserService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Set<String> getUserPermission(String userId) {
|
||||||
|
UserGroupExample userGroupExample = new UserGroupExample();
|
||||||
|
userGroupExample.createCriteria().andUserIdEqualTo(userId);
|
||||||
|
List<UserGroup> userGroups = userGroupMapper.selectByExample(userGroupExample);
|
||||||
|
List<String> groupId = userGroups.stream().map(UserGroup::getGroupId).collect(Collectors.toList());
|
||||||
|
UserGroupPermissionExample userGroupPermissionExample = new UserGroupPermissionExample();
|
||||||
|
userGroupPermissionExample.createCriteria().andGroupIdIn(groupId);
|
||||||
|
List<UserGroupPermission> userGroupPermissions = userGroupPermissionMapper.selectByExample(userGroupPermissionExample);
|
||||||
|
return userGroupPermissions.stream().map(UserGroupPermission::getPermissionId).collect(Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserGroupPermissionDTO getUserGroup(String userId) {
|
||||||
|
UserGroupPermissionDTO userGroupPermissionDTO = new UserGroupPermissionDTO();
|
||||||
|
//
|
||||||
|
UserGroupExample userGroupExample = new UserGroupExample();
|
||||||
|
userGroupExample.createCriteria().andUserIdEqualTo(userId);
|
||||||
|
List<UserGroup> userGroups = userGroupMapper.selectByExample(userGroupExample);
|
||||||
|
|
||||||
|
if (CollectionUtils.isEmpty(userGroups)) {
|
||||||
|
return userGroupPermissionDTO;
|
||||||
|
}
|
||||||
|
// 设置 user_role
|
||||||
|
userGroupPermissionDTO.setUserGroups(userGroups);
|
||||||
|
|
||||||
|
List<String> groupId = userGroups.stream().map(UserGroup::getGroupId).collect(Collectors.toList());
|
||||||
|
|
||||||
|
GroupExample groupExample = new GroupExample();
|
||||||
|
groupExample.createCriteria().andIdIn(groupId);
|
||||||
|
List<Group> groups = groupMapper.selectByExample(groupExample);
|
||||||
|
userGroupPermissionDTO.setGroups(groups);
|
||||||
|
return userGroupPermissionDTO;
|
||||||
|
}
|
||||||
|
|
||||||
public String getLogDetails(String id) {
|
public String getLogDetails(String id) {
|
||||||
User user = userMapper.selectByPrimaryKey(id);
|
User user = userMapper.selectByPrimaryKey(id);
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
"permissions": [
|
"permissions": [
|
||||||
// {
|
{
|
||||||
// "id": "SYSTEM_USER:READ",
|
"id": "SYSTEM_USER:READ",
|
||||||
// "name": "用户",
|
"name": "查询用户",
|
||||||
// "resourceId": "SYSTEM_USER"
|
"resourceId": "SYSTEM_USER"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "SYSTEM_USER:READ+CREATE",
|
"id": "SYSTEM_USER:READ+CREATE",
|
||||||
"name": "创建用户",
|
"name": "创建用户",
|
||||||
|
@ -29,31 +29,31 @@
|
||||||
"name": "修改密码",
|
"name": "修改密码",
|
||||||
"resourceId": "SYSTEM_USER"
|
"resourceId": "SYSTEM_USER"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "id": "SYSTEM_ORGANIZATION:READ",
|
"id": "SYSTEM_ORGANIZATION:READ",
|
||||||
// "name": "$[{i18n_view_overview}]",
|
"name": "查询组织",
|
||||||
// "resourceId": "SYSTEM_ORGANIZATION"
|
"resourceId": "SYSTEM_ORGANIZATION"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "SYSTEM_ORGANIZATION:READ+CREATE",
|
"id": "SYSTEM_ORGANIZATION:READ+CREATE",
|
||||||
"name": "创建场景",
|
"name": "创建组织",
|
||||||
"resourceId": "SYSTEM_ORGANIZATION"
|
"resourceId": "SYSTEM_ORGANIZATION"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "SYSTEM_ORGANIZATION:READ+EDIT",
|
"id": "SYSTEM_ORGANIZATION:READ+EDIT",
|
||||||
"name": "编辑场景",
|
"name": "编辑组织",
|
||||||
"resourceId": "SYSTEM_ORGANIZATION"
|
"resourceId": "SYSTEM_ORGANIZATION"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "SYSTEM_ORGANIZATION:READ+DELETE",
|
"id": "SYSTEM_ORGANIZATION:READ+DELETE",
|
||||||
"name": "删除场景",
|
"name": "删除组织",
|
||||||
"resourceId": "SYSTEM_ORGANIZATION"
|
"resourceId": "SYSTEM_ORGANIZATION"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "id": "SYSTEM_WORKSPACE:READ",
|
"id": "SYSTEM_WORKSPACE:READ",
|
||||||
// "name": "$[{i18n_view_overview}]",
|
"name": "查询工作空间",
|
||||||
// "resourceId": "SYSTEM_WORKSPACE"
|
"resourceId": "SYSTEM_WORKSPACE"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "SYSTEM_WORKSPACE:READ+CREATE",
|
"id": "SYSTEM_WORKSPACE:READ+CREATE",
|
||||||
"name": "创建工作空间",
|
"name": "创建工作空间",
|
||||||
|
@ -69,11 +69,11 @@
|
||||||
"name": "删除工作空间",
|
"name": "删除工作空间",
|
||||||
"resourceId": "SYSTEM_WORKSPACE"
|
"resourceId": "SYSTEM_WORKSPACE"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "id": "SYSTEM_GROUP:READ",
|
"id": "SYSTEM_GROUP:READ",
|
||||||
// "name": "$[{i18n_view_overview}]",
|
"name": "查询用户组与权限",
|
||||||
// "resourceId": "SYSTEM_GROUP"
|
"resourceId": "SYSTEM_GROUP"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "SYSTEM_GROUP:READ+CREATE",
|
"id": "SYSTEM_GROUP:READ+CREATE",
|
||||||
"name": "创建用户组",
|
"name": "创建用户组",
|
||||||
|
@ -94,11 +94,11 @@
|
||||||
"name": "删除",
|
"name": "删除",
|
||||||
"resourceId": "SYSTEM_GROUP"
|
"resourceId": "SYSTEM_GROUP"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "id": "SYSTEM_SETTING:READ",
|
"id": "SYSTEM_SETTING:READ",
|
||||||
// "name": "$[{i18n_view_overview}]",
|
"name": "查询系统设置",
|
||||||
// "resourceId": "SYSTEM_SETTING"
|
"resourceId": "SYSTEM_SETTING"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "SYSTEM_SETTING:READ+EDIT",
|
"id": "SYSTEM_SETTING:READ+EDIT",
|
||||||
"name": "编辑",
|
"name": "编辑",
|
||||||
|
@ -109,31 +109,31 @@
|
||||||
"name": "授权管理",
|
"name": "授权管理",
|
||||||
"resourceId": "SYSTEM_SETTING"
|
"resourceId": "SYSTEM_SETTING"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "id": "SYSTEM_QUOTA:READ",
|
"id": "SYSTEM_QUOTA:READ",
|
||||||
// "name": "$[{i18n_view_overview}]",
|
"name": "查询系统配额",
|
||||||
// "resourceId": "SYSTEM_QUOTA"
|
"resourceId": "SYSTEM_QUOTA"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "SYSTEM_QUOTA:READ+EDIT",
|
"id": "SYSTEM_QUOTA:READ+EDIT",
|
||||||
"name": "编辑",
|
"name": "编辑",
|
||||||
"resourceId": "SYSTEM_QUOTA"
|
"resourceId": "SYSTEM_QUOTA"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "id": "SYSTEM_AUTH:READ",
|
"id": "SYSTEM_AUTH:READ",
|
||||||
// "name": "$[{i18n_view_overview}]",
|
"name": "查询系统授权",
|
||||||
// "resourceId": "SYSTEM_AUTH"
|
"resourceId": "SYSTEM_AUTH"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "SYSTEM_AUTH:READ+EDIT",
|
"id": "SYSTEM_AUTH:READ+EDIT",
|
||||||
"name": "编辑",
|
"name": "编辑",
|
||||||
"resourceId": "SYSTEM_AUTH"
|
"resourceId": "SYSTEM_AUTH"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "id": "ORGANIZATION_USER:READ",
|
"id": "ORGANIZATION_USER:READ",
|
||||||
// "name": "$[{i18n_view_overview}]",
|
"name": "查询成员",
|
||||||
// "resourceId": "ORGANIZATION_USER"
|
"resourceId": "ORGANIZATION_USER"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "ORGANIZATION_USER:READ+CREATE",
|
"id": "ORGANIZATION_USER:READ+CREATE",
|
||||||
"name": "添加成员",
|
"name": "添加成员",
|
||||||
|
@ -149,11 +149,11 @@
|
||||||
"name": "移除成员",
|
"name": "移除成员",
|
||||||
"resourceId": "ORGANIZATION_USER"
|
"resourceId": "ORGANIZATION_USER"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "id": "ORGANIZATION_WORKSPACE:READ",
|
"id": "ORGANIZATION_WORKSPACE:READ",
|
||||||
// "name": "$[{i18n_view_overview}]",
|
"name": "查询工作空间",
|
||||||
// "resourceId": "ORGANIZATION_WORKSPACE"
|
"resourceId": "ORGANIZATION_WORKSPACE"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "ORGANIZATION_WORKSPACE:READ+CREATE",
|
"id": "ORGANIZATION_WORKSPACE:READ+CREATE",
|
||||||
"name": "创建工作空间",
|
"name": "创建工作空间",
|
||||||
|
@ -169,11 +169,11 @@
|
||||||
"name": "删除工作空间",
|
"name": "删除工作空间",
|
||||||
"resourceId": "ORGANIZATION_WORKSPACE"
|
"resourceId": "ORGANIZATION_WORKSPACE"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "id": "ORGANIZATION_GROUP:READ",
|
"id": "ORGANIZATION_GROUP:READ",
|
||||||
// "name": "$[{i18n_view_overview}]",
|
"name": "查询用户组与权限",
|
||||||
// "resourceId": "ORGANIZATION_GROUP"
|
"resourceId": "ORGANIZATION_GROUP"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "ORGANIZATION_GROUP:READ+CREATE",
|
"id": "ORGANIZATION_GROUP:READ+CREATE",
|
||||||
"name": "创建",
|
"name": "创建",
|
||||||
|
@ -194,31 +194,31 @@
|
||||||
"name": "删除",
|
"name": "删除",
|
||||||
"resourceId": "ORGANIZATION_GROUP"
|
"resourceId": "ORGANIZATION_GROUP"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "id": "ORGANIZATION_SERVICE:READ",
|
"id": "ORGANIZATION_SERVICE:READ",
|
||||||
// "name": "$[{i18n_view_overview}]",
|
"name": "查询",
|
||||||
// "resourceId": "ORGANIZATION_SERVICE"
|
"resourceId": "ORGANIZATION_SERVICE"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "ORGANIZATION_SERVICE:READ+EDIT",
|
"id": "ORGANIZATION_SERVICE:READ+EDIT",
|
||||||
"name": "编辑",
|
"name": "编辑",
|
||||||
"resourceId": "ORGANIZATION_SERVICE"
|
"resourceId": "ORGANIZATION_SERVICE"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "id": "ORGANIZATION_MESSAGE:READ",
|
"id": "ORGANIZATION_MESSAGE:READ",
|
||||||
// "name": "$[{i18n_view_overview}]",
|
"name": "查询",
|
||||||
// "resourceId": "ORGANIZATION_MESSAGE"
|
"resourceId": "ORGANIZATION_MESSAGE"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "ORGANIZATION_MESSAGE:READ+EDIT",
|
"id": "ORGANIZATION_MESSAGE:READ+EDIT",
|
||||||
"name": "编辑",
|
"name": "编辑",
|
||||||
"resourceId": "ORGANIZATION_MESSAGE"
|
"resourceId": "ORGANIZATION_MESSAGE"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "id": "WORKSPACE_USER:READ",
|
"id": "WORKSPACE_USER:READ",
|
||||||
// "name": "$[{i18n_view_overview}]",
|
"name": "查询成员",
|
||||||
// "resourceId": "WORKSPACE_USER"
|
"resourceId": "WORKSPACE_USER"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "WORKSPACE_USER:READ+CREATE",
|
"id": "WORKSPACE_USER:READ+CREATE",
|
||||||
"name": "添加成员",
|
"name": "添加成员",
|
||||||
|
@ -234,11 +234,11 @@
|
||||||
"name": "删除成员",
|
"name": "删除成员",
|
||||||
"resourceId": "WORKSPACE_USER"
|
"resourceId": "WORKSPACE_USER"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "id": "WORKSPACE_TEMPLATE:READ",
|
"id": "WORKSPACE_TEMPLATE:READ",
|
||||||
// "name": "$[{i18n_view_overview}]",
|
"name": "查询",
|
||||||
// "resourceId": "WORKSPACE_TEMPLATE"
|
"resourceId": "WORKSPACE_TEMPLATE"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "WORKSPACE_TEMPLATE:READ+CASE_TEMPLATE",
|
"id": "WORKSPACE_TEMPLATE:READ+CASE_TEMPLATE",
|
||||||
"name": "用例模版",
|
"name": "用例模版",
|
||||||
|
@ -259,11 +259,11 @@
|
||||||
"name": "测试报告模版",
|
"name": "测试报告模版",
|
||||||
"resourceId": "WORKSPACE_TEMPLATE"
|
"resourceId": "WORKSPACE_TEMPLATE"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "id": "PROJECT_USER:READ",
|
"id": "PROJECT_USER:READ",
|
||||||
// "name": "$[{i18n_view_overview}]",
|
"name": "查询成员",
|
||||||
// "resourceId": "PROJECT_USER"
|
"resourceId": "PROJECT_USER"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "PROJECT_USER:READ+CREATE",
|
"id": "PROJECT_USER:READ+CREATE",
|
||||||
"name": "添加成员",
|
"name": "添加成员",
|
||||||
|
@ -279,11 +279,11 @@
|
||||||
"name": "移除成员",
|
"name": "移除成员",
|
||||||
"resourceId": "PROJECT_USER"
|
"resourceId": "PROJECT_USER"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "id": "PROJECT_MANAGER:READ",
|
"id": "PROJECT_MANAGER:READ",
|
||||||
// "name": "$[{i18n_view_overview}]",
|
"name": "查询项目",
|
||||||
// "resourceId": "PROJECT_MANAGER"
|
"resourceId": "PROJECT_MANAGER"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "PROJECT_MANAGER:READ+CREATE",
|
"id": "PROJECT_MANAGER:READ+CREATE",
|
||||||
"name": "创建项目",
|
"name": "创建项目",
|
||||||
|
@ -299,11 +299,11 @@
|
||||||
"name": "删除项目",
|
"name": "删除项目",
|
||||||
"resourceId": "PROJECT_MANAGER"
|
"resourceId": "PROJECT_MANAGER"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "id": "PROJECT_ENVIRONMENT:READ",
|
"id": "PROJECT_ENVIRONMENT:READ",
|
||||||
// "name": "$[{i18n_view_overview}]",
|
"name": "查询环境",
|
||||||
// "resourceId": "PROJECT_ENVIRONMENT"
|
"resourceId": "PROJECT_ENVIRONMENT"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "PROJECT_ENVIRONMENT:READ+CREATE",
|
"id": "PROJECT_ENVIRONMENT:READ+CREATE",
|
||||||
"name": "创建环境",
|
"name": "创建环境",
|
||||||
|
@ -334,11 +334,11 @@
|
||||||
"name": "导出环境",
|
"name": "导出环境",
|
||||||
"resourceId": "PROJECT_ENVIRONMENT"
|
"resourceId": "PROJECT_ENVIRONMENT"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "id": "PROJECT_TRACK_CASE:READ",
|
"id": "PROJECT_TRACK_CASE:READ",
|
||||||
// "name": "$[{i18n_view_overview}]",
|
"name": "查询用例",
|
||||||
// "resourceId": "PROJECT_TRACK_CASE"
|
"resourceId": "PROJECT_TRACK_CASE"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "PROJECT_TRACK_CASE:READ+CREATE",
|
"id": "PROJECT_TRACK_CASE:READ+CREATE",
|
||||||
"name": "创建用例",
|
"name": "创建用例",
|
||||||
|
@ -369,11 +369,11 @@
|
||||||
"name": "导出用例",
|
"name": "导出用例",
|
||||||
"resourceId": "PROJECT_TRACK_CASE"
|
"resourceId": "PROJECT_TRACK_CASE"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "id": "PROJECT_TRACK_REVIEW:READ",
|
"id": "PROJECT_TRACK_REVIEW:READ",
|
||||||
// "name": "$[{i18n_view_overview}]",
|
"name": "查询评审",
|
||||||
// "resourceId": "PROJECT_TRACK_REVIEW"
|
"resourceId": "PROJECT_TRACK_REVIEW"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "PROJECT_TRACK_REVIEW:READ+CREATE",
|
"id": "PROJECT_TRACK_REVIEW:READ+CREATE",
|
||||||
"name": "创建评审",
|
"name": "创建评审",
|
||||||
|
@ -404,11 +404,11 @@
|
||||||
"name": "关联/取消关联用例",
|
"name": "关联/取消关联用例",
|
||||||
"resourceId": "PROJECT_TRACK_REVIEW"
|
"resourceId": "PROJECT_TRACK_REVIEW"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "id": "PROJECT_TRACK_PLAN:READ",
|
"id": "PROJECT_TRACK_PLAN:READ",
|
||||||
// "name": "$[{i18n_view_overview}]",
|
"name": "查询测试计划",
|
||||||
// "resourceId": "PROJECT_TRACK_PLAN"
|
"resourceId": "PROJECT_TRACK_PLAN"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "PROJECT_TRACK_PLAN:READ+CREATE",
|
"id": "PROJECT_TRACK_PLAN:READ+CREATE",
|
||||||
"name": "创建测试计划",
|
"name": "创建测试计划",
|
||||||
|
@ -434,11 +434,11 @@
|
||||||
"name": "关联/取消关联用例",
|
"name": "关联/取消关联用例",
|
||||||
"resourceId": "PROJECT_TRACK_PLAN"
|
"resourceId": "PROJECT_TRACK_PLAN"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "id": "PROJECT_API_DEFINITION:READ",
|
"id": "PROJECT_API_DEFINITION:READ",
|
||||||
// "name": "$[{i18n_view_overview}]",
|
"name": "查询接口",
|
||||||
// "resourceId": "PROJECT_API_DEFINITION"
|
"resourceId": "PROJECT_API_DEFINITION"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "PROJECT_API_DEFINITION:READ+CREATE_API",
|
"id": "PROJECT_API_DEFINITION:READ+CREATE_API",
|
||||||
"name": "创建接口",
|
"name": "创建接口",
|
||||||
|
@ -504,11 +504,11 @@
|
||||||
"name": "MOCK设置",
|
"name": "MOCK设置",
|
||||||
"resourceId": "PROJECT_API_DEFINITION"
|
"resourceId": "PROJECT_API_DEFINITION"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "id": "PROJECT_API_SCENARIO:READ",
|
"id": "PROJECT_API_SCENARIO:READ",
|
||||||
// "name": "$[{i18n_view_overview}]",
|
"name": "查询场景",
|
||||||
// "resourceId": "PROJECT_API_SCENARIO"
|
"resourceId": "PROJECT_API_SCENARIO"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "PROJECT_API_SCENARIO:READ+CREATE",
|
"id": "PROJECT_API_SCENARIO:READ+CREATE",
|
||||||
"name": "创建场景",
|
"name": "创建场景",
|
||||||
|
@ -564,21 +564,21 @@
|
||||||
"name": "创建性能测试",
|
"name": "创建性能测试",
|
||||||
"resourceId": "PROJECT_API_SCENARIO"
|
"resourceId": "PROJECT_API_SCENARIO"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "id": "PROJECT_API_REPORT:READ",
|
"id": "PROJECT_API_REPORT:READ",
|
||||||
// "name": "$[{i18n_view_overview}]",
|
"name": "查询报告",
|
||||||
// "resourceId": "PROJECT_API_REPORT"
|
"resourceId": "PROJECT_API_REPORT"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "PROJECT_API_REPORT:READ+DELETE",
|
"id": "PROJECT_API_REPORT:READ+DELETE",
|
||||||
"name": "删除报告",
|
"name": "删除报告",
|
||||||
"resourceId": "PROJECT_API_REPORT"
|
"resourceId": "PROJECT_API_REPORT"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "id": "PROJECT_PERFORMANCE_TEST:READ",
|
"id": "PROJECT_PERFORMANCE_TEST:READ",
|
||||||
// "name": "$[{i18n_view_overview}]",
|
"name": "查询测试",
|
||||||
// "resourceId": "PROJECT_PERFORMANCE_TEST"
|
"resourceId": "PROJECT_PERFORMANCE_TEST"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "PROJECT_PERFORMANCE_TEST:READ+CREATE",
|
"id": "PROJECT_PERFORMANCE_TEST:READ+CREATE",
|
||||||
"name": "创建测试",
|
"name": "创建测试",
|
||||||
|
@ -609,11 +609,11 @@
|
||||||
"name": "定时任务",
|
"name": "定时任务",
|
||||||
"resourceId": "PROJECT_PERFORMANCE_TEST"
|
"resourceId": "PROJECT_PERFORMANCE_TEST"
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// "id": "PROJECT_PERFORMANCE_REPORT:READ",
|
"id": "PROJECT_PERFORMANCE_REPORT:READ",
|
||||||
// "name": "$[{i18n_view_overview}]",
|
"name": "查询报告",
|
||||||
// "resourceId": "PROJECT_PERFORMANCE_REPORT"
|
"resourceId": "PROJECT_PERFORMANCE_REPORT"
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
"id": "PROJECT_PERFORMANCE_REPORT:READ+DELETE",
|
"id": "PROJECT_PERFORMANCE_REPORT:READ+DELETE",
|
||||||
"name": "删除报告",
|
"name": "删除报告",
|
||||||
|
@ -623,103 +623,103 @@
|
||||||
"resource": [
|
"resource": [
|
||||||
{
|
{
|
||||||
"id": "SYSTEM_USER",
|
"id": "SYSTEM_USER",
|
||||||
"name": "系统/用户"
|
"name": "用户"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "SYSTEM_ORGANIZATION",
|
"id": "SYSTEM_ORGANIZATION",
|
||||||
"name": "系统/组织"
|
"name": "组织"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "SYSTEM_WORKSPACE",
|
"id": "SYSTEM_WORKSPACE",
|
||||||
"name": "系统/工作空间"
|
"name": "工作空间"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "SYSTEM_GROUP",
|
"id": "SYSTEM_GROUP",
|
||||||
"name": "系统/用户组与权限"
|
"name": "用户组与权限"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "SYSTEM_SETTING",
|
"id": "SYSTEM_SETTING",
|
||||||
"name": "系统/系统参数设置"
|
"name": "系统参数设置"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "SYSTEM_QUOTA",
|
"id": "SYSTEM_QUOTA",
|
||||||
"name": "系统/配额管理"
|
"name": "配额管理"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "SYSTEM_AUTH",
|
"id": "SYSTEM_AUTH",
|
||||||
"name": "系统/授权管理"
|
"name": "授权管理"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "ORGANIZATION_USER",
|
"id": "ORGANIZATION_USER",
|
||||||
"name": "组织/成员"
|
"name": "成员"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "ORGANIZATION_WORKSPACE",
|
"id": "ORGANIZATION_WORKSPACE",
|
||||||
"name": "组织/工作空间"
|
"name": "工作空间"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "ORGANIZATION_GROUP",
|
"id": "ORGANIZATION_GROUP",
|
||||||
"name": "组织/用户组与权限"
|
"name": "用户组与权限"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "ORGANIZATION_SERVICE",
|
"id": "ORGANIZATION_SERVICE",
|
||||||
"name": "组织/服务集成"
|
"name": "服务集成"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "ORGANIZATION_MESSAGE",
|
"id": "ORGANIZATION_MESSAGE",
|
||||||
"name": "组织/消息设置"
|
"name": "消息设置"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "WORKSPACE_USER",
|
"id": "WORKSPACE_USER",
|
||||||
"name": "工作空间/成员"
|
"name": "成员"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "WORKSPACE_TEMPLATE",
|
"id": "WORKSPACE_TEMPLATE",
|
||||||
"name": "工作空间/模版设置"
|
"name": "模版设置"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "PROJECT_USER",
|
"id": "PROJECT_USER",
|
||||||
"name": "项目/成员"
|
"name": "成员"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "PROJECT_MANAGER",
|
"id": "PROJECT_MANAGER",
|
||||||
"name": "项目/项目管理"
|
"name": "项目管理"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "PROJECT_ENVIRONMENT",
|
"id": "PROJECT_ENVIRONMENT",
|
||||||
"name": "项目/环境设置"
|
"name": "环境设置"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "PROJECT_TRACK_CASE",
|
"id": "PROJECT_TRACK_CASE",
|
||||||
"name": "项目/测试用例"
|
"name": "测试用例"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "PROJECT_TRACK_REVIEW",
|
"id": "PROJECT_TRACK_REVIEW",
|
||||||
"name": "项目/测试评审"
|
"name": "测试评审"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "PROJECT_TRACK_PLAN",
|
"id": "PROJECT_TRACK_PLAN",
|
||||||
"name": "项目/测试计划"
|
"name": "测试计划"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "PROJECT_API_DEFINITION",
|
"id": "PROJECT_API_DEFINITION",
|
||||||
"name": "项目/接口定义"
|
"name": "接口定义"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "PROJECT_API_SCENARIO",
|
"id": "PROJECT_API_SCENARIO",
|
||||||
"name": "项目/接口自动化"
|
"name": "接口自动化"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "PROJECT_API_REPORT",
|
"id": "PROJECT_API_REPORT",
|
||||||
"name": "项目/测试报告"
|
"name": "测试报告"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "PROJECT_PERFORMANCE_TEST",
|
"id": "PROJECT_PERFORMANCE_TEST",
|
||||||
"name": "项目/测试"
|
"name": "测试"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "PROJECT_PERFORMANCE_REPORT",
|
"id": "PROJECT_PERFORMANCE_REPORT",
|
||||||
"name": "项目/报告"
|
"name": "报告"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@
|
||||||
:key="index"
|
:key="index"
|
||||||
:effect="effect"
|
:effect="effect"
|
||||||
:type="type"
|
:type="type"
|
||||||
:content="$t('role.' + role.id)"/>
|
:content="role.name"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,329 @@
|
||||||
|
<template>
|
||||||
|
<el-dialog :close-on-click-modal="false" :title="title"
|
||||||
|
:visible.sync="createVisible" width="35%"
|
||||||
|
@closed="handleClose" class="edit-user-dialog"
|
||||||
|
:destroy-on-close="true">
|
||||||
|
<div v-loading="result.loading">
|
||||||
|
<el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule" ref="createUserForm">
|
||||||
|
<el-form-item label="ID" prop="id">
|
||||||
|
<el-input v-model="form.id" autocomplete="off" :placeholder="$t('user.input_id_placeholder')"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="$t('commons.username')" prop="name">
|
||||||
|
<el-input v-model="form.name" autocomplete="off" :placeholder="$t('user.input_name')"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="$t('commons.email')" prop="email">
|
||||||
|
<el-input v-model="form.email" autocomplete="off" :placeholder="$t('user.input_email')"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="$t('commons.phone')" prop="phone">
|
||||||
|
<el-input v-model="form.phone" autocomplete="off" :placeholder="$t('user.input_phone')"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="$t('commons.password')" prop="password" v-if="type === 'Add'">
|
||||||
|
<el-input v-model="form.password" autocomplete="new-password" show-password
|
||||||
|
:placeholder="$t('user.input_password')"/>
|
||||||
|
</el-form-item>
|
||||||
|
<div v-for="(group, index) in form.groups" :key="index">
|
||||||
|
<el-form-item :label="'用户组'+index"
|
||||||
|
:prop="'groups.' + index + '.type'"
|
||||||
|
:rules="{required: true, message: '请选择用户组', trigger: 'change'}"
|
||||||
|
>
|
||||||
|
<el-select filterable v-model="group.type" placeholder="请选择用户组" :disabled="!!group.type"
|
||||||
|
class="edit-user-select" @change="getResource(group.type, index)">
|
||||||
|
<el-option
|
||||||
|
v-for="item in activeGroup(group)"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id + '+' +item.type"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
<el-button @click.prevent="removeGroup(group)" style="margin-left: 20px;" v-if="form.groups.length > 1">
|
||||||
|
{{ $t('commons.delete') }}
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
<div v-if="groupType(group.type) === org">
|
||||||
|
<el-form-item :label="$t('organization.select_organization')"
|
||||||
|
:prop="'groups.' + index + '.ids'"
|
||||||
|
:rules="{required: true, message: $t('organization.select_organization'), trigger: 'change'}"
|
||||||
|
>
|
||||||
|
<el-select filterable v-model="group.ids" :placeholder="$t('organization.select_organization')" multiple
|
||||||
|
class="edit-user-select">
|
||||||
|
<el-option
|
||||||
|
v-for="item in group.organizations"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
<div v-if="groupType(group.type) === ws">
|
||||||
|
<el-form-item :label="$t('workspace.select')"
|
||||||
|
:prop="'groups.' + index + '.ids'"
|
||||||
|
:rules="{required: true, message: $t('workspace.select'), trigger: 'change'}"
|
||||||
|
>
|
||||||
|
<el-select filterable v-model="group.ids" :placeholder="$t('workspace.select')" multiple
|
||||||
|
class="edit-user-select">
|
||||||
|
<el-option
|
||||||
|
v-for="item in group.workspaces"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
<div v-if="groupType(group.type) === project">
|
||||||
|
<el-form-item label="选择项目"
|
||||||
|
:prop="'groups.' + index + '.ids'"
|
||||||
|
:rules="{required: true, message: '请选择项目', trigger: 'change'}"
|
||||||
|
>
|
||||||
|
<el-select filterable v-model="group.ids" placeholder="请选择项目" multiple
|
||||||
|
class="edit-user-select">
|
||||||
|
<el-option
|
||||||
|
v-for="item in group.projects"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<template>
|
||||||
|
<el-button type="success" style="width: 100%;" @click="addGroup('createUserForm')" :disabled="btnAddRole">
|
||||||
|
{{ $t('role.add') }}
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<template v-slot:footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="createVisible = false" size="medium">{{ $t('commons.cancel') }}</el-button>
|
||||||
|
<el-button type="primary" @click="createUser('createUserForm')" @keydown.enter.native.prevent size="medium">
|
||||||
|
{{ $t('commons.confirm') }}
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {PHONE_REGEX} from "@/common/js/regex";
|
||||||
|
import {GROUP_ORGANIZATION, GROUP_PROJECT, GROUP_SYSTEM, GROUP_WORKSPACE} from "@/common/js/constants";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "EditUser",
|
||||||
|
components: {},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
result: {},
|
||||||
|
createVisible: false,
|
||||||
|
updateVisible: false,
|
||||||
|
btnAddRole: false,
|
||||||
|
form: {
|
||||||
|
groups: [{
|
||||||
|
type: ''
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
rule: {
|
||||||
|
id: [
|
||||||
|
{required: true, message: this.$t('user.input_id'), trigger: 'blur'},
|
||||||
|
{min: 1, max: 50, message: this.$t('commons.input_limit', [1, 50]), trigger: 'blur'},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
pattern: '^[^\u4e00-\u9fa5]+$',
|
||||||
|
message: this.$t('user.special_characters_are_not_supported'),
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
name: [
|
||||||
|
{required: true, message: this.$t('user.input_name'), trigger: 'blur'},
|
||||||
|
{min: 2, max: 50, message: this.$t('commons.input_limit', [2, 50]), trigger: 'blur'},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: this.$t('user.special_characters_are_not_supported'),
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
phone: [
|
||||||
|
{
|
||||||
|
pattern: PHONE_REGEX,
|
||||||
|
message: this.$t('user.mobile_number_format_is_incorrect'),
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
email: [
|
||||||
|
{required: true, message: this.$t('user.input_email'), trigger: 'blur'},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
pattern: /^[a-zA-Z0-9_._-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/,
|
||||||
|
message: this.$t('user.email_format_is_incorrect'),
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
password: [
|
||||||
|
{required: true, message: this.$t('user.input_password'), trigger: 'blur'},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^]{8,30}$/,
|
||||||
|
message: this.$t('member.password_format_is_incorrect'),
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
},
|
||||||
|
userGroup: [],
|
||||||
|
organizations: [],
|
||||||
|
workspaces: [],
|
||||||
|
projects: [],
|
||||||
|
type: "Add",
|
||||||
|
title: "创建用户",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
org() {
|
||||||
|
return GROUP_ORGANIZATION;
|
||||||
|
},
|
||||||
|
ws() {
|
||||||
|
return GROUP_WORKSPACE;
|
||||||
|
},
|
||||||
|
project() {
|
||||||
|
return GROUP_PROJECT;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
open(type, title, row) {
|
||||||
|
this.type = type ? type : this.type;
|
||||||
|
this.title = title ? title : this.title;
|
||||||
|
|
||||||
|
if (type === 'Edit') {
|
||||||
|
this.$get('/user/group/all/' + encodeURIComponent(row.id), response => {
|
||||||
|
let data = response.data;
|
||||||
|
this.$set(this.form, "groups", data);
|
||||||
|
});
|
||||||
|
this.form = Object.assign({}, row);
|
||||||
|
}
|
||||||
|
this.createVisible = true;
|
||||||
|
this.getAllUserGroup();
|
||||||
|
},
|
||||||
|
handleClose() {
|
||||||
|
this.createVisible = false;
|
||||||
|
this.form = {groups: [{type: ''}]};
|
||||||
|
this.btnAddRole = false;
|
||||||
|
},
|
||||||
|
activeGroup(roleInfo) {
|
||||||
|
return this.userGroup.filter(function (group) {
|
||||||
|
let value = true;
|
||||||
|
if (!roleInfo.selects) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (roleInfo.selects.length === 0) {
|
||||||
|
value = true;
|
||||||
|
}
|
||||||
|
for (let i = 0; i < roleInfo.selects.length; i++) {
|
||||||
|
let idType = group.id + "+" + group.type;
|
||||||
|
if (idType === roleInfo.selects[i]) {
|
||||||
|
value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
removeGroup(item) {
|
||||||
|
let index = this.form.groups.indexOf(item);
|
||||||
|
if (index !== -1) {
|
||||||
|
this.form.groups.splice(index, 1)
|
||||||
|
}
|
||||||
|
if (this.form.groups.length < this.userGroup.length) {
|
||||||
|
this.btnAddRole = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
addGroup(validForm) {
|
||||||
|
this.$refs[validForm].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
let roleInfo = {};
|
||||||
|
roleInfo.selects = [];
|
||||||
|
let ids = this.form.groups.map(r => r.type);
|
||||||
|
ids.forEach(id => {
|
||||||
|
roleInfo.selects.push(id);
|
||||||
|
})
|
||||||
|
let groups = this.form.groups;
|
||||||
|
groups.push(roleInfo);
|
||||||
|
if (this.form.groups.length > this.userGroup.length - 1) {
|
||||||
|
this.btnAddRole = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
createUser(createUserForm) {
|
||||||
|
this.$refs[createUserForm].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
this.result = this.$post('/user/special/add', this.form, () => {
|
||||||
|
this.$success(this.$t('commons.save_success'));
|
||||||
|
this.$emit("refresh");
|
||||||
|
this.createVisible = false;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getAllUserGroup() {
|
||||||
|
this.$post('/user/group/get', {type: GROUP_SYSTEM}, res => {
|
||||||
|
let data = res.data;
|
||||||
|
if (data) {
|
||||||
|
this.userGroup = data;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
groupType(idType) {
|
||||||
|
if (!idType) return;
|
||||||
|
return idType.split("+")[1];
|
||||||
|
},
|
||||||
|
getResource(idType, index) {
|
||||||
|
if (!idType) return;
|
||||||
|
let id = idType.split("+")[0];
|
||||||
|
let type = idType.split("+")[1];
|
||||||
|
this.result = this.$get('/organization/list/resource/' + id + "/" + type, res => {
|
||||||
|
let data = res.data;
|
||||||
|
if (data) {
|
||||||
|
this._setResource(data, index, type);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
_setResource(data, index, type) {
|
||||||
|
switch (type) {
|
||||||
|
case GROUP_ORGANIZATION:
|
||||||
|
this.form.groups[index].organizations = data.organizations;
|
||||||
|
break;
|
||||||
|
case GROUP_WORKSPACE:
|
||||||
|
this.form.groups[index].workspaces = data.workspaces;
|
||||||
|
break;
|
||||||
|
case GROUP_PROJECT:
|
||||||
|
this.form.groups[index].projects = data.projects;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.edit-user-dialog >>> .el-dialog__body {
|
||||||
|
padding-bottom: 0;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.edit-user-dialog >>> .el-dialog__footer {
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.edit-user-select {
|
||||||
|
width: 80%;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -68,261 +68,261 @@
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<!--Create user-->
|
<!--Create user-->
|
||||||
<el-dialog :close-on-click-modal="false" :title="$t('user.create')" :visible.sync="createVisible" width="35%"
|
<!-- <el-dialog :close-on-click-modal="false" :title="$t('user.create')" :visible.sync="createVisible" width="35%"-->
|
||||||
@closed="handleClose"
|
<!-- @closed="handleClose"-->
|
||||||
:destroy-on-close="true">
|
<!-- :destroy-on-close="true">-->
|
||||||
<el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule" ref="createUserForm">
|
<!-- <el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule" ref="createUserForm">-->
|
||||||
<el-form-item label="ID" prop="id">
|
<!-- <el-form-item label="ID" prop="id">-->
|
||||||
<el-input v-model="form.id" autocomplete="off" :placeholder="$t('user.input_id_placeholder')"/>
|
<!-- <el-input v-model="form.id" autocomplete="off" :placeholder="$t('user.input_id_placeholder')"/>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
<el-form-item :label="$t('commons.username')" prop="name">
|
<!-- <el-form-item :label="$t('commons.username')" prop="name">-->
|
||||||
<el-input v-model="form.name" autocomplete="off" :placeholder="$t('user.input_name')"/>
|
<!-- <el-input v-model="form.name" autocomplete="off" :placeholder="$t('user.input_name')"/>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
<el-form-item :label="$t('commons.email')" prop="email">
|
<!-- <el-form-item :label="$t('commons.email')" prop="email">-->
|
||||||
<el-input v-model="form.email" autocomplete="off" :placeholder="$t('user.input_email')"/>
|
<!-- <el-input v-model="form.email" autocomplete="off" :placeholder="$t('user.input_email')"/>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
<el-form-item :label="$t('commons.phone')" prop="phone">
|
<!-- <el-form-item :label="$t('commons.phone')" prop="phone">-->
|
||||||
<el-input v-model="form.phone" autocomplete="off" :placeholder="$t('user.input_phone')"/>
|
<!-- <el-input v-model="form.phone" autocomplete="off" :placeholder="$t('user.input_phone')"/>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
<el-form-item :label="$t('commons.password')" prop="password" style="margin-bottom: 29px">
|
<!-- <el-form-item :label="$t('commons.password')" prop="password" style="margin-bottom: 29px">-->
|
||||||
<el-input v-model="form.password" autocomplete="new-password" show-password
|
<!-- <el-input v-model="form.password" autocomplete="new-password" show-password-->
|
||||||
:placeholder="$t('user.input_password')"/>
|
<!-- :placeholder="$t('user.input_password')"/>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
<div v-for="(role, index) in form.roles" :key="index">
|
<!-- <div v-for="(role, index) in form.roles" :key="index">-->
|
||||||
<el-form-item :label="$t('commons.role')+index"
|
<!-- <el-form-item :label="$t('commons.role')+index"-->
|
||||||
:prop="'roles.' + index + '.id'"
|
<!-- :prop="'roles.' + index + '.id'"-->
|
||||||
:rules="{required: true, message: $t('role.please_choose_role'), trigger: 'change'}"
|
<!-- :rules="{required: true, message: $t('role.please_choose_role'), trigger: 'change'}"-->
|
||||||
>
|
<!-- >-->
|
||||||
<el-select filterable v-model="role.id" :placeholder="$t('role.please_choose_role')">
|
<!-- <el-select filterable v-model="role.id" :placeholder="$t('role.please_choose_role')">-->
|
||||||
<el-option
|
<!-- <el-option-->
|
||||||
v-for="item in activeRole(role)"
|
<!-- v-for="item in activeRole(role)"-->
|
||||||
:key="item.id"
|
<!-- :key="item.id"-->
|
||||||
:label="$t('role.' + item.id)"
|
<!-- :label="$t('role.' + item.id)"-->
|
||||||
:value="item.id"
|
<!-- :value="item.id"-->
|
||||||
>
|
<!-- >-->
|
||||||
{{ $t('role.' + item.id) }}
|
<!-- {{ $t('role.' + item.id) }}-->
|
||||||
</el-option>
|
<!-- </el-option>-->
|
||||||
</el-select>
|
<!-- </el-select>-->
|
||||||
<el-button @click.prevent="removeRole(role)" style="margin-left: 20px;" v-if="form.roles.length > 1">
|
<!-- <el-button @click.prevent="removeRole(role)" style="margin-left: 20px;" v-if="form.roles.length > 1">-->
|
||||||
{{ $t('commons.delete') }}
|
<!-- {{ $t('commons.delete') }}-->
|
||||||
</el-button>
|
<!-- </el-button>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
<div v-if="role.id === 'org_admin'">
|
<!-- <div v-if="role.id === 'org_admin'">-->
|
||||||
<el-form-item :label="$t('organization.select_organization')"
|
<!-- <el-form-item :label="$t('organization.select_organization')"-->
|
||||||
:prop="'roles.' + index + '.ids'"
|
<!-- :prop="'roles.' + index + '.ids'"-->
|
||||||
:rules="{required: true, message: $t('organization.select_organization'), trigger: 'change'}"
|
<!-- :rules="{required: true, message: $t('organization.select_organization'), trigger: 'change'}"-->
|
||||||
>
|
<!-- >-->
|
||||||
<el-select filterable v-model="role.ids" :placeholder="$t('organization.select_organization')" multiple>
|
<!-- <el-select filterable v-model="role.ids" :placeholder="$t('organization.select_organization')" multiple>-->
|
||||||
<el-option
|
<!-- <el-option-->
|
||||||
v-for="item in form.orgList"
|
<!-- v-for="item in form.orgList"-->
|
||||||
:key="item.id"
|
<!-- :key="item.id"-->
|
||||||
:label="item.name"
|
<!-- :label="item.name"-->
|
||||||
:value="item.id">
|
<!-- :value="item.id">-->
|
||||||
</el-option>
|
<!-- </el-option>-->
|
||||||
</el-select>
|
<!-- </el-select>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
<div v-if="role.id === 'org_member'">
|
<!-- <div v-if="role.id === 'org_member'">-->
|
||||||
<el-form-item :label="$t('organization.select_organization')"
|
<!-- <el-form-item :label="$t('organization.select_organization')"-->
|
||||||
:prop="'roles.' + index + '.ids'"
|
<!-- :prop="'roles.' + index + '.ids'"-->
|
||||||
:rules="{required: true, message: $t('organization.select_organization'), trigger: 'change'}"
|
<!-- :rules="{required: true, message: $t('organization.select_organization'), trigger: 'change'}"-->
|
||||||
>
|
<!-- >-->
|
||||||
<el-select filterable v-model="role.ids" :placeholder="$t('organization.select_organization')" multiple>
|
<!-- <el-select filterable v-model="role.ids" :placeholder="$t('organization.select_organization')" multiple>-->
|
||||||
<el-option
|
<!-- <el-option-->
|
||||||
v-for="item in form.orgList"
|
<!-- v-for="item in form.orgList"-->
|
||||||
:key="item.id"
|
<!-- :key="item.id"-->
|
||||||
:label="item.name"
|
<!-- :label="item.name"-->
|
||||||
:value="item.id">
|
<!-- :value="item.id">-->
|
||||||
</el-option>
|
<!-- </el-option>-->
|
||||||
</el-select>
|
<!-- </el-select>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
<div v-if="role.id === 'test_manager'">
|
<!-- <div v-if="role.id === 'test_manager'">-->
|
||||||
<el-form-item :label="$t('workspace.select')"
|
<!-- <el-form-item :label="$t('workspace.select')"-->
|
||||||
:prop="'roles.' + index + '.ids'"
|
<!-- :prop="'roles.' + index + '.ids'"-->
|
||||||
:rules="{required: true, message: $t('workspace.select'), trigger: 'change'}"
|
<!-- :rules="{required: true, message: $t('workspace.select'), trigger: 'change'}"-->
|
||||||
>
|
<!-- >-->
|
||||||
<el-select filterable v-model="role.ids" :placeholder="$t('workspace.select')" multiple>
|
<!-- <el-select filterable v-model="role.ids" :placeholder="$t('workspace.select')" multiple>-->
|
||||||
<el-option
|
<!-- <el-option-->
|
||||||
v-for="item in form.wsList"
|
<!-- v-for="item in form.wsList"-->
|
||||||
:key="item.id"
|
<!-- :key="item.id"-->
|
||||||
:label="item.name"
|
<!-- :label="item.name"-->
|
||||||
:value="item.id">
|
<!-- :value="item.id">-->
|
||||||
</el-option>
|
<!-- </el-option>-->
|
||||||
</el-select>
|
<!-- </el-select>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
<div v-if="role.id ==='test_user'">
|
<!-- <div v-if="role.id ==='test_user'">-->
|
||||||
<el-form-item :label="$t('workspace.select')"
|
<!-- <el-form-item :label="$t('workspace.select')"-->
|
||||||
:prop="'roles.' + index + '.ids'"
|
<!-- :prop="'roles.' + index + '.ids'"-->
|
||||||
:rules="{required: true, message: $t('workspace.select'), trigger: 'change'}"
|
<!-- :rules="{required: true, message: $t('workspace.select'), trigger: 'change'}"-->
|
||||||
>
|
<!-- >-->
|
||||||
<el-select filterable v-model="role.ids" :placeholder="$t('workspace.select')" multiple>
|
<!-- <el-select filterable v-model="role.ids" :placeholder="$t('workspace.select')" multiple>-->
|
||||||
<el-option
|
<!-- <el-option-->
|
||||||
v-for="item in form.wsList"
|
<!-- v-for="item in form.wsList"-->
|
||||||
:key="item.id"
|
<!-- :key="item.id"-->
|
||||||
:label="item.name"
|
<!-- :label="item.name"-->
|
||||||
:value="item.id">
|
<!-- :value="item.id">-->
|
||||||
</el-option>
|
<!-- </el-option>-->
|
||||||
</el-select>
|
<!-- </el-select>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
<div v-if="role.id ==='test_viewer'">
|
<!-- <div v-if="role.id ==='test_viewer'">-->
|
||||||
<el-form-item :label="$t('workspace.select')"
|
<!-- <el-form-item :label="$t('workspace.select')"-->
|
||||||
:prop="'roles.' + index + '.ids'"
|
<!-- :prop="'roles.' + index + '.ids'"-->
|
||||||
:rules="{required: true, message: $t('workspace.select'), trigger: 'change'}"
|
<!-- :rules="{required: true, message: $t('workspace.select'), trigger: 'change'}"-->
|
||||||
>
|
<!-- >-->
|
||||||
<el-select filterable v-model="role.ids" :placeholder="$t('workspace.select')" multiple>
|
<!-- <el-select filterable v-model="role.ids" :placeholder="$t('workspace.select')" multiple>-->
|
||||||
<el-option
|
<!-- <el-option-->
|
||||||
v-for="item in form.wsList"
|
<!-- v-for="item in form.wsList"-->
|
||||||
:key="item.id"
|
<!-- :key="item.id"-->
|
||||||
:label="item.name"
|
<!-- :label="item.name"-->
|
||||||
:value="item.id">
|
<!-- :value="item.id">-->
|
||||||
</el-option>
|
<!-- </el-option>-->
|
||||||
</el-select>
|
<!-- </el-select>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
|
|
||||||
<el-form-item>
|
<!-- <el-form-item>-->
|
||||||
<template>
|
<!-- <template>-->
|
||||||
<el-button type="success" style="width: 100%;" @click="addRole('createUserForm')" :disabled="btnAddRole">
|
<!-- <el-button type="success" style="width: 100%;" @click="addRole('createUserForm')" :disabled="btnAddRole">-->
|
||||||
{{ $t('role.add') }}
|
<!-- {{ $t('role.add') }}-->
|
||||||
</el-button>
|
<!-- </el-button>-->
|
||||||
</template>
|
<!-- </template>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
</el-form>
|
<!-- </el-form>-->
|
||||||
<template v-slot:footer>
|
<!-- <template v-slot:footer>-->
|
||||||
<ms-dialog-footer
|
<!-- <ms-dialog-footer-->
|
||||||
@cancel="createVisible = false"
|
<!-- @cancel="createVisible = false"-->
|
||||||
@confirm="createUser('createUserForm')"/>
|
<!-- @confirm="createUser('createUserForm')"/>-->
|
||||||
</template>
|
<!-- </template>-->
|
||||||
</el-dialog>
|
<!-- </el-dialog>-->
|
||||||
|
|
||||||
<!--Modify user information in system settings-->
|
<!--Modify user information in system settings-->
|
||||||
<el-dialog :close-on-click-modal="false" :title="$t('user.modify')" :visible.sync="updateVisible" width="35%"
|
<!-- <el-dialog :close-on-click-modal="false" :title="$t('user.modify')" :visible.sync="updateVisible" width="35%"-->
|
||||||
:destroy-on-close="true"
|
<!-- :destroy-on-close="true"-->
|
||||||
@close="handleClose" v-loading="result.loading">
|
<!-- @close="handleClose" v-loading="result.loading">-->
|
||||||
<el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule" ref="updateUserForm">
|
<!-- <el-form :model="form" label-position="right" label-width="120px" size="small" :rules="rule" ref="updateUserForm">-->
|
||||||
<el-form-item label="ID" prop="id">
|
<!-- <el-form-item label="ID" prop="id">-->
|
||||||
<el-input v-model="form.id" autocomplete="off" :disabled="true"/>
|
<!-- <el-input v-model="form.id" autocomplete="off" :disabled="true"/>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
<el-form-item :label="$t('commons.username')" prop="name">
|
<!-- <el-form-item :label="$t('commons.username')" prop="name">-->
|
||||||
<el-input v-model="form.name" autocomplete="off"/>
|
<!-- <el-input v-model="form.name" autocomplete="off"/>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
<el-form-item :label="$t('commons.email')" prop="email">
|
<!-- <el-form-item :label="$t('commons.email')" prop="email">-->
|
||||||
<el-input v-model="form.email" autocomplete="off" :disabled="form.source === 'LDAP'"/>
|
<!-- <el-input v-model="form.email" autocomplete="off" :disabled="form.source === 'LDAP'"/>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
<el-form-item :label="$t('commons.phone')" prop="phone">
|
<!-- <el-form-item :label="$t('commons.phone')" prop="phone">-->
|
||||||
<el-input v-model="form.phone" autocomplete="off"/>
|
<!-- <el-input v-model="form.phone" autocomplete="off"/>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
<div v-for="(role, index) in form.roles" :key="index">
|
<!-- <div v-for="(role, index) in form.roles" :key="index">-->
|
||||||
<el-form-item :label="$t('commons.role')+index"
|
<!-- <el-form-item :label="$t('commons.role')+index"-->
|
||||||
:prop="'roles.' + index + '.id'"
|
<!-- :prop="'roles.' + index + '.id'"-->
|
||||||
:rules="{required: true, message: $t('role.please_choose_role'), trigger: 'change'}"
|
<!-- :rules="{required: true, message: $t('role.please_choose_role'), trigger: 'change'}"-->
|
||||||
>
|
<!-- >-->
|
||||||
<el-select filterable v-model="role.id" :placeholder="$t('role.please_choose_role')" :disabled="!!role.id">
|
<!-- <el-select filterable v-model="role.id" :placeholder="$t('role.please_choose_role')" :disabled="!!role.id">-->
|
||||||
<el-option
|
<!-- <el-option-->
|
||||||
v-for="item in activeRole(role)"
|
<!-- v-for="item in activeRole(role)"-->
|
||||||
:key="item.id"
|
<!-- :key="item.id"-->
|
||||||
:label="$t('role.' + item.id)"
|
<!-- :label="$t('role.' + item.id)"-->
|
||||||
:value="item.id">
|
<!-- :value="item.id">-->
|
||||||
</el-option>
|
<!-- </el-option>-->
|
||||||
</el-select>
|
<!-- </el-select>-->
|
||||||
<el-button @click.prevent="removeRole(role)" style="margin-left: 20px;" v-if="form.roles.length > 1">
|
<!-- <el-button @click.prevent="removeRole(role)" style="margin-left: 20px;" v-if="form.roles.length > 1">-->
|
||||||
{{ $t('commons.delete') }}
|
<!-- {{ $t('commons.delete') }}-->
|
||||||
</el-button>
|
<!-- </el-button>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
<div v-if="role.id === 'org_admin'">
|
<!-- <div v-if="role.id === 'org_admin'">-->
|
||||||
<el-form-item :label="$t('organization.select_organization')"
|
<!-- <el-form-item :label="$t('organization.select_organization')"-->
|
||||||
:prop="'roles.' + index + '.ids'"
|
<!-- :prop="'roles.' + index + '.ids'"-->
|
||||||
:rules="{required: true, message: $t('organization.select_organization'), trigger: 'change'}"
|
<!-- :rules="{required: true, message: $t('organization.select_organization'), trigger: 'change'}"-->
|
||||||
>
|
<!-- >-->
|
||||||
<el-select filterable v-model="role.ids" :placeholder="$t('organization.select_organization')" multiple>
|
<!-- <el-select filterable v-model="role.ids" :placeholder="$t('organization.select_organization')" multiple>-->
|
||||||
<el-option
|
<!-- <el-option-->
|
||||||
v-for="item in form.orgList"
|
<!-- v-for="item in form.orgList"-->
|
||||||
:key="item.id"
|
<!-- :key="item.id"-->
|
||||||
:label="item.name"
|
<!-- :label="item.name"-->
|
||||||
:value="item.id">
|
<!-- :value="item.id">-->
|
||||||
</el-option>
|
<!-- </el-option>-->
|
||||||
</el-select>
|
<!-- </el-select>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
<div v-if="role.id === 'org_member'">
|
<!-- <div v-if="role.id === 'org_member'">-->
|
||||||
<el-form-item :label="$t('organization.select_organization')"
|
<!-- <el-form-item :label="$t('organization.select_organization')"-->
|
||||||
:prop="'roles.' + index + '.ids'"
|
<!-- :prop="'roles.' + index + '.ids'"-->
|
||||||
:rules="{required: true, message: $t('organization.select_organization'), trigger: 'change'}"
|
<!-- :rules="{required: true, message: $t('organization.select_organization'), trigger: 'change'}"-->
|
||||||
>
|
<!-- >-->
|
||||||
<el-select filterable v-model="role.ids" :placeholder="$t('organization.select_organization')" multiple>
|
<!-- <el-select filterable v-model="role.ids" :placeholder="$t('organization.select_organization')" multiple>-->
|
||||||
<el-option
|
<!-- <el-option-->
|
||||||
v-for="item in form.orgList"
|
<!-- v-for="item in form.orgList"-->
|
||||||
:key="item.id"
|
<!-- :key="item.id"-->
|
||||||
:label="item.name"
|
<!-- :label="item.name"-->
|
||||||
:value="item.id">
|
<!-- :value="item.id">-->
|
||||||
</el-option>
|
<!-- </el-option>-->
|
||||||
</el-select>
|
<!-- </el-select>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
<div v-if="role.id === 'test_manager'">
|
<!-- <div v-if="role.id === 'test_manager'">-->
|
||||||
<el-form-item :label="$t('workspace.select')"
|
<!-- <el-form-item :label="$t('workspace.select')"-->
|
||||||
:prop="'roles.' + index + '.ids'"
|
<!-- :prop="'roles.' + index + '.ids'"-->
|
||||||
:rules="{required: true, message: $t('workspace.select'), trigger: 'change'}"
|
<!-- :rules="{required: true, message: $t('workspace.select'), trigger: 'change'}"-->
|
||||||
>
|
<!-- >-->
|
||||||
<el-select filterable v-model="role.ids" :placeholder="$t('workspace.select')" multiple>
|
<!-- <el-select filterable v-model="role.ids" :placeholder="$t('workspace.select')" multiple>-->
|
||||||
<el-option
|
<!-- <el-option-->
|
||||||
v-for="item in form.wsList"
|
<!-- v-for="item in form.wsList"-->
|
||||||
:key="item.id"
|
<!-- :key="item.id"-->
|
||||||
:label="item.name"
|
<!-- :label="item.name"-->
|
||||||
:value="item.id">
|
<!-- :value="item.id">-->
|
||||||
</el-option>
|
<!-- </el-option>-->
|
||||||
</el-select>
|
<!-- </el-select>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
<div v-if="role.id ==='test_user'">
|
<!-- <div v-if="role.id ==='test_user'">-->
|
||||||
<el-form-item :label="$t('workspace.select')"
|
<!-- <el-form-item :label="$t('workspace.select')"-->
|
||||||
:prop="'roles.' + index + '.ids'"
|
<!-- :prop="'roles.' + index + '.ids'"-->
|
||||||
:rules="{required: true, message: $t('workspace.select'), trigger: 'change'}"
|
<!-- :rules="{required: true, message: $t('workspace.select'), trigger: 'change'}"-->
|
||||||
>
|
<!-- >-->
|
||||||
<el-select filterable v-model="role.ids" :placeholder="$t('workspace.select')" multiple>
|
<!-- <el-select filterable v-model="role.ids" :placeholder="$t('workspace.select')" multiple>-->
|
||||||
<el-option
|
<!-- <el-option-->
|
||||||
v-for="item in form.wsList"
|
<!-- v-for="item in form.wsList"-->
|
||||||
:key="item.id"
|
<!-- :key="item.id"-->
|
||||||
:label="item.name"
|
<!-- :label="item.name"-->
|
||||||
:value="item.id">
|
<!-- :value="item.id">-->
|
||||||
</el-option>
|
<!-- </el-option>-->
|
||||||
</el-select>
|
<!-- </el-select>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
<div v-if="role.id ==='test_viewer'">
|
<!-- <div v-if="role.id ==='test_viewer'">-->
|
||||||
<el-form-item :label="$t('workspace.select')"
|
<!-- <el-form-item :label="$t('workspace.select')"-->
|
||||||
:prop="'roles.' + index + '.ids'"
|
<!-- :prop="'roles.' + index + '.ids'"-->
|
||||||
:rules="{required: true, message: $t('workspace.select'), trigger: 'change'}"
|
<!-- :rules="{required: true, message: $t('workspace.select'), trigger: 'change'}"-->
|
||||||
>
|
<!-- >-->
|
||||||
<el-select filterable v-model="role.ids" :placeholder="$t('workspace.select')" multiple>
|
<!-- <el-select filterable v-model="role.ids" :placeholder="$t('workspace.select')" multiple>-->
|
||||||
<el-option
|
<!-- <el-option-->
|
||||||
v-for="item in form.wsList"
|
<!-- v-for="item in form.wsList"-->
|
||||||
:key="item.id"
|
<!-- :key="item.id"-->
|
||||||
:label="item.name"
|
<!-- :label="item.name"-->
|
||||||
:value="item.id">
|
<!-- :value="item.id">-->
|
||||||
</el-option>
|
<!-- </el-option>-->
|
||||||
</el-select>
|
<!-- </el-select>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
<el-form-item>
|
<!-- <el-form-item>-->
|
||||||
<template>
|
<!-- <template>-->
|
||||||
<el-button type="success" style="width: 100%;" @click="addRole('updateUserForm')" :disabled="btnAddRole">
|
<!-- <el-button type="success" style="width: 100%;" @click="addRole('updateUserForm')" :disabled="btnAddRole">-->
|
||||||
{{ $t('role.add') }}
|
<!-- {{ $t('role.add') }}-->
|
||||||
</el-button>
|
<!-- </el-button>-->
|
||||||
</template>
|
<!-- </template>-->
|
||||||
</el-form-item>
|
<!-- </el-form-item>-->
|
||||||
</el-form>
|
<!-- </el-form>-->
|
||||||
<template v-slot:footer>
|
<!-- <template v-slot:footer>-->
|
||||||
<ms-dialog-footer
|
<!-- <ms-dialog-footer-->
|
||||||
@cancel="updateVisible = false"
|
<!-- @cancel="updateVisible = false"-->
|
||||||
@confirm="updateUser('updateUserForm')"/>
|
<!-- @confirm="updateUser('updateUserForm')"/>-->
|
||||||
</template>
|
<!-- </template>-->
|
||||||
</el-dialog>
|
<!-- </el-dialog>-->
|
||||||
<!--Changing user password in system settings-->
|
<!--Changing user password in system settings-->
|
||||||
<el-dialog :close-on-click-modal="false" :title="$t('member.edit_password')" :visible.sync="editPasswordVisible"
|
<el-dialog :close-on-click-modal="false" :title="$t('member.edit_password')" :visible.sync="editPasswordVisible"
|
||||||
width="30%"
|
width="30%"
|
||||||
|
@ -347,6 +347,7 @@
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<user-import ref="userImportDialog" @refreshAll="search"></user-import>
|
<user-import ref="userImportDialog" @refreshAll="search"></user-import>
|
||||||
<user-cascader :lable="batchAddLable" :title="batchAddTitle" @confirm="cascaderConfirm" ref="cascaderDialog"></user-cascader>
|
<user-cascader :lable="batchAddLable" :title="batchAddTitle" @confirm="cascaderConfirm" ref="cascaderDialog"></user-cascader>
|
||||||
|
<edit-user ref="editUser" @refresh="search"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -373,10 +374,12 @@ import {
|
||||||
} from "@/common/js/tableUtils";
|
} from "@/common/js/tableUtils";
|
||||||
import UserCascader from "@/business/components/settings/system/components/UserCascader";
|
import UserCascader from "@/business/components/settings/system/components/UserCascader";
|
||||||
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
|
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
|
||||||
|
import EditUser from "@/business/components/settings/system/EditUser";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsUser",
|
name: "MsUser",
|
||||||
components: {
|
components: {
|
||||||
|
EditUser,
|
||||||
MsCreateBox,
|
MsCreateBox,
|
||||||
MsTablePagination,
|
MsTablePagination,
|
||||||
MsTableHeader,
|
MsTableHeader,
|
||||||
|
@ -505,7 +508,8 @@ export default {
|
||||||
{trigger: ['blur', 'change'], validator: validateConfirmPwd}
|
{trigger: ['blur', 'change'], validator: validateConfirmPwd}
|
||||||
]
|
]
|
||||||
|
|
||||||
}
|
},
|
||||||
|
userGroup: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
activated() {
|
activated() {
|
||||||
|
@ -515,27 +519,29 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
create() {
|
create() {
|
||||||
this.createVisible = true;
|
// this.createVisible = true;
|
||||||
this.getOrgList();
|
// this.getOrgList();
|
||||||
this.getWsList();
|
// this.getWsList();
|
||||||
listenGoBack(this.handleClose);
|
// listenGoBack(this.handleClose);
|
||||||
|
this.$refs.editUser.open("Add", "创建用户");
|
||||||
},
|
},
|
||||||
edit(row) {
|
edit(row) {
|
||||||
this.updateVisible = true;
|
// this.updateVisible = true;
|
||||||
this.form = Object.assign({}, row);
|
// this.form = Object.assign({}, row);
|
||||||
this.$get("/organization/list", response => {
|
// this.$get("/organization/list", response => {
|
||||||
this.$set(this.form, "orgList", response.data);
|
// this.$set(this.form, "orgList", response.data);
|
||||||
});
|
// });
|
||||||
this.$get("/workspace/list", response => {
|
// this.$get("/workspace/list", response => {
|
||||||
this.$set(this.form, "wsList", response.data);
|
// this.$set(this.form, "wsList", response.data);
|
||||||
});
|
// });
|
||||||
if (row.id) {
|
// if (row.id) {
|
||||||
this.$get('/userrole/all/' + encodeURIComponent(row.id), response => {
|
// this.$get('/userrole/all/' + encodeURIComponent(row.id), response => {
|
||||||
let data = response.data;
|
// let data = response.data;
|
||||||
this.$set(this.form, "roles", data);
|
// this.$set(this.form, "roles", data);
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
listenGoBack(this.handleClose);
|
// listenGoBack(this.handleClose);
|
||||||
|
this.$refs.editUser.open("Edit", "修改用户", row);
|
||||||
},
|
},
|
||||||
editPassword(row) {
|
editPassword(row) {
|
||||||
this.editPasswordVisible = true;
|
this.editPasswordVisible = true;
|
||||||
|
@ -606,14 +612,17 @@ export default {
|
||||||
let data = response.data;
|
let data = response.data;
|
||||||
this.total = data.itemCount;
|
this.total = data.itemCount;
|
||||||
this.tableData = data.listObject;
|
this.tableData = data.listObject;
|
||||||
let url = "/user/special/user/role";
|
// let url = "/user/special/user/role";
|
||||||
|
let url = "/user/special/user/group";
|
||||||
for (let i = 0; i < this.tableData.length; i++) {
|
for (let i = 0; i < this.tableData.length; i++) {
|
||||||
if (this.tableData[i].id) {
|
if (this.tableData[i].id) {
|
||||||
this.$get(url + '/' + encodeURIComponent(this.tableData[i].id), result => {
|
this.$get(url + '/' + encodeURIComponent(this.tableData[i].id), result => {
|
||||||
let data = result.data;
|
let data = result.data;
|
||||||
let roles = data.roles;
|
// let roles = data.roles;
|
||||||
|
let groups = data.groups;
|
||||||
// let userRoles = result.userRoles;
|
// let userRoles = result.userRoles;
|
||||||
this.$set(this.tableData[i], "roles", roles);
|
// this.$set(this.tableData[i], "roles", roles);
|
||||||
|
this.$set(this.tableData[i], "roles", groups);
|
||||||
this.$set(this.tableData[i], "isLocalUser", this.tableData[i].source === 'LOCAL');
|
this.$set(this.tableData[i], "isLocalUser", this.tableData[i].source === 'LOCAL');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,15 +3,22 @@
|
||||||
title="设置权限"
|
title="设置权限"
|
||||||
:destroy-on-close="true"
|
:destroy-on-close="true"
|
||||||
v-loading="result.loading"
|
v-loading="result.loading"
|
||||||
|
top="5%"
|
||||||
>
|
>
|
||||||
<div style="height: 500px;overflow: auto">
|
<div style="height: 60vh;overflow: auto">
|
||||||
<el-table
|
<el-table
|
||||||
|
:span-method="objectSpanMethod"
|
||||||
|
border
|
||||||
:data="tableData"
|
:data="tableData"
|
||||||
style="width: 100%">
|
style="width: 100%">
|
||||||
<!-- <el-table-column-->
|
<el-table-column
|
||||||
<!-- type="selection"-->
|
prop="type"
|
||||||
<!-- width="55">-->
|
label="功能菜单"
|
||||||
<!-- </el-table-column>-->
|
width="180">
|
||||||
|
<template v-slot:default="scope">
|
||||||
|
<span>{{ userGroupType[scope.row.type] ? userGroupType[scope.row.type] : scope.row.type }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="resource"
|
prop="resource"
|
||||||
label="操作对象"
|
label="操作对象"
|
||||||
|
@ -37,6 +44,7 @@
|
||||||
<script>
|
<script>
|
||||||
import GroupOperator from "@/business/components/settings/system/group/GroupOperator";
|
import GroupOperator from "@/business/components/settings/system/group/GroupOperator";
|
||||||
import GroupPermission from "@/business/components/settings/system/group/GroupPermission";
|
import GroupPermission from "@/business/components/settings/system/group/GroupPermission";
|
||||||
|
import {USER_GROUP_SCOPE} from "@/common/js/table-constants";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "EditPermission",
|
name: "EditPermission",
|
||||||
|
@ -49,16 +57,23 @@ export default {
|
||||||
tableData: [],
|
tableData: [],
|
||||||
selected: [],
|
selected: [],
|
||||||
group: {},
|
group: {},
|
||||||
result: {}
|
result: {},
|
||||||
|
spanArr: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
GroupPermission,
|
GroupPermission,
|
||||||
GroupOperator
|
GroupOperator
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
userGroupType() {
|
||||||
|
return USER_GROUP_SCOPE;
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
open(row) {
|
open(row) {
|
||||||
this.tableData = [];
|
this.tableData = [];
|
||||||
|
this.spanArr = [];
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true;
|
||||||
this.group = Object.assign({}, row);
|
this.group = Object.assign({}, row);
|
||||||
this.getGroupJson();
|
this.getGroupJson();
|
||||||
|
@ -68,6 +83,21 @@ export default {
|
||||||
let data = result.data;
|
let data = result.data;
|
||||||
if (data) {
|
if (data) {
|
||||||
this.tableData = data.permissions;
|
this.tableData = data.permissions;
|
||||||
|
for (let i = 0; i < this.tableData.length; i++) {
|
||||||
|
if (i === 0) {
|
||||||
|
this.spanArr.push(1);
|
||||||
|
this.pos = 0
|
||||||
|
} else {
|
||||||
|
// 判断当前元素与上一个元素是否相同
|
||||||
|
if (this.tableData[i].type === this.tableData[i - 1].type) {
|
||||||
|
this.spanArr[this.pos] += 1;
|
||||||
|
this.spanArr.push(0);
|
||||||
|
} else {
|
||||||
|
this.spanArr.push(1);
|
||||||
|
this.pos = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -86,7 +116,17 @@ export default {
|
||||||
},
|
},
|
||||||
cancel() {
|
cancel() {
|
||||||
this.dialogVisible = false;
|
this.dialogVisible = false;
|
||||||
}
|
},
|
||||||
|
objectSpanMethod({row, column, rowIndex, columnIndex}) {
|
||||||
|
if (columnIndex === 0) {
|
||||||
|
const _row = this.spanArr[rowIndex];
|
||||||
|
const _col = _row > 0 ? 1 : 0;
|
||||||
|
return {
|
||||||
|
rowspan: _row,
|
||||||
|
colspan: _col
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -38,6 +38,11 @@ export const TAPD = 'Tapd';
|
||||||
export const JIRA = 'Jira';
|
export const JIRA = 'Jira';
|
||||||
export const ZEN_TAO = 'Zentao';
|
export const ZEN_TAO = 'Zentao';
|
||||||
|
|
||||||
|
export const GROUP_SYSTEM = 'SYSTEM';
|
||||||
|
export const GROUP_ORGANIZATION = 'ORGANIZATION';
|
||||||
|
export const GROUP_WORKSPACE = 'WORKSPACE';
|
||||||
|
export const GROUP_PROJECT = 'PROJECT';
|
||||||
|
|
||||||
export const SCHEDULE_TYPE = {
|
export const SCHEDULE_TYPE = {
|
||||||
API_TEST: 'API_TEST',
|
API_TEST: 'API_TEST',
|
||||||
PERFORMANCE_TEST: 'PERFORMANCE_TEST'
|
PERFORMANCE_TEST: 'PERFORMANCE_TEST'
|
||||||
|
|
Loading…
Reference in New Issue