mirror of https://github.com/tp4a/teleport
.调整ldap属性映射方式后,测试导入功能工作正常了,但尚未区分已导入和未导入的ldap用户。
parent
63a691394c
commit
143fca3fea
|
@ -1392,11 +1392,11 @@ $app.create_dlg_ldap_config = function () {
|
||||||
// $tp.notify_error('请填写LDAP的用户属性与teleport用户属性的映射关系!');
|
// $tp.notify_error('请填写LDAP的用户属性与teleport用户属性的映射关系!');
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
if (tp_is_empty_str(dlg.ldap_config.attr_username)) {
|
// if (tp_is_empty_str(dlg.ldap_config.attr_username)) {
|
||||||
dlg.dom.attr_username.focus();
|
// dlg.dom.attr_username.focus();
|
||||||
$tp.notify_error('请填写映射为teleport登录账号的LDAP用户属性!');
|
// $tp.notify_error('请填写映射为teleport登录账号的LDAP用户属性!');
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
@ -1429,6 +1429,11 @@ $app.create_dlg_ldap_config = function () {
|
||||||
dlg.do_test = function () {
|
dlg.do_test = function () {
|
||||||
if (!dlg.check_fields())
|
if (!dlg.check_fields())
|
||||||
return;
|
return;
|
||||||
|
if (tp_is_empty_str(dlg.ldap_config.attr_username)) {
|
||||||
|
dlg.dom.attr_username.focus();
|
||||||
|
$tp.notify_error('请填写映射为teleport登录账号的LDAP用户属性!');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
dlg.dom.btn_test.attr('disabled', 'disabled');
|
dlg.dom.btn_test.attr('disabled', 'disabled');
|
||||||
$tp.ajax_post_json('/system/do-ldap-config-test', {
|
$tp.ajax_post_json('/system/do-ldap-config-test', {
|
||||||
ldap: dlg.ldap_config
|
ldap: dlg.ldap_config
|
||||||
|
@ -1532,29 +1537,26 @@ $app.create_dlg_ldap_test_result = function () {
|
||||||
dlg.dom.table.empty();
|
dlg.dom.table.empty();
|
||||||
|
|
||||||
var h = [];
|
var h = [];
|
||||||
var dn, x;
|
h.push('<thead>');
|
||||||
var th_created = false;
|
h.push('<th style="text-align:left;" class="mono">登录名</th>');
|
||||||
for (dn in data) {
|
h.push('<th style="text-align:left;" class="mono">姓名</th>');
|
||||||
if (!th_created) {
|
h.push('<th style="text-align:left;" class="mono">邮箱</th>');
|
||||||
h.push('<thead>');
|
h.push('</thead>');
|
||||||
for (x in data[dn]) {
|
|
||||||
h.push('<th style="text-align:left;" class="mono">');
|
|
||||||
h.push(x);
|
|
||||||
h.push('</th>');
|
|
||||||
}
|
|
||||||
h.push('</thead>');
|
|
||||||
th_created = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
var _mktd = function(h, d) {
|
||||||
|
if((!_.isUndefined(d)) && !_.isEmpty(d))
|
||||||
|
h.push('<td style="text-align:left;" class="mono">'+d+'</td>');
|
||||||
|
else
|
||||||
|
h.push('<td></td>');
|
||||||
|
};
|
||||||
|
|
||||||
|
var dn;
|
||||||
|
for (dn in data) {
|
||||||
h.push('<tr>');
|
h.push('<tr>');
|
||||||
for (x in data[dn]) {
|
console.log(data[dn]);
|
||||||
h.push('<td style="text-align:left;" class="mono">');
|
_mktd(h, data[dn]['username']);
|
||||||
if (!_.isEmpty(data[dn][x]))
|
_mktd(h, data[dn]['surname']);
|
||||||
h.push(data[dn][x]);
|
_mktd(h, data[dn]['email']);
|
||||||
else
|
|
||||||
h.push('');
|
|
||||||
h.push('</td>');
|
|
||||||
}
|
|
||||||
h.push('</tr>');
|
h.push('</tr>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -644,7 +644,7 @@
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i
|
||||||
class="fa fa-times-circle fa-fw"></i></button>
|
class="fa fa-times-circle fa-fw"></i></button>
|
||||||
<h3 class="modal-title">LDAP连接测试结果</h3>
|
<h3 class="modal-title">获取LDAP用户测试</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
|
@ -712,23 +712,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
## <div class="form-horizontal">
|
|
||||||
## <div style="margin-bottom:8px;">
|
|
||||||
## LDAP用户列表:
|
|
||||||
## </div>
|
|
||||||
##
|
|
||||||
## <div class="form-group form-group-sm">
|
|
||||||
##
|
|
||||||
## <div class="col-sm-12">
|
|
||||||
## <table id="table-ldap-user-list"
|
|
||||||
## class="table table-striped table-bordered table-hover table-data no-footer dtr-inline"></table>
|
|
||||||
## </div>
|
|
||||||
##
|
|
||||||
## </div>
|
|
||||||
##
|
|
||||||
## </div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
|
|
@ -639,6 +639,11 @@ class DoLdapImportHandler(TPBaseJsonHandler):
|
||||||
try:
|
try:
|
||||||
user_list = []
|
user_list = []
|
||||||
for _u in users:
|
for _u in users:
|
||||||
|
if 'surname' not in _u:
|
||||||
|
_u['surname'] = _u['username']
|
||||||
|
if 'email' not in _u:
|
||||||
|
_u['email'] = ''
|
||||||
|
|
||||||
u = dict()
|
u = dict()
|
||||||
u['_line'] = 0
|
u['_line'] = 0
|
||||||
u['_id'] = 0
|
u['_id'] = 0
|
||||||
|
|
Loading…
Reference in New Issue