feactor: 用户ID支持特殊字符

This commit is contained in:
chenjianxing 2020-08-20 18:16:28 +08:00
parent c4d4284957
commit eceb099545
9 changed files with 33 additions and 31 deletions

View File

@ -115,7 +115,7 @@
</select>
<select id="list" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
select test_case.remark, test_plan_test_case.*,test_case.*,test_case_node.name as model
select test_case.remark, test_plan_test_case.id as id, test_plan_test_case.*,test_case.*,test_case_node.name as model
from test_plan_test_case
inner join test_case on test_plan_test_case.case_id = test_case.id left join test_case_node on
test_case_node.id=test_case.node_id

View File

@ -64,7 +64,7 @@
methods: {
initMenuData() {
if (hasRoles(ROLE_ORG_ADMIN, ROLE_TEST_VIEWER, ROLE_TEST_USER, ROLE_TEST_MANAGER)) {
this.$get("/organization/list/userorg/" + this.currentUserId, response => {
this.$get("/organization/list/userorg/" + encodeURIComponent(this.currentUserId), response => {
let data = response.data;
this.organizationList = data;
let org = data.filter(r => r.id === this.currentUser.lastOrganizationId);
@ -93,7 +93,7 @@
}
},
getCurrentUserInfo() {
this.$get("/user/info/" + this.currentUserId, response => {
this.$get("/user/info/" + encodeURIComponent(this.currentUserId), response => {
this.currentUserInfo = response.data;
})
},

View File

@ -163,7 +163,7 @@
this.tableData = data.listObject;
let url = "/userrole/list/org/" + this.currentUser().lastOrganizationId;
for (let i = 0; i < this.tableData.length; i++) {
this.$get(url + "/" + this.tableData[i].id, response => {
this.$get(url + "/" + encodeURIComponent(this.tableData[i].id), response => {
let roles = response.data;
this.$set(this.tableData[i], "roles", roles);
})
@ -217,7 +217,7 @@
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
this.result = this.$get('/user/org/member/delete/' + this.currentUser().lastOrganizationId + '/' + row.id, () => {
this.result = this.$get('/user/org/member/delete/' + this.currentUser().lastOrganizationId + '/' + encodeURIComponent(row.id), () => {
this.$success(this.$t('commons.remove_success'));
this.initTableData();
});

View File

@ -316,7 +316,7 @@
let url = "/userrole/list/ws/" + row.id;
//
for (let i = 0; i < this.memberLineData.length; i++) {
this.$get(url + "/" + this.memberLineData[i].id, response => {
this.$get(url + "/" + encodeURIComponent(this.memberLineData[i].id), response => {
let roles = response.data;
this.$set(this.memberLineData[i], "roles", roles);
})
@ -336,7 +336,7 @@
let url = "/userrole/list/ws/" + row.id;
//
for (let i = 0; i < this.memberLineData.length; i++) {
this.$get(url + "/" + this.memberLineData[i].id, response => {
this.$get(url + "/" + encodeURIComponent(this.memberLineData[i].id), response => {
let roles = response.data;
this.$set(this.memberLineData[i], "roles", roles);
})
@ -393,7 +393,7 @@
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
this.result = this.$get('/user/ws/member/delete/' + this.currentWorkspaceRow.id + '/' + row.id, () => {
this.result = this.$get('/user/ws/member/delete/' + this.currentWorkspaceRow.id + '/' + encodeURIComponent(row.id), () => {
this.$success(this.$t('commons.remove_success'));
this.cellClick(this.currentWorkspaceRow);
});

View File

@ -216,7 +216,7 @@
})
},
initTableData() {
this.result = this.$get("/user/info/" + this.currentUser().id, response => {
this.result = this.$get("/user/info/" + encodeURIComponent(this.currentUser().id), response => {
let data = response.data;
this.isLdapUser = response.data.source === 'LDAP' ? true : false;
let dataList = [];

View File

@ -298,7 +298,7 @@
this.memberLineData = data.listObject;
let url = "/userrole/list/org/" + row.id;
for (let i = 0; i < this.memberLineData.length; i++) {
this.$get(url + "/" + this.memberLineData[i].id, response => {
this.$get(url + "/" + encodeURIComponent(this.memberLineData[i].id), response => {
let roles = response.data;
this.$set(this.memberLineData[i], "roles", roles);
})
@ -318,7 +318,7 @@
this.memberLineData = data.listObject;
let url = "/userrole/list/org/" + row.id;
for (let i = 0; i < this.memberLineData.length; i++) {
this.$get(url + "/" + this.memberLineData[i].id, response => {
this.$get(url + "/" + encodeURIComponent(this.memberLineData[i].id), response => {
let roles = response.data;
this.$set(this.memberLineData[i], "roles", roles);
})
@ -358,7 +358,7 @@
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
this.result = this.$get('/user/special/org/member/delete/' + this.currentRow.id + '/' + row.id, () => {
this.result = this.$get('/user/special/org/member/delete/' + this.currentRow.id + '/' + encodeURIComponent(row.id), () => {
let sourceId = this.currentRow.id;
let currentUser = getCurrentUser();
let userId = row.id;

View File

@ -274,7 +274,7 @@
let url = "/userrole/list/ws/" + row.id;
//
for (let i = 0; i < this.memberLineData.length; i++) {
this.$get(url + "/" + this.memberLineData[i].id, response => {
this.$get(url + "/" + encodeURIComponent(this.memberLineData[i].id), response => {
let roles = response.data;
this.$set(this.memberLineData[i], "roles", roles);
})
@ -295,7 +295,7 @@
let url = "/userrole/list/ws/" + row.id;
//
for (let i = 0; i < this.memberLineData.length; i++) {
this.$get(url + "/" + this.memberLineData[i].id, response => {
this.$get(url + "/" + encodeURIComponent(this.memberLineData[i].id), response => {
let roles = response.data;
this.$set(this.memberLineData[i], "roles", roles);
})
@ -421,7 +421,7 @@
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
this.result = this.$get('/user/special/ws/member/delete/' + this.currentWorkspaceRow.id + '/' + row.id, () => {
this.result = this.$get('/user/special/ws/member/delete/' + this.currentWorkspaceRow.id + '/' + encodeURIComponent(row.id), () => {
let sourceId = this.currentWorkspaceRow.id;
let userId = row.id;
let user = getCurrentUser();

View File

@ -342,7 +342,6 @@
{min: 2, max: 50, message: this.$t('commons.input_limit', [2, 50]), trigger: 'blur'},
{
required: true,
pattern: /^[a-zA-Z0-9]+$/,
message: this.$t('user.special_characters_are_not_supported'),
trigger: 'blur'
}
@ -352,7 +351,6 @@
{min: 2, max: 50, message: this.$t('commons.input_limit', [2, 50]), trigger: 'blur'},
{
required: true,
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
message: this.$t('user.special_characters_are_not_supported'),
trigger: 'blur'
}
@ -415,10 +413,12 @@
this.$get("/workspace/list", response => {
this.$set(this.form, "wsList", response.data);
});
this.$get('/userrole/all/' + row.id, response => {
let data = response.data;
this.$set(this.form, "roles", data);
});
if (row.id) {
this.$get('/userrole/all/' + encodeURIComponent(row.id), response => {
let data = response.data;
this.$set(this.form, "roles", data);
});
}
listenGoBack(this.handleClose);
},
editPassword(row) {
@ -432,7 +432,7 @@
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
this.result = this.$get(this.deletePath + row.id, () => {
this.result = this.$get(this.deletePath + encodeURIComponent(row.id), () => {
this.$success(this.$t('commons.delete_success'));
this.search();
});
@ -487,13 +487,15 @@
this.tableData = data.listObject;
let url = "/user/special/user/role";
for (let i = 0; i < this.tableData.length; i++) {
this.$get(url + '/' + this.tableData[i].id, result => {
let data = result.data;
let roles = data.roles;
// let userRoles = result.userRoles;
this.$set(this.tableData[i], "roles", roles);
this.$set(this.tableData[i], "isLdapUser", this.tableData[i].source === 'LDAP');
});
if (this.tableData[i].id) {
this.$get(url + '/' + encodeURIComponent(this.tableData[i].id), result => {
let data = result.data;
let roles = data.roles;
// let userRoles = result.userRoles;
this.$set(this.tableData[i], "roles", roles);
this.$set(this.tableData[i], "isLdapUser", this.tableData[i].source === 'LDAP');
});
}
}
})
},

View File

@ -159,7 +159,7 @@
this.tableData = data.listObject;
let url = "/userrole/list/ws/" + this.currentUser().lastWorkspaceId;
for (let i = 0; i < this.tableData.length; i++) {
this.$get(url + "/" + this.tableData[i].id, response => {
this.$get(url + "/" + encodeURIComponent(this.tableData[i].id), response => {
let roles = response.data;
this.$set(this.tableData[i], "roles", roles);
})
@ -183,7 +183,7 @@
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
this.result = this.$get('/user/ws/member/delete/' + this.currentUser().lastWorkspaceId + '/' + row.id,() => {
this.result = this.$get('/user/ws/member/delete/' + this.currentUser().lastWorkspaceId + '/' + encodeURIComponent(row.id),() => {
this.$success(this.$t('commons.remove_success'));
this.initTableData();
});