refactor: 用户查询设置权限

This commit is contained in:
CaptainB 2022-06-08 11:32:42 +08:00 committed by 刘瑞斌
parent 5d3735816f
commit f066f093ec
6 changed files with 26 additions and 26 deletions

View File

@ -38,6 +38,7 @@ public class PermissionConstants {
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 SYSTEM_OPERATING_LOG_READ = "SYSTEM_OPERATING_LOG:READ";
public static final String WORKSPACE_SERVICE_READ = "WORKSPACE_SERVICE:READ";
public static final String WORKSPACE_SERVICE_READ_EDIT = "WORKSPACE_SERVICE:READ+EDIT";
@ -60,6 +61,7 @@ public class PermissionConstants {
public static final String WORKSPACE_PROJECT_ENVIRONMENT_READ_IMPORT = "WORKSPACE_PROJECT_ENVIRONMENT:READ+IMPORT";
public static final String WORKSPACE_PROJECT_ENVIRONMENT_READ_EXPORT = "WORKSPACE_PROJECT_ENVIRONMENT:READ+EXPORT";
public static final String WORKSPACE_OPERATING_LOG_READ = "WORKSPACE_OPERATING_LOG:READ";
public static final String PROJECT_USER_READ = "PROJECT_USER:READ";
public static final String PROJECT_USER_READ_CREATE = "PROJECT_USER:READ+CREATE";
@ -85,6 +87,8 @@ public class PermissionConstants {
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_OPERATING_LOG_READ = "PROJECT_OPERATING_LOG:READ";
public static final String PROJECT_TRACK_CASE_READ = "PROJECT_TRACK_CASE:READ";
public static final String PROJECT_TRACK_CASE_READ_CREATE = "PROJECT_TRACK_CASE:READ+CREATE";
public static final String PROJECT_TRACK_CASE_READ_EDIT = "PROJECT_TRACK_CASE:READ+EDIT";

View File

@ -5,6 +5,7 @@ import com.github.pagehelper.PageHelper;
import io.metersphere.base.domain.User;
import io.metersphere.commons.constants.OperLogConstants;
import io.metersphere.commons.constants.OperLogModule;
import io.metersphere.commons.constants.PermissionConstants;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
@ -18,6 +19,8 @@ import io.metersphere.i18n.Translator;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.service.UserService;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -95,6 +98,12 @@ public class UserController {
}
@GetMapping("/list")
@RequiresPermissions(value = {
PermissionConstants.SYSTEM_WORKSPACE_READ_CREATE,
PermissionConstants.SYSTEM_GROUP_READ_CREATE,
PermissionConstants.WORKSPACE_USER_READ_CREATE,
PermissionConstants.SYSTEM_OPERATING_LOG_READ,
}, logical = Logical.OR)
public List<User> getUserList() {
return userService.getUserList();
}

View File

@ -269,7 +269,7 @@ export const CREATOR = {
}
},
options: { // 异步获取候选项
url: "/user/list",
url: "/user/ws/current/member/list",
labelKey: "name",
valueKey: "id",
showLabel: option => {
@ -297,7 +297,7 @@ export const EXECUTOR = {
}
},
options: { // 异步获取候选项
url: "/user/list",
url: "/user/ws/current/member/list",
labelKey: "name",
valueKey: "id",
showLabel: option => {
@ -420,7 +420,7 @@ export const PRINCIPAL = {
}
},
options: { // 异步获取候选项
url: "/user/list",
url: "/user/ws/current/member/list",
labelKey: "name",
valueKey: "id",
showLabel: option => {
@ -448,7 +448,7 @@ export const PRINCIPALAPI = {
}
},
options: { // 异步获取候选项
url: "/user/list",
url: "/user/ws/current/member/list",
labelKey: "name",
valueKey: "id",
showLabel: option => {

View File

@ -95,7 +95,7 @@ export default {
},
methods: {
getUserList() {
this.$get('/user/list', response => {
this.$get('/user/ws/current/member/list', response => {
this.userList = response.data;
this.userMap = this.userList.reduce((r, c) => {
r[c.id] = c;

View File

@ -225,7 +225,7 @@ export default {
this.$set(this.condition, "operUser", item.id);
},
getMember() {
this.result = this.$get('/user/list/', response => {
this.result = this.$get('/user/ws/current/member/list', response => {
this.userList = response.data;
});
},

View File

@ -181,17 +181,9 @@ export default {
this.getWorkSpaceList();
this.getMember();
break;
case "organization":
this.initProject("/project/listAll/" + getCurrentWorkspaceId());
this.getMember();
break;
case "workspace":
this.initProject("/project/listAll/" + getCurrentWorkspaceId());
this.getMember();
break;
case "project":
this.getProject();
this.getMember();
this.getMember('/user/ws/current/member/list');
break;
}
},
@ -202,17 +194,9 @@ export default {
this.getWorkSpaceList();
this.getMember();
break;
case "organization":
this.initProject("/project/listAll/" + getCurrentWorkspaceId());
this.getMember();
break;
case "workspace":
this.initProject("/project/listAll/" + getCurrentWorkspaceId());
this.getMember();
break;
case "project":
this.getProject();
this.getMember();
this.getMember('/user/ws/current/member/list');
break;
}
},
@ -278,8 +262,11 @@ export default {
handleSelect(item) {
this.$set(this.condition, "operUser", item.id);
},
getMember() {
this.result = this.$get('/user/list/', response => {
getMember(url) {
if (!url) {
url = '/usr/list';
}
this.result = this.$get(url, response => {
this.userList = response.data;
});
},