Merge branch 'master' of https://github.com/metersphere/server
This commit is contained in:
commit
76b68b2214
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
name: 问题咨询
|
||||
about: 提出针对本项目安装部署、使用及其他方面的相关问题
|
||||
title: "[QUESTION]"
|
||||
labels: question
|
||||
assignees: 'wangzhen-fit2cloud'
|
||||
|
||||
---
|
||||
|
||||
**请描述您的问题.**
|
||||
|
|
@ -45,10 +45,15 @@ public class APITestController {
|
|||
return PageUtils.setPageInfo(page, apiTestService.list(request));
|
||||
}
|
||||
|
||||
@GetMapping("/list/{projectId}")
|
||||
public List<ApiTest> list(@PathVariable String projectId) {
|
||||
return apiTestService.getApiTestByProjectId(projectId);
|
||||
}
|
||||
|
||||
/*查询某个api测试状态*/
|
||||
@GetMapping("/list/all/{testId}")
|
||||
public ApiTest list(@PathVariable String testId) {
|
||||
return apiTestService.getApiTestByProjectId(testId);
|
||||
public ApiTest apiState(@PathVariable String testId) {
|
||||
return apiTestService.getApiTestByTestId(testId);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/schedule/update")
|
||||
|
|
|
@ -115,10 +115,14 @@ public class APITestService {
|
|||
return apiTest;
|
||||
}
|
||||
|
||||
public ApiTest getApiTestByProjectId(String testId) {
|
||||
public ApiTest getApiTestByTestId(String testId) {
|
||||
return apiTestMapper.selectByPrimaryKey(testId);
|
||||
}
|
||||
|
||||
public List<ApiTest> getApiTestByProjectId(String projectId) {
|
||||
return extApiTestMapper.getApiTestByProjectId(projectId);
|
||||
}
|
||||
|
||||
public void delete(String testId) {
|
||||
deleteFileByTestId(testId);
|
||||
apiReportService.deleteByTestId(testId);
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
<if test="values != null and values.size() > 0">
|
||||
and test_case.${key} in
|
||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||
#{value}
|
||||
#{value}
|
||||
</foreach>
|
||||
</if>
|
||||
</foreach>
|
||||
|
@ -54,22 +54,18 @@
|
|||
</if>
|
||||
</select>
|
||||
<select id="listByMethod" resultType="io.metersphere.track.dto.TestCaseDTO">
|
||||
select test_case.* from test_case
|
||||
SELECT id,name,status,project_id,type from api_test
|
||||
<where>
|
||||
<if test="request.method != null">
|
||||
and test_case.method =#{request.method}
|
||||
<if test="request.projectId!=null">
|
||||
and project_id=#{request.projectId}
|
||||
</if>
|
||||
</where>
|
||||
UNION ALL
|
||||
select id,name,status,project_id,type from load_test
|
||||
<where>
|
||||
<if test="request.projectId!=null">
|
||||
and project_id= #{request.projectId}
|
||||
</if>
|
||||
<if test="request.nodeIds != null and request.nodeIds.size() > 0">
|
||||
and test_case.node_id in
|
||||
<foreach collection="request.nodeIds" item="nodeId" separator="," open="(" close=")">
|
||||
#{nodeId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="request.projectId != null">
|
||||
and test_case.project_id = #{request.projectId}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
|
||||
</select>
|
||||
</mapper>
|
|
@ -68,34 +68,17 @@
|
|||
from test_plan_test_case
|
||||
inner join test_case on test_plan_test_case.case_id = test_case.id
|
||||
<where>
|
||||
<if test="request.name != null">
|
||||
and test_case.name like CONCAT('%', #{request.name},'%')
|
||||
</if>
|
||||
<if test="request.id != null">
|
||||
and test_case.id = #{request.id}
|
||||
</if>
|
||||
<if test="request.node != null">
|
||||
and test_case.node_id =#{request.node}
|
||||
</if>
|
||||
<if test="request.status != null">
|
||||
and test_plan_test_case.status = #{request.status}
|
||||
</if>
|
||||
<if test="request.executor != null">
|
||||
and test_plan_test_case.executor = #{request.executor}
|
||||
</if>
|
||||
<if test="request.planId != null">
|
||||
and test_plan_test_case.plan_id = #{request.planId}
|
||||
</if>
|
||||
<if test="request.filters != null and request.filters.size() > 0">
|
||||
<foreach collection="request.filters.entrySet()" index="key" item="values">
|
||||
<if test="values != null and values.size() > 0">
|
||||
and ${key} in
|
||||
<foreach collection="values" item="value" separator="," open="(" close=")">
|
||||
#{value}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="request.nodePaths != null and request.nodePaths.size() > 0">
|
||||
and test_case.node_path in
|
||||
<foreach collection="request.nodePaths" item="nodePaths" separator="," open="(" close=")">
|
||||
#{nodePaths}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
|
|
@ -5,6 +5,7 @@ import io.metersphere.commons.constants.ParamConstants;
|
|||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.controller.ResultHolder;
|
||||
import io.metersphere.controller.request.LoginRequest;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.ldap.service.LdapService;
|
||||
import io.metersphere.ldap.domain.LdapInfo;
|
||||
import io.metersphere.service.SystemParameterService;
|
||||
|
@ -30,7 +31,7 @@ public class LdapController {
|
|||
|
||||
String isOpen = systemParameterService.getValue(ParamConstants.LDAP.OPEN.getValue());
|
||||
if (StringUtils.isBlank(isOpen) || StringUtils.equals(Boolean.FALSE.toString(), isOpen)) {
|
||||
MSException.throwException("LDAP 认证未启用!");
|
||||
MSException.throwException(Translator.get("ldap_authentication_not_enabled"));
|
||||
}
|
||||
|
||||
ldapService.authenticate(request);
|
||||
|
|
|
@ -5,6 +5,7 @@ import io.metersphere.commons.constants.ParamConstants;
|
|||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.EncryptUtils;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.ldap.domain.Person;
|
||||
import io.metersphere.service.SystemParameterService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -42,13 +43,13 @@ public class PersonRepoImpl implements PersonRepo {
|
|||
} catch (AuthenticationException e) {
|
||||
LogUtil.error("ldap authenticate failed..." + e);
|
||||
System.out.println("Login failed: " + e);
|
||||
MSException.throwException("用户认证失败!");
|
||||
MSException.throwException(Translator.get("authentication_failed"));
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
// Context creation failed - authentication did not succeed
|
||||
LogUtil.error("ldap authenticate failed..." + e);
|
||||
System.out.println("Login failed: " + e);
|
||||
MSException.throwException("连接失败");
|
||||
MSException.throwException(Translator.get("ldap_connect_fail"));
|
||||
return false;
|
||||
} finally {
|
||||
// It is imperative that the created DirContext instance is always closed
|
||||
|
@ -78,7 +79,7 @@ public class PersonRepoImpl implements PersonRepo {
|
|||
});
|
||||
|
||||
if (result.size() != 1) {
|
||||
throw new RuntimeException("User not found or not unique");
|
||||
throw new RuntimeException(Translator.get("user_not_found_or_not_unique"));
|
||||
}
|
||||
|
||||
return result.get(0);
|
||||
|
@ -126,19 +127,19 @@ public class PersonRepoImpl implements PersonRepo {
|
|||
private void preConnect(String url, String dn, String ou, String password) {
|
||||
|
||||
if (StringUtils.isBlank(url)) {
|
||||
MSException.throwException("ldap url is null");
|
||||
MSException.throwException(Translator.get("ldap_url_is_null"));
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(dn)) {
|
||||
MSException.throwException("ldap dn is null");
|
||||
MSException.throwException(Translator.get("ldap_dn_is_null"));
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(ou)) {
|
||||
MSException.throwException("ldap ou is null");
|
||||
MSException.throwException(Translator.get("ldap_ou_is_null"));
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(password)) {
|
||||
MSException.throwException("ldap password is null");
|
||||
MSException.throwException(Translator.get("ldap_password_is_null"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,10 +32,10 @@ public class LdapService {
|
|||
} else if (user.size() == 0) {
|
||||
MSException.throwException(Translator.get("user_not_exist") + username);
|
||||
} else {
|
||||
MSException.throwException("Found multiple users");
|
||||
MSException.throwException(Translator.get("find_more_user"));
|
||||
}
|
||||
} catch (CommunicationException e) {
|
||||
MSException.throwException("LDAP Server connection failed!");
|
||||
MSException.throwException(Translator.get("ldap_connect_fail"));
|
||||
}
|
||||
personRepo.authenticate(dn, credentials);
|
||||
}
|
||||
|
|
|
@ -731,13 +731,15 @@ public class JmeterDocumentParser implements DocumentParser {
|
|||
elementProp.setAttribute("name", "ThreadGroup.main_controller");
|
||||
elementProp.setAttribute("elementType", "com.blazemeter.jmeter.control.VirtualUserController");
|
||||
threadGroup.appendChild(elementProp);
|
||||
|
||||
// 持续时长
|
||||
String duration = context.getProperty("duration").toString();
|
||||
String rampUp = context.getProperty("RampUp").toString();
|
||||
int realHold = Integer.parseInt(duration) - Integer.parseInt(rampUp);
|
||||
threadGroup.appendChild(createStringProp(document, "ThreadGroup.on_sample_error", "continue"));
|
||||
threadGroup.appendChild(createStringProp(document, "TargetLevel", "2"));
|
||||
threadGroup.appendChild(createStringProp(document, "RampUp", "12"));
|
||||
threadGroup.appendChild(createStringProp(document, "Steps", "2"));
|
||||
threadGroup.appendChild(createStringProp(document, "Hold", duration));
|
||||
threadGroup.appendChild(createStringProp(document, "Hold", String.valueOf(realHold)));
|
||||
threadGroup.appendChild(createStringProp(document, "LogFilename", ""));
|
||||
threadGroup.appendChild(createStringProp(document, "Iterations", "1"));
|
||||
threadGroup.appendChild(createStringProp(document, "Unit", "M"));
|
||||
|
@ -755,6 +757,9 @@ public class JmeterDocumentParser implements DocumentParser {
|
|||
</collectionProp>
|
||||
</kg.apc.jmeter.timers.VariableThroughputTimer>
|
||||
*/
|
||||
if (context.getProperty("rpsLimitEnable") == null || StringUtils.equals(context.getProperty("rpsLimitEnable").toString(), "false")) {
|
||||
return;
|
||||
}
|
||||
Document document = element.getOwnerDocument();
|
||||
|
||||
|
||||
|
|
|
@ -43,12 +43,11 @@ public class TestCaseController {
|
|||
return testCaseService.listTestCase(request);
|
||||
}
|
||||
|
||||
/*项目下自动测试用例*/
|
||||
/*项目下自动测试*/
|
||||
@GetMapping("/list/method/{projectId}")
|
||||
public List<TestCaseDTO> listByMethod(@PathVariable String projectId) {
|
||||
QueryTestCaseRequest request = new QueryTestCaseRequest();
|
||||
request.setProjectId(projectId);
|
||||
request.setMethod("auto");
|
||||
return testCaseService.listTestCaseMthod(request);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,8 @@ import org.apache.shiro.authz.annotation.RequiresRoles;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@RequestMapping("/test/plan/case")
|
||||
|
@ -31,11 +33,15 @@ public class TestPlanTestCaseController {
|
|||
return PageUtils.setPageInfo(page, testPlanTestCaseService.list(request));
|
||||
}
|
||||
|
||||
@GetMapping("/list/{planId}/{nodeId}")
|
||||
public List<TestPlanCaseDTO> getTestPlanCases(@PathVariable String planId, @PathVariable String nodeId) {
|
||||
/*jenkins测试计划下的测试用例*/
|
||||
@GetMapping("/list/node/{planId}/{nodePaths}")
|
||||
public List<TestPlanCaseDTO> getTestPlanCases(@PathVariable String planId, @PathVariable String nodePaths) {
|
||||
String nodePath = nodePaths.replace("f", "/");
|
||||
String[] array = nodePath.split(",");
|
||||
List<String> list = Arrays.asList(array);
|
||||
QueryTestPlanCaseRequest request = new QueryTestPlanCaseRequest();
|
||||
request.setPlanId(planId);
|
||||
request.setNode(nodeId);
|
||||
request.setNodePaths(list);
|
||||
return testPlanTestCaseService.listByNode(request);
|
||||
}
|
||||
|
||||
|
@ -50,36 +56,36 @@ public class TestPlanTestCaseController {
|
|||
}
|
||||
|
||||
@PostMapping("pending/{count}")
|
||||
public List<TestPlanCaseDTO> getPrepareTestCases(@PathVariable int count, @RequestBody QueryTestPlanCaseRequest request){
|
||||
public List<TestPlanCaseDTO> getPrepareTestCases(@PathVariable int count, @RequestBody QueryTestPlanCaseRequest request) {
|
||||
return testPlanTestCaseService.getPendingTestCases(request, count);
|
||||
}
|
||||
|
||||
@PostMapping("/list/all")
|
||||
public List<TestPlanCaseDTO> getTestPlanCases(@RequestBody QueryTestPlanCaseRequest request){
|
||||
public List<TestPlanCaseDTO> getTestPlanCases(@RequestBody QueryTestPlanCaseRequest request) {
|
||||
return testPlanTestCaseService.list(request);
|
||||
}
|
||||
|
||||
@PostMapping("/edit")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||
public void editTestCase(@RequestBody TestPlanTestCaseWithBLOBs testPlanTestCase){
|
||||
public void editTestCase(@RequestBody TestPlanTestCaseWithBLOBs testPlanTestCase) {
|
||||
testPlanTestCaseService.editTestCase(testPlanTestCase);
|
||||
}
|
||||
|
||||
@PostMapping("/batch/edit")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||
public void editTestCaseBath(@RequestBody TestPlanCaseBatchRequest request){
|
||||
public void editTestCaseBath(@RequestBody TestPlanCaseBatchRequest request) {
|
||||
testPlanTestCaseService.editTestCaseBath(request);
|
||||
}
|
||||
|
||||
@PostMapping("/batch/delete")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||
public void deleteTestCaseBath(@RequestBody TestPlanCaseBatchRequest request){
|
||||
public void deleteTestCaseBath(@RequestBody TestPlanCaseBatchRequest request) {
|
||||
testPlanTestCaseService.deleteTestCaseBath(request);
|
||||
}
|
||||
|
||||
@PostMapping("/delete/{id}")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||
public int deleteTestCase(@PathVariable String id){
|
||||
public int deleteTestCase(@PathVariable String id) {
|
||||
return testPlanTestCaseService.deleteTestCase(id);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@ public class QueryTestPlanCaseRequest extends TestPlanTestCase {
|
|||
|
||||
private List<String> nodeIds;
|
||||
|
||||
private List<String> nodePaths;
|
||||
|
||||
private List<OrderRequest> orders;
|
||||
|
||||
private Map<String, List<String>> filters;
|
||||
|
@ -29,4 +31,6 @@ public class QueryTestPlanCaseRequest extends TestPlanTestCase {
|
|||
private String status;
|
||||
|
||||
private String node;
|
||||
|
||||
private String method;
|
||||
}
|
||||
|
|
|
@ -113,3 +113,14 @@ test_case_report_template_repeat=The workspace has the same name template
|
|||
plan_name_already_exists=Test plan name already exists
|
||||
test_case_already_exists_excel=There are duplicate test cases in the import file
|
||||
api_test_name_already_exists=Test name already exists
|
||||
|
||||
#ldap
|
||||
ldap_url_is_null=LDAP address is empty
|
||||
ldap_dn_is_null=LDAP binding DN is empty
|
||||
ldap_ou_is_null=LDAP parameter OU is empty
|
||||
ldap_password_is_null=LDAP password is empty
|
||||
ldap_connect_fail=Connection failed
|
||||
authentication_failed=User authentication failed
|
||||
user_not_found_or_not_unique=User does not exist or is not unique
|
||||
find_more_user=Multiple users found
|
||||
ldap_authentication_not_enabled=LDAP authentication is not enabled
|
|
@ -114,6 +114,16 @@ plan_name_already_exists=测试计划名称已存在
|
|||
test_case_already_exists_excel=导入文件中存在重复用例
|
||||
api_test_name_already_exists=测试名称已经存在
|
||||
|
||||
#ldap
|
||||
ldap_url_is_null=LDAP地址为空
|
||||
ldap_dn_is_null=LDAP绑定DN为空
|
||||
ldap_ou_is_null=LDAP参数OU为空
|
||||
ldap_password_is_null=LDAP密码为空
|
||||
ldap_connect_fail=连接失败
|
||||
authentication_failed=用户认证失败
|
||||
user_not_found_or_not_unique=用户不存在或者不唯一
|
||||
find_more_user=查找到多个用户
|
||||
ldap_authentication_not_enabled=LDAP认证未启用
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -114,3 +114,13 @@ plan_name_already_exists=測試計劃名稱已存在
|
|||
test_case_already_exists_excel=導入文件中存在重復用例
|
||||
api_test_name_already_exists=測試名稱已經存在
|
||||
|
||||
#ldap
|
||||
ldap_url_is_null=LDAP地址為空
|
||||
ldap_dn_is_null=LDAP綁定DN為空
|
||||
ldap_ou_is_null=LDAP參數OU為空
|
||||
ldap_password_is_null=LDAP密碼為空
|
||||
ldap_connect_fail=連接失敗
|
||||
authentication_failed=用戶認證失敗
|
||||
user_not_found_or_not_unique=用戶不存在或者不唯一
|
||||
find_more_user=查找到多個用戶
|
||||
ldap_authentication_not_enabled=LDAP認證未啟用
|
||||
|
|
|
@ -35,9 +35,12 @@
|
|||
<el-form-item>
|
||||
<div class="config-form-label">{{$t('load_test.rps_limit')}}</div>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-switch v-model="rpsLimitEnable"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-input-number
|
||||
:disabled="isReadOnly"
|
||||
:disabled="isReadOnly || !rpsLimitEnable"
|
||||
:placeholder="$t('load_test.input_rps_limit')"
|
||||
v-model="rpsLimit"
|
||||
@change="calculateChart"
|
||||
|
@ -110,6 +113,7 @@
|
|||
const STEPS = "Steps";
|
||||
const DURATION = "duration";
|
||||
const RPS_LIMIT = "rpsLimit";
|
||||
const RPS_LIMIT_ENABLE = "rpsLimitEnable";
|
||||
|
||||
export default {
|
||||
name: "PerformancePressureConfig",
|
||||
|
@ -133,6 +137,7 @@
|
|||
rampUpTime: 10,
|
||||
step: 10,
|
||||
rpsLimit: 10,
|
||||
rpsLimitEnable: false,
|
||||
orgOptions: {},
|
||||
resourcePool: null,
|
||||
resourcePools: [],
|
||||
|
@ -151,7 +156,7 @@
|
|||
testPlan(n) {
|
||||
this.resourcePool = n.testResourcePoolId;
|
||||
},
|
||||
testId () {
|
||||
testId() {
|
||||
if (this.testId) {
|
||||
this.getLoadConfig();
|
||||
} else {
|
||||
|
@ -320,6 +325,7 @@
|
|||
{key: STEPS, value: this.step},
|
||||
{key: DURATION, value: this.duration},
|
||||
{key: RPS_LIMIT, value: this.rpsLimit},
|
||||
{key: RPS_LIMIT_ENABLE, value: this.rpsLimitEnable},
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -345,14 +351,17 @@
|
|||
.chart-container {
|
||||
width: 100%;
|
||||
}
|
||||
.el-col .el-form{
|
||||
|
||||
.el-col .el-form {
|
||||
margin-top: 15px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.el-col {
|
||||
margin-top: 15px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin-left: 60px;
|
||||
}
|
||||
|
|
|
@ -2,44 +2,49 @@
|
|||
<div>
|
||||
<el-card class="box-card" v-loading="result.loading">
|
||||
<el-form :model="form" size="small" :rules="rules" :disabled="show" ref="form">
|
||||
<el-form-item label="LDAP地址" prop="url">
|
||||
<el-input v-model="form.url" placeholder="请输入LDAP地址 (如 ldap://localhost:389)"></el-input>
|
||||
<el-form-item :label="$t('ldap.url')" prop="url">
|
||||
<el-input v-model="form.url" :placeholder="$t('ldap.input_url_placeholder')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="绑定DN" prop="dn">
|
||||
<el-input v-model="form.dn" placeholder="请输入DN"></el-input>
|
||||
<el-form-item :label="$t('ldap.dn')" prop="dn">
|
||||
<el-input v-model="form.dn" :placeholder="$t('ldap.input_dn')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop="password">
|
||||
<el-input v-model="form.password" placeholder="请输入密码" show-password auto-complete="new-password"></el-input>
|
||||
<el-form-item :label="$t('ldap.password')" prop="password">
|
||||
<el-input v-model="form.password" :placeholder="$t('ldap.input_password')" show-password
|
||||
auto-complete="new-password"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户OU" prop="ou">
|
||||
<el-input v-model="form.ou" placeholder="输入用户OU (使用|分隔各OU)"></el-input>
|
||||
<el-form-item :label="$t('ldap.ou')" prop="ou">
|
||||
<el-input v-model="form.ou" :placeholder="$t('ldap.input_ou_placeholder')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户过滤器" prop="filter">
|
||||
<el-input v-model="form.filter" placeholder="输入过滤器 [可能的选项是cn或uid或sAMAccountName=%(user)s]"></el-input>
|
||||
<el-form-item :label="$t('ldap.filter')" prop="filter">
|
||||
<el-input v-model="form.filter" :placeholder="$t('ldap.input_filter_placeholder')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="LDAP属性映射" prop="mapping">
|
||||
<el-input v-model="form.mapping" placeholder="属性映射"></el-input>
|
||||
<el-form-item :label="$t('ldap.mapping')" prop="mapping">
|
||||
<el-input v-model="form.mapping" :placeholder="$t('ldap.input_mapping')"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用LDAP认证" prop="open">
|
||||
<el-form-item :label="$t('ldap.open')" prop="open">
|
||||
<el-checkbox v-model="form.open"></el-checkbox>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<div>
|
||||
<el-button type="primary" size="small" :disabled="!show" @click="testConnection">测试连接</el-button>
|
||||
<el-button type="primary" size="small" :disabled="!show" @click="testLogin">测试登录</el-button>
|
||||
<el-button v-if="showEdit" size="small" @click="edit">编辑</el-button>
|
||||
<el-button type="success" v-if="showSave" size="small" @click="save('form')">保存</el-button>
|
||||
<el-button type="info" v-if="showCancel" size="small" @click="cancel">取消</el-button>
|
||||
<el-button type="primary" size="small" :disabled="!show" @click="testConnection">{{$t('ldap.test_connect')}}
|
||||
</el-button>
|
||||
<el-button type="primary" size="small" :disabled="!show" @click="testLogin">{{$t('ldap.test_login')}}
|
||||
</el-button>
|
||||
<el-button v-if="showEdit" size="small" @click="edit">{{$t('ldap.edit')}}</el-button>
|
||||
<el-button type="success" v-if="showSave" size="small" @click="save('form')">{{$t('commons.save')}}</el-button>
|
||||
<el-button type="info" v-if="showCancel" size="small" @click="cancel">{{$t('commons.cancel')}}</el-button>
|
||||
</div>
|
||||
|
||||
<el-dialog title="测试登录" :visible.sync="loginVisible" width="30%" destroy-on-close v-loading="result.loading">
|
||||
<el-form :model="loginForm" :rules="loginFormRules" ref="loginForm" label-width="80px">
|
||||
<el-form-item label="用户名" prop="username">
|
||||
<el-input v-model="loginForm.username" autocomplete="off" placeholder="请输入用户名"/>
|
||||
<el-dialog :title="$t('ldap.test_login')" :visible.sync="loginVisible" width="30%" destroy-on-close
|
||||
v-loading="result.loading">
|
||||
<el-form :model="loginForm" :rules="loginFormRules" ref="loginForm" label-width="90px">
|
||||
<el-form-item :label="$t('commons.username')" prop="username">
|
||||
<el-input v-model="loginForm.username" autocomplete="off" :placeholder="$t('ldap.input_username')"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop="password" >
|
||||
<el-input v-model="loginForm.password" autocomplete="new-password" placeholder="请输入密码" show-password/>
|
||||
<el-form-item :label="$t('commons.password')" prop="password">
|
||||
<el-input v-model="loginForm.password" autocomplete="new-password" :placeholder="$t('ldap.input_password')"
|
||||
show-password/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer">
|
||||
|
@ -55,6 +60,7 @@
|
|||
|
||||
<script>
|
||||
import MsDialogFooter from "../../common/components/MsDialogFooter";
|
||||
|
||||
export default {
|
||||
name: "LdapSetting",
|
||||
components: {
|
||||
|
@ -71,14 +77,14 @@
|
|||
showCancel: false,
|
||||
loginVisible: false,
|
||||
rules: {
|
||||
url: {required: true, message: '请输入LDAP地址', trigger: ['change','blur']},
|
||||
dn: {required: true, message: '请输入DN', trigger: ['change','blur']},
|
||||
password: {required: true, message: '请输入密码', trigger: ['change','blur']},
|
||||
ou: {required: true, message: '请输入OU', trigger: ['change','blur']},
|
||||
url: {required: true, message: this.$t('ldap.input_url'), trigger: ['change', 'blur']},
|
||||
dn: {required: true, message: this.$t('ldap.input_dn'), trigger: ['change', 'blur']},
|
||||
password: {required: true, message: this.$t('ldap.input_password'), trigger: ['change', 'blur']},
|
||||
ou: {required: true, message: this.$t('ldap.input_ou'), trigger: ['change', 'blur']},
|
||||
},
|
||||
loginFormRules: {
|
||||
username: {required: true, message: '请输入用户名', trigger: 'blur'},
|
||||
password: {required: true, message: '请输入密码', trigger: 'blur'}
|
||||
username: {required: true, message: this.$t('ldap.input_username'), trigger: 'blur'},
|
||||
password: {required: true, message: this.$t('ldap.input_password'), trigger: 'blur'}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -113,7 +119,7 @@
|
|||
return false;
|
||||
}
|
||||
this.result = this.$post("/ldap/test/connect", this.form, response => {
|
||||
this.$success("连接成功!")
|
||||
this.$success(this.$t('commons.connection_successful'));
|
||||
})
|
||||
},
|
||||
testLogin() {
|
||||
|
@ -122,7 +128,7 @@
|
|||
}
|
||||
|
||||
if (!this.form.ou) {
|
||||
this.$warning("LDAP OU不能为空!");
|
||||
this.$warning(this.$t('ldap.ou_cannot_be_empty'));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -131,17 +137,17 @@
|
|||
},
|
||||
checkParam() {
|
||||
if (!this.form.url) {
|
||||
this.$warning("LDAP 地址不能为空!");
|
||||
this.$warning(this.$t('ldap.url_cannot_be_empty'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.form.dn) {
|
||||
this.$warning("LDAP DN不能为空!");
|
||||
this.$warning(this.$t('ldap.dn_cannot_be_empty'));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.form.password) {
|
||||
this.$warning("LDAP 密码不能为空!");
|
||||
this.$warning(this.$t('ldap.password_cannot_be_empty'));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -166,7 +172,7 @@
|
|||
this.showEdit = true;
|
||||
this.showSave = false;
|
||||
this.showCancel = false;
|
||||
this.$success("保存成功")
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.init();
|
||||
});
|
||||
} else {
|
||||
|
@ -178,7 +184,7 @@
|
|||
this.$refs[form].validate(valid => {
|
||||
if (valid) {
|
||||
this.result = this.$post("/ldap/test/login", this.loginForm, response => {
|
||||
this.$success("登录成功")
|
||||
this.$success(this.$t('ldap.login_success'));
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-tabs class="system-setting" v-model="activeName">
|
||||
<el-tab-pane label="邮箱设置" name="email">
|
||||
<el-tab-pane :label="$t('system_parameter_setting.mailbox_service_settings')" name="email">
|
||||
<email-setting/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="LDAP设置" name="ldap">
|
||||
<el-tab-pane :label="$t('system_parameter_setting.ldap_setting')" name="ldap">
|
||||
<ldap-setting/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
|
|
@ -550,7 +550,8 @@ export default {
|
|||
'check_in': 'Check in',
|
||||
},
|
||||
system_parameter_setting: {
|
||||
'mailbox_service_settings': 'Mailbox Service Settings',
|
||||
'mailbox_service_settings': 'Mailbox Settings',
|
||||
'ldap_setting': 'LDAP Setting',
|
||||
'test_connection': 'Test connection',
|
||||
'SMTP_host': 'SMTP host',
|
||||
'SMTP_port': 'SMTP port',
|
||||
|
@ -563,5 +564,32 @@ export default {
|
|||
},
|
||||
i18n: {
|
||||
'home': 'Home'
|
||||
},
|
||||
ldap: {
|
||||
'url': 'LDAP URL',
|
||||
'dn': 'Bind DN',
|
||||
'password': 'Password',
|
||||
'ou': 'User OU',
|
||||
'filter': 'User Filter',
|
||||
'mapping': 'LDAP Mapping',
|
||||
'open': 'Enable LDAP Authentication',
|
||||
'input_url': 'Please enter LDAP url',
|
||||
'input_dn': 'Please enter DN',
|
||||
'input_password': 'Please enter the password',
|
||||
'input_ou': 'Please enter user OU',
|
||||
'input_filter': 'Please enter a user filter',
|
||||
'input_mapping': 'Please enter LDAP attribute mapping',
|
||||
'input_username': 'please enter user name',
|
||||
'input_url_placeholder': 'Please enter the LDAP address (eg ldap://localhost:389)',
|
||||
'input_ou_placeholder': 'Enter user OU (use | to separate each OU)',
|
||||
'input_filter_placeholder': 'Input filter [Possible options are cn or uid or sAMAccountName=%(user)s]',
|
||||
'test_connect': 'Test Connection',
|
||||
'test_login': 'Test Login',
|
||||
'edit': 'Edit',
|
||||
'login_success': 'login success',
|
||||
'url_cannot_be_empty': 'LDAP address cannot be empty',
|
||||
'dn_cannot_be_empty': 'LDAP DN cannot be empty',
|
||||
'ou_cannot_be_empty': 'LDAP OU cannot be empty',
|
||||
'password_cannot_be_empty': 'LDAP password cannot be empty',
|
||||
}
|
||||
};
|
||||
|
|
|
@ -548,7 +548,8 @@ export default {
|
|||
'check_in': '校验中',
|
||||
},
|
||||
system_parameter_setting: {
|
||||
'mailbox_service_settings': '邮件服务设置',
|
||||
'mailbox_service_settings': '邮件设置',
|
||||
'ldap_setting': 'LDAP设置',
|
||||
'test_connection': '测试连接',
|
||||
'SMTP_host': 'SMTP主机',
|
||||
'SMTP_port': 'SMTP端口',
|
||||
|
@ -560,5 +561,32 @@ export default {
|
|||
},
|
||||
i18n: {
|
||||
'home': '首页'
|
||||
},
|
||||
ldap: {
|
||||
'url': 'LDAP地址',
|
||||
'dn': '绑定DN',
|
||||
'password': '密码',
|
||||
'ou': '用户OU',
|
||||
'filter': '用户过滤器',
|
||||
'mapping': 'LDAP属性映射',
|
||||
'open': '启用LDAP认证',
|
||||
'input_url': '请输入LDAP地址',
|
||||
'input_dn': '请输入DN',
|
||||
'input_password': '请输入密码',
|
||||
'input_ou': '请输入用户OU',
|
||||
'input_filter': '请输入用户过滤器',
|
||||
'input_mapping': '请输入LDAP属性映射',
|
||||
'input_username': '请输入用户名',
|
||||
'input_url_placeholder': '请输入LDAP地址 (如 ldap://localhost:389)',
|
||||
'input_ou_placeholder': '输入用户OU (使用|分隔各OU)',
|
||||
'input_filter_placeholder': '输入过滤器 [可能的选项是cn或uid或sAMAccountName=%(user)s]',
|
||||
'test_connect': '测试连接',
|
||||
'test_login': '测试登录',
|
||||
'edit': '编辑',
|
||||
'login_success': '登录成功',
|
||||
'url_cannot_be_empty': 'LDAP 地址不能为空',
|
||||
'dn_cannot_be_empty': 'LDAP DN不能为空',
|
||||
'ou_cannot_be_empty': 'LDAP OU不能为空',
|
||||
'password_cannot_be_empty': 'LDAP 密码不能为空',
|
||||
}
|
||||
};
|
||||
|
|
|
@ -548,7 +548,8 @@ export default {
|
|||
'check_in': '校驗中',
|
||||
},
|
||||
system_parameter_setting: {
|
||||
'mailbox_service_settings': '郵件服務設定',
|
||||
'mailbox_service_settings': '郵件設置',
|
||||
'ldap_setting': 'LDAP設置',
|
||||
'test_connection': '測試連結',
|
||||
'SMTP_host': 'SMTP主機',
|
||||
'SMTP_port': 'SMTP埠',
|
||||
|
@ -560,5 +561,32 @@ export default {
|
|||
},
|
||||
i18n: {
|
||||
'home': '首頁'
|
||||
},
|
||||
ldap: {
|
||||
'url': 'LDAP地址',
|
||||
'dn': '綁定DN',
|
||||
'password': '密碼',
|
||||
'ou': '用戶OU',
|
||||
'filter': '用戶過濾器',
|
||||
'mapping': 'LDAP屬性映射',
|
||||
'open': '啟用LDAP認證',
|
||||
'input_url': '請輸入LDAP地址',
|
||||
'input_dn': '請輸入DN',
|
||||
'input_password': '請輸入密碼',
|
||||
'input_ou': '請輸入用戶OU',
|
||||
'input_filter': '請輸入用戶過濾器',
|
||||
'input_mapping': '請輸入LDAP屬性映射',
|
||||
'input_username': '請輸入用戶名',
|
||||
'input_url_placeholder': '請輸入LDAP地址 (如 ldap://localhost:389)',
|
||||
'input_ou_placeholder': '輸入用戶OU (使用|分隔各OU)',
|
||||
'input_filter_placeholder': '輸入過濾器 [可能的選項是cn或uid或sAMAccountName=%(user)s]',
|
||||
'test_connect': '測試連接',
|
||||
'test_login': '測試登錄',
|
||||
'edit': '編輯',
|
||||
'login_success': '登錄成功',
|
||||
'url_cannot_be_empty': 'LDAP 地址不能為空',
|
||||
'dn_cannot_be_empty': 'LDAP DN不能為空',
|
||||
'ou_cannot_be_empty': 'LDAP OU不能為空',
|
||||
'password_cannot_be_empty': 'LDAP 密碼不能為空',
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue