You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ke...@apache.org on 2022/01/08 10:01:32 UTC
[dolphinscheduler] branch dev updated: [Fix-7857] The user won't be allowed to disable their own account. (#7891)
This is an automated email from the ASF dual-hosted git repository.
kerwin pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new 24eb40c [Fix-7857] The user won't be allowed to disable their own account. (#7891)
24eb40c is described below
commit 24eb40c2b24f3361617ae59c9264fa52546033db
Author: calvin <ji...@163.com>
AuthorDate: Sat Jan 8 18:01:22 2022 +0800
[Fix-7857] The user won't be allowed to disable their own account. (#7891)
---
.../java/org/apache/dolphinscheduler/api/enums/Status.java | 3 ++-
.../dolphinscheduler/api/service/impl/UsersServiceImpl.java | 6 ++++++
.../home/pages/security/pages/users/_source/createUser.vue | 11 +++++++++--
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
index b5202c5..49d01a2 100644
--- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
+++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
@@ -365,7 +365,8 @@ public enum Status {
ENVIRONMENT_WORKER_GROUPS_IS_INVALID(130015, "environment worker groups is invalid format", "环境关联的工作组参数解析错误"),
UPDATE_ENVIRONMENT_WORKER_GROUP_RELATION_ERROR(130016,"You can't modify the worker group, because the worker group [{0}] and this environment [{1}] already be used in the task [{2}]",
"您不能修改工作组选项,因为该工作组 [{0}] 和 该环境 [{1}] 已经被用在任务 [{2}] 中"),
- TASK_GROUP_QUEUE_ALREADY_START(130017, "task group queue already start", "节点已经获取任务组资源")
+ TASK_GROUP_QUEUE_ALREADY_START(130017, "task group queue already start", "节点已经获取任务组资源"),
+ NOT_ALLOW_TO_DISABLE_OWN_ACCOUNT(130020, "Not allow to disable your own account", "不能停用自己的账号"),
;
private final int code;
diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
index fd9561b..7790b86 100644
--- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
+++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
@@ -407,6 +407,12 @@ public class UsersServiceImpl extends BaseServiceImpl implements UsersService {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, phone);
return result;
}
+
+ if (state == 0 && user.getState() != state && loginUser.getId() == user.getId()) {
+ putMsg(result, Status.NOT_ALLOW_TO_DISABLE_OWN_ACCOUNT);
+ return result;
+ }
+
user.setPhone(phone);
user.setQueue(queue);
user.setState(state);
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/users/_source/createUser.vue b/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/users/_source/createUser.vue
index 8f3adc0..41e039d 100644
--- a/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/users/_source/createUser.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/users/_source/createUser.vue
@@ -103,7 +103,7 @@
</el-input>
</template>
</m-list-box-f>
- <m-list-box-f style="line-height: 38px;">
+ <m-list-box-f v-if="showState" style="line-height: 38px;">
<template slot="name">{{$t('State')}}</template>
<template slot="content">
<el-radio-group v-model="userState" size="small">
@@ -123,6 +123,7 @@
import router from '@/conf/home/router'
import mPopover from '@/module/components/popup/popover'
import mListBoxF from '@/module/components/listBoxF/listBoxF'
+ import { mapState } from 'vuex'
export default {
name: 'create-user',
@@ -139,6 +140,7 @@
phone: '',
userState: '1',
tenantList: [],
+ showState: true,
// Source admin user information
isADMIN: store.state.user.userInfo.userType === 'ADMIN_USER' && router.history.current.name !== 'account'
}
@@ -292,6 +294,7 @@
watch: {},
created () {
// Administrator gets tenant list
+ this.showState = true
if (this.isADMIN) {
Promise.all([this._getQueueList(), this._getTenantList()]).then(() => {
if (this.item) {
@@ -301,6 +304,7 @@
this.phone = this.item.phone
this.state = this.item.state
this.userState = this.item.state + '' || '1'
+ this.showState = this.item.id !== this.userInfo.id
if (this.fromUserInfo || this.item.tenantId) {
this.tenantId = this.item.tenantId
}
@@ -320,6 +324,7 @@
this.phone = this.item.phone
this.state = this.item.state
this.userState = this.state + '' || '1'
+ this.showState = this.item.id !== this.userInfo.id
if (this.fromUserInfo || this.item.tenantId) {
this.tenantId = this.item.tenantId
}
@@ -335,7 +340,9 @@
}
},
mounted () {
-
+ },
+ computed: {
+ ...mapState('user', ['userInfo'])
},
components: { mPopover, mListBoxF }
}