Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
DolphinScheduler
提交
961e67f5
DolphinScheduler
项目概览
apache
/
DolphinScheduler
上一次同步 1 年多
通知
707
Star
9572
Fork
3514
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
DolphinScheduler
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
961e67f5
编写于
8月 24, 2022
作者:
J
JiPeng Wang
提交者:
GitHub
8月 24, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Improvement][User] Query all users filter un enabled. (#11504)
* user query all filter un enabled * restore permissions
上级
3e738299
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
10 addition
and
17 deletion
+10
-17
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
...e/dolphinscheduler/api/service/impl/UsersServiceImpl.java
+1
-8
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java
...apache/dolphinscheduler/api/service/UsersServiceTest.java
+1
-2
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/UserMapper.java
...va/org/apache/dolphinscheduler/dao/mapper/UserMapper.java
+2
-7
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/UserMapper.xml
...ces/org/apache/dolphinscheduler/dao/mapper/UserMapper.xml
+6
-0
未找到文件。
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java
浏览文件 @
961e67f5
...
...
@@ -80,7 +80,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
...
...
@@ -977,13 +976,7 @@ public class UsersServiceImpl extends BaseServiceImpl implements UsersService {
putMsg
(
result
,
Status
.
USER_NO_OPERATION_PERM
);
return
result
;
}
QueryWrapper
<
User
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
ge
(
"id"
,
0
);
if
(
loginUser
.
getUserType
().
equals
(
UserType
.
GENERAL_USER
))
{
queryWrapper
.
eq
(
"id"
,
loginUser
.
getId
());
}
List
<
User
>
userList
=
userMapper
.
selectList
(
null
);
List
<
User
>
userList
=
userMapper
.
queryEnabledUsers
();
result
.
put
(
Constants
.
DATA_LIST
,
userList
);
putMsg
(
result
,
Status
.
SUCCESS
);
...
...
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/UsersServiceTest.java
浏览文件 @
961e67f5
...
...
@@ -252,7 +252,6 @@ public class UsersServiceTest {
user
.
setUserType
(
UserType
.
ADMIN_USER
);
user
.
setId
(
1
);
//no operate
Mockito
.
when
(
resourcePermissionCheckService
.
operationPermissionCheck
(
AuthorizationType
.
ACCESS_TOKEN
,
null
,
1
,
USER_MANAGER
,
serviceLogger
)).
thenReturn
(
true
);
Mockito
.
when
(
resourcePermissionCheckService
.
resourcePermissionCheck
(
AuthorizationType
.
ACCESS_TOKEN
,
null
,
0
,
serviceLogger
)).
thenReturn
(
false
);
Map
<
String
,
Object
>
result
=
usersService
.
queryUserList
(
user
);
...
...
@@ -263,7 +262,7 @@ public class UsersServiceTest {
Mockito
.
when
(
resourcePermissionCheckService
.
operationPermissionCheck
(
AuthorizationType
.
ACCESS_TOKEN
,
null
,
1
,
USER_MANAGER
,
serviceLogger
)).
thenReturn
(
true
);
Mockito
.
when
(
resourcePermissionCheckService
.
resourcePermissionCheck
(
AuthorizationType
.
ACCESS_TOKEN
,
null
,
0
,
serviceLogger
)).
thenReturn
(
true
);
user
.
setUserType
(
UserType
.
ADMIN_USER
);
when
(
userMapper
.
selectList
(
null
)).
thenReturn
(
getUserList
());
when
(
userMapper
.
queryEnabledUsers
(
)).
thenReturn
(
getUserList
());
result
=
usersService
.
queryUserList
(
user
);
List
<
User
>
userList
=
(
List
<
User
>)
result
.
get
(
Constants
.
DATA_LIST
);
Assert
.
assertTrue
(
userList
.
size
()
>
0
);
...
...
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/UserMapper.java
浏览文件 @
961e67f5
...
...
@@ -174,13 +174,8 @@ public interface UserMapper extends BaseMapper<User> {
List
<
User
>
queryAuthedUserListByProjectId
(
@Param
(
"projectId"
)
int
projectId
);
/**
* list authorized User
* @param userId
* @param resourcesIds
* @param <T>
* query enabled users
* @return
*/
<
T
>
List
<
User
>
listAuthorizedUsersList
(
@Param
(
"userId"
)
int
userId
,
@Param
(
"resourcesIds"
)
T
[]
resourcesIds
);
List
<
User
>
queryEnabledUsers
();
}
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/UserMapper.xml
浏览文件 @
961e67f5
...
...
@@ -131,4 +131,10 @@
from t_ds_user u, t_ds_relation_project_user rel
where u.id = rel.user_id and rel.project_id = #{projectId}
</select>
<select
id=
"queryEnabledUsers"
resultType=
"org.apache.dolphinscheduler.dao.entity.User"
>
select
<include
refid=
"baseSql"
/>
from t_ds_user
where state = 1
</select>
</mapper>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录