Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangpeng
dinky
Commits
51b9c0c0
Unverified
Commit
51b9c0c0
authored
Feb 28, 2024
by
Zzm0809
Committed by
GitHub
Feb 28, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Feature] support import ldap user search (#3192)
Co-authored-by:
Zzm0809
<
Zzm0809@users.noreply.github.com
>
parent
ad0ec3f6
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
5 deletions
+29
-5
LdapController.java
...in/src/main/java/org/dinky/controller/LdapController.java
+2
-2
Status.java
dinky-common/src/main/java/org/dinky/data/enums/Status.java
+2
-0
messages_en_US.properties
...-common/src/main/resources/i18n/messages_en_US.properties
+1
-0
messages_zh_CN.properties
...-common/src/main/resources/i18n/messages_zh_CN.properties
+1
-0
pages.ts
dinky-web/src/locales/en-US/pages.ts
+2
-0
pages.ts
dinky-web/src/locales/zh-CN/pages.ts
+1
-0
LoadUser.tsx
...tting/SettingOverView/LdapConfig/compontents/LoadUser.tsx
+20
-3
No files found.
dinky-admin/src/main/java/org/dinky/controller/LdapController.java
View file @
51b9c0c0
...
...
@@ -74,7 +74,7 @@ public class LdapController {
@Log
(
title
=
"Test connection to LDAP server"
,
businessType
=
BusinessType
.
TEST
)
public
Result
<
Integer
>
testConnection
()
{
List
<
User
>
users
=
ldapService
.
listUsers
();
if
(
users
.
size
()
>
0
)
{
if
(
!
users
.
isEmpty
()
)
{
return
Result
.
succeed
(
users
.
size
());
}
else
{
return
Result
.
failed
(
Status
.
LDAP_NO_USER_FOUND
);
...
...
@@ -120,7 +120,7 @@ public class LdapController {
@ApiImplicitParam
(
name
=
"loginDTO"
,
value
=
"Login information"
,
required
=
true
,
dataType
=
"LoginDTO"
)
public
Result
<
User
>
login
(
@RequestBody
LoginDTO
loginDTO
)
{
try
{
return
Result
.
succeed
(
ldapService
.
authenticate
(
loginDTO
));
return
Result
.
succeed
(
ldapService
.
authenticate
(
loginDTO
)
,
Status
.
LDAP_LOGIN_TEST_SUCCESS
);
}
catch
(
AuthException
e
)
{
return
Result
.
failed
(
e
.
getStatus
());
}
catch
(
NamingException
e
)
{
...
...
dinky-common/src/main/java/org/dinky/data/enums/Status.java
View file @
51b9c0c0
...
...
@@ -260,6 +260,8 @@ public enum Status {
LDAP_LOGIN_FORBID
(
18007
,
"ldap.login.forbid"
),
LDAP_LOGIN_TEST_SUCCESS
(
18008
,
"ldap.login.test.success"
),
/**
* datastudio about
*/
...
...
dinky-common/src/main/resources/i18n/messages_en_US.properties
View file @
51b9c0c0
...
...
@@ -24,6 +24,7 @@ delete.success=Delete Successfully
clear.success
=
Clear Successfully
move.success
=
Move Successfully
ldap.login.forbid
=
If the current user login mode is not LDAP, contact the administrator to modify it, or do not use LDAP to log in
ldap.login.test.success
=
LDAP Login Test Success
request.params.not.valid.error
=
Request Parameter {0} Is Not Valid
change.password.failed
=
Change Password Failed
menu.name.exist
=
Menu Already Exists
...
...
dinky-common/src/main/resources/i18n/messages_zh_CN.properties
View file @
51b9c0c0
...
...
@@ -24,6 +24,7 @@ delete.success=删除成功
clear.success
=
清除成功
move.success
=
移动成功
ldap.login.forbid
=
当前用户登录模式不是LDAP,请联系管理员修改,或不使用LDAP登录
ldap.login.test.success
=
LDAP 登录测试成功
request.params.not.valid.error
=
请求参数[{0}]无效
change.password.failed
=
修改密码失败
menu.name.exist
=
菜单已存在
...
...
dinky-web/src/locales/en-US/pages.ts
View file @
51b9c0c0
...
...
@@ -1100,6 +1100,8 @@ export default {
'sys.ldap.settings.testConnect.success'
:
'Test Connect Successful, {count} users were obtained'
,
'sys.ldap.settings.testLogin'
:
'Test Login'
,
'sys.ldap.settings.loadUser'
:
'Load User'
,
'sys.ldap.settings.keyword'
:
'You can enter your username/nickname for search, support fuzzy queries, enter keywords and press enter to complete the search'
,
'sys.ldap.settings.loadable'
:
'Whether it can be imported'
,
/**
*
...
...
dinky-web/src/locales/zh-CN/pages.ts
View file @
51b9c0c0
...
...
@@ -1058,6 +1058,7 @@ export default {
'sys.ldap.settings.testConnect.success'
:
'测试连接成功,获取到了{count}个用户'
,
'sys.ldap.settings.testLogin'
:
'测试登录'
,
'sys.ldap.settings.loadUser'
:
'导入用户'
,
'sys.ldap.settings.keyword'
:
'可输入用户名/昵称进行搜索,支持模糊查询,输入关键词后回车即可'
,
'sys.ldap.settings.loadable'
:
'是否可以导入'
,
/**
*
...
...
dinky-web/src/pages/SettingCenter/GlobalSetting/SettingOverView/LdapConfig/compontents/LoadUser.tsx
View file @
51b9c0c0
...
...
@@ -24,7 +24,7 @@ import { UserBaseInfo } from '@/types/AuthCenter/data.d';
import
{
l
}
from
'@/utils/intl'
;
import
{
UserSwitchOutlined
}
from
'@ant-design/icons'
;
import
{
ModalForm
}
from
'@ant-design/pro-components'
;
import
{
Table
,
Tag
}
from
'antd'
;
import
{
Input
,
Table
,
Tag
}
from
'antd'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
useState
}
from
'react'
;
...
...
@@ -49,6 +49,8 @@ export const LoadUser = () => {
const
[
selectedUsers
,
setSelectedUsers
]
=
useState
<
UserBaseInfo
.
User
[]
>
([]);
const
[
users
,
setUsers
]
=
useState
<
UserBaseInfo
.
User
[]
>
([]);
const
[
keyword
,
setKeyword
]
=
useState
(
''
);
const
fetchUserData
=
async
()
=>
{
setLoading
(
true
);
const
res
=
await
getData
(
API_CONSTANTS
.
LDAP_LIST_USER
);
...
...
@@ -70,7 +72,12 @@ export const LoadUser = () => {
<>
<
ModalForm
title=
{
l
(
'sys.ldap.settings.loadUser'
)
}
width=
{
800
}
width=
{
'50%'
}
submitter=
{
{
submitButtonProps
:
{
disabled
:
selectedUsers
.
length
===
0
}
}
}
onFinish=
{
()
=>
importUser
()
}
trigger=
{
<
Tag
icon=
{
<
UserSwitchOutlined
/>
}
color=
'#f50'
onClick=
{
()
=>
fetchUserData
()
}
>
...
...
@@ -78,6 +85,13 @@ export const LoadUser = () => {
</
Tag
>
}
>
<
Input
.
Search
placeholder=
{
l
(
'sys.ldap.settings.keyword'
)
}
style=
{
{
marginBottom
:
8
}
}
enterButton
loading=
{
loading
}
onSearch=
{
(
value
)
=>
setKeyword
(
value
)
}
/>
<
Table
<
UserBaseInfo
.
User
>
loading=
{
loading
}
size=
{
'small'
}
...
...
@@ -86,7 +100,10 @@ export const LoadUser = () => {
onChange
:
(
_
,
rows
)
=>
setSelectedUsers
(
rows
),
getCheckboxProps
:
(
record
)
=>
({
disabled
:
!
record
.
enabled
})
}
}
dataSource=
{
users
}
dataSource=
{
users
.
filter
(
(
user
)
=>
user
.
username
.
indexOf
(
keyword
)
!==
-
1
||
user
.
nickname
?.
indexOf
(
keyword
)
!==
-
1
)
}
rowKey=
{
'username'
}
/
>
</
ModalForm
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment