diff --git a/backend/pom.xml b/backend/pom.xml index 2c3cc33110..2bb2b6b50d 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -5,7 +5,7 @@ dataease-server io.dataease - 1.2.0 + 1.3.0 4.0.0 @@ -316,7 +316,7 @@ io.dataease dataease-plugin-interface - 1.2 + 1.3 @@ -337,6 +337,11 @@ 5.7.4 + + org.springframework.boot + spring-boot-starter-data-ldap + + + + diff --git a/frontend/pom.xml b/frontend/pom.xml index fdb5d8962b..604c6b2027 100644 --- a/frontend/pom.xml +++ b/frontend/pom.xml @@ -6,7 +6,7 @@ dataease-server io.dataease - 1.2.0 + 1.3.0 4.0.0 diff --git a/frontend/src/api/system/user.js b/frontend/src/api/system/user.js index 47cfc04581..7b9e877ef2 100644 --- a/frontend/src/api/system/user.js +++ b/frontend/src/api/system/user.js @@ -98,4 +98,29 @@ export function roleGrid(pageIndex, pageSize, data) { }) } -export default { editPassword, delUser, editUser, addUser, userLists, editStatus, persionInfo, updatePerson, updatePersonPwd, allRoles, roleGrid } +export function ldapUsers(data) { + return request({ + url: '/api/ldap/users', + method: 'post', + loading: true + }) +} + +export function saveLdapUser(data) { + return request({ + url: '/api/user/sync', + method: 'post', + loading: true, + data + }) +} + +export function existLdapUsers() { + return request({ + url: '/api/user/existLdapUsers', + method: 'post', + loading: false + }) +} + +export default { editPassword, delUser, editUser, addUser, userLists, editStatus, persionInfo, updatePerson, updatePersonPwd, allRoles, roleGrid, ldapUsers, saveLdapUser, existLdapUsers } diff --git a/frontend/src/api/user.js b/frontend/src/api/user.js index ee99beb1eb..1768205ce8 100644 --- a/frontend/src/api/user.js +++ b/frontend/src/api/user.js @@ -50,3 +50,10 @@ export function languageApi(language) { method: 'post' }) } + +export function ldapStatus() { + return request({ + url: '/api/auth/isOpenLdap', + method: 'post' + }) +} diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 8e18d12236..f8e31b3331 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -482,6 +482,7 @@ export default { input_password: '请输入密码', input_phone: '请输入电话号码', input_roles: '请选择角色', + select_users: '请选择用户', special_characters_are_not_supported: '不支持特殊字符', mobile_number_format_is_incorrect: '手机号码格式不正确', email_format_is_incorrect: '邮箱格式不正确', @@ -496,7 +497,38 @@ export default { new_passwd: '新密码', confirm_passwd: '确认密码', change_password: '修改密码', - search_by_name: '按姓名搜索' + search_by_name: '按姓名搜索', + import_ldap: '导入LDAP用户' + }, + ldap: { + url: 'LDAP地址', + dn: '绑定DN', + password: '密码', + ou: '用户OU', + filter: '用户过滤器', + mapping: 'LDAP属性映射', + open: '启用LDAP认证', + input_url: '请输入LDAP地址', + input_dn: '请输入DN', + input_password: '请输入密码', + input_ou: '请输入用户OU', + input_filter: '请输入用户过滤器', + input_mapping: '请输入LDAP属性映射', + input_username: '请输入用户名', + input_url_placeholder: '请输入LDAP地址 (如 ldap://localhost:389)', + input_ou_placeholder: '输入用户OU (使用|分隔各OU)', + input_filter_placeholder: '输入过滤器 [可能的选项是cn或uid或sAMAccountName={0}, 如:(uid={0})]', + input_mapping_placeholder: '如:{"username":"uid","name":"sn","email":"mail"}, username映射的选项可能是cn或uid或sAMAccountName', + test_connect: '测试连接', + test_login: '测试登录', + edit: '编辑', + login_success: '登录成功', + url_cannot_be_empty: 'LDAP 地址不能为空', + dn_cannot_be_empty: 'LDAP DN不能为空', + ou_cannot_be_empty: 'LDAP OU不能为空', + filter_cannot_be_empty: 'LDAP 用户过滤器不能为空', + mapping_cannot_be_empty: 'LDAP 用户属性映射不能为空', + password_cannot_be_empty: 'LDAP 密码不能为空' }, role: { menu_authorization: '菜单授权', diff --git a/frontend/src/store/modules/user.js b/frontend/src/store/modules/user.js index edf18a7091..284f38bac5 100644 --- a/frontend/src/store/modules/user.js +++ b/frontend/src/store/modules/user.js @@ -71,9 +71,9 @@ const mutations = { const actions = { // user login login({ commit }, userInfo) { - const { username, password } = userInfo + const { username, password, loginType } = userInfo return new Promise((resolve, reject) => { - login({ username: username.trim(), password: password }).then(response => { + login({ username: username.trim(), password: password, loginType: loginType }).then(response => { const { data } = response commit('SET_TOKEN', data.token) commit('SET_LOGIN_MSG', null) diff --git a/frontend/src/views/login/index.vue b/frontend/src/views/login/index.vue index 47e7186721..eadb585c48 100644 --- a/frontend/src/views/login/index.vue +++ b/frontend/src/views/login/index.vue @@ -15,6 +15,13 @@ {{ $t('login.welcome') + (uiInfo && uiInfo['ui.title'] && uiInfo['ui.title'].paramValue || ' DataEase') }}
+ + + 普通登录 + LDAP + + + @@ -55,7 +62,7 @@ + diff --git a/frontend/src/views/system/settings/sso/index.vue b/frontend/src/views/system/settings/sso/index.vue new file mode 100644 index 0000000000..346b65549a --- /dev/null +++ b/frontend/src/views/system/settings/sso/index.vue @@ -0,0 +1,21 @@ + + + + diff --git a/frontend/src/views/system/settings/sso/ldap/index.vue b/frontend/src/views/system/settings/sso/ldap/index.vue new file mode 100644 index 0000000000..e69de29bb2 diff --git a/frontend/src/views/system/settings/sso/oidc/index.vue b/frontend/src/views/system/settings/sso/oidc/index.vue new file mode 100644 index 0000000000..e69de29bb2 diff --git a/frontend/src/views/system/settings/theme/index.vue b/frontend/src/views/system/settings/theme/index.vue new file mode 100644 index 0000000000..8e466fc5f4 --- /dev/null +++ b/frontend/src/views/system/settings/theme/index.vue @@ -0,0 +1,10 @@ + + diff --git a/frontend/src/views/system/user/imp-ldap.vue b/frontend/src/views/system/user/imp-ldap.vue new file mode 100644 index 0000000000..ff8af77267 --- /dev/null +++ b/frontend/src/views/system/user/imp-ldap.vue @@ -0,0 +1,267 @@ + + + diff --git a/frontend/src/views/system/user/index.vue b/frontend/src/views/system/user/index.vue index 92e859ba2f..c5f4188913 100644 --- a/frontend/src/views/system/user/index.vue +++ b/frontend/src/views/system/user/index.vue @@ -12,11 +12,19 @@ > - + + + + @@ -166,7 +174,7 @@ import { PHONE_REGEX } from '@/utils/validate' import { LOAD_CHILDREN_OPTIONS, LOAD_ROOT_OPTIONS } from '@riophae/vue-treeselect' import Treeselect from '@riophae/vue-treeselect' import '@riophae/vue-treeselect/dist/vue-treeselect.css' - +import { ldapStatus } from '@/api/user' import { userLists, addUser, editUser, delUser, editPassword, editStatus, allRoles } from '@/api/system/user' import { getDeptTree, treeByDeptId } from '@/api/system/dept' @@ -297,14 +305,19 @@ export default { editPwd: ['user:editPwd'] }, orderConditions: [], - last_condition: null + last_condition: null, + openLdap: false } }, mounted() { this.allRoles() this.search() }, - + beforeCreate() { + ldapStatus().then(res => { + this.openLdap = res.success && res.data + }) + }, methods: { sortChange({ column, prop, order }) { this.orderConditions = [] @@ -479,6 +492,9 @@ export default { }, btnDisabled(row) { return row.userId === 1 + }, + importLdap() { + this.$router.push({ name: 'system-user-import' }) } } } diff --git a/pom.xml b/pom.xml index 24a7db2ef7..1e915295bf 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.dataease dataease-server - 1.2.0 + 1.3.0 pom