mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2024-12-23 02:04:46 +02:00
[Web] apply LDAP filter
This commit is contained in:
parent
766c270b1f
commit
010d898786
@ -110,8 +110,11 @@ fwrite($lock_file_handle, getmypid());
|
|||||||
fclose($lock_file_handle);
|
fclose($lock_file_handle);
|
||||||
|
|
||||||
// Get ldap users
|
// Get ldap users
|
||||||
$response = $iam_provider->query()
|
$ldap_query = $iam_provider->query();
|
||||||
->where($iam_settings['username_field'], "*")
|
if (!empty($iam_settings['filter'])) {
|
||||||
|
$ldap_query = $ldap_query->rawFilter($iam_settings['filter']);
|
||||||
|
}
|
||||||
|
$response = $ldap_query->where($iam_settings['username_field'], "*")
|
||||||
->where($iam_settings['attribute_field'], "*")
|
->where($iam_settings['attribute_field'], "*")
|
||||||
->select([$iam_settings['username_field'], $iam_settings['attribute_field'], 'displayname'])
|
->select([$iam_settings['username_field'], $iam_settings['attribute_field'], 'displayname'])
|
||||||
->paginate($max);
|
->paginate($max);
|
||||||
|
@ -493,12 +493,12 @@ function ldap_mbox_login($user, $pass, $iam_settings, $extra = null){
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$ldap_query = $iam_provider->query()
|
$ldap_query = $iam_provider->query();
|
||||||
->where($iam_settings['username_field'], '=', $user)
|
|
||||||
->select([$iam_settings['username_field'], $iam_settings['attribute_field'], 'displayname', 'distinguishedname']);
|
|
||||||
if (!empty($iam_settings['filter'])) {
|
if (!empty($iam_settings['filter'])) {
|
||||||
$ldap_query = $ldap_query->whereRaw($iam_settings['filter']);
|
$ldap_query = $ldap_query->rawFilter($iam_settings['filter']);
|
||||||
}
|
}
|
||||||
|
$ldap_query = $ldap_query->where($iam_settings['username_field'], '=', $user)
|
||||||
|
->select([$iam_settings['username_field'], $iam_settings['attribute_field'], 'displayname', 'distinguishedname']);
|
||||||
|
|
||||||
$user_res = $ldap_query->firstOrFail();
|
$user_res = $ldap_query->firstOrFail();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user