fix(项目设置): 用户组与权限-成员,可以移除当前登录用户

--bug=1013108 --user=李玉号 【项目设置】用户组与权限-成员,可以移除当前登录用户,移除后,再刷新页面报404
https://www.tapd.cn/55049933/s/1156754
This commit is contained in:
shiziyuan9527 2022-05-12 13:59:30 +08:00 committed by shiziyuan9527
parent 261ab1f6c0
commit ab511d04f6
5 changed files with 18 additions and 5 deletions

View File

@ -91,7 +91,7 @@ import MsTableHeaderSelectPopover from "@/business/components/common/components/
import ShowMoreBtn from "@/business/components/track/case/components/ShowMoreBtn";
import EditMember from "@/business/components/project/menu/EditMember";
import {GROUP_PROJECT} from "@/common/js/constants";
import {getCurrentProjectID, getCurrentWorkspaceId} from "@/common/js/utils";
import {getCurrentProjectID, getCurrentUserId, getCurrentWorkspaceId} from "@/common/js/utils";
import MsContainer from "@/business/components/common/components/MsContainer";
import MsMainContainer from "@/business/components/common/components/MsMainContainer";
@ -169,6 +169,10 @@ export default {
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
if (row.id === getCurrentUserId()) {
this.$warning(this.$t('group.unable_to_remove_current_member'));
return;
}
this.result = this.$get('/user/project/member/delete/' + this.projectId + '/' + encodeURIComponent(row.id), () => {
this.$success(this.$t('commons.remove_success'));
this.initTableData();

View File

@ -100,7 +100,7 @@ import MsTablePagination from "@/business/components/common/pagination/TablePagi
import {GROUP_PROJECT, GROUP_SYSTEM, GROUP_WORKSPACE} from "@/common/js/constants";
import MsTableOperator from "@/business/components/common/components/MsTableOperator";
import UserOptionItem from "@/business/components/settings/common/UserOptionItem";
import {getCurrentProjectID} from "@/common/js/utils";
import {getCurrentProjectID, getCurrentUserId} from "@/common/js/utils";
export default {
name: "GroupMember",
@ -233,6 +233,12 @@ export default {
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
if (this.initUserUrl === 'user/ws/current/member/list') {
if (row.id === getCurrentUserId()) {
this.$warning(this.$t('group.unable_to_remove_current_member'));
return;
}
}
this.result = this.$get('/user/group/rm/' + row.id + '/' + this.group.id, () => {
this.$success(this.$t('commons.remove_success'));
this.init();

View File

@ -903,6 +903,7 @@ export default {
permission: 'Permission',
please_select_group: 'Please Select Group',
global: 'Global',
unable_to_remove_current_member: 'Unable to remove currently logged in user!',
ws_admin_global: 'Only workspace administrators can create global user groups'
},
role: {
@ -3168,6 +3169,6 @@ export default {
report: "Test Report",
ui_debug_mode: 'UI debugging mode',
ui_local_debug: 'local',
ui_server_debug: 'server',
ui_server_debug: 'server',
}
};

View File

@ -907,6 +907,7 @@ export default {
permission: '权限',
please_select_group: '请选择用户组',
global: '全局',
unable_to_remove_current_member: '无法移除当前登录用户!',
ws_admin_global: '工作空间管理员才可以创建全局用户组'
},
role: {
@ -3221,6 +3222,6 @@ export default {
valiate_fail: "校验失败,请检查必填项",
ui_debug_mode: 'UI自动化调试方式',
ui_local_debug: '本地调试',
ui_server_debug: '后端调试',
ui_server_debug: '后端调试',
}
};

View File

@ -907,6 +907,7 @@ export default {
permission: '權限',
please_select_group: '請選擇用戶組',
global: '全局',
unable_to_remove_current_member: '無法移除當前登錄用戶!',
ws_admin_global: '工作空間管理員才可以創建全局用戶組'
},
role: {
@ -3172,6 +3173,6 @@ export default {
report: "測試報告",
ui_debug_mode: 'UI自動化調試管道',
ui_local_debug: '本地調試',
ui_server_debug: '後端調試',
ui_server_debug: '後端調試',
}
};