This adds support for the ADLDAP_AUTH_FILTER env var, and the

ldap_auth.custom_filter config option. These are optional.

If provided, the custom filter will be applied to the LDAP query
using the FireflyIII\Scopes\LdapFilterScope class.

This allows the integrator to specify a custom LDAP filter.
This commit is contained in:
root
2020-08-26 14:07:47 +00:00
parent 4e05ce4c35
commit 0ee3941b43
2 changed files with 40 additions and 1 deletions

View File

@@ -0,0 +1,21 @@
<?php
namespace FireflyIII\Scopes;
use Adldap\Query\Builder;
use Adldap\Laravel\Scopes\ScopeInterface;
class LdapFilterScope implements ScopeInterface {
/**
* If the ADLDAP_AUTH_FILTER is provided, apply the filter to the LDAP query.
* @param Builder $query
* @return void
*/
public function apply(Builder $query)
{
$filter = config('ldap_auth.custom_filter');
if ( $filter ) {
$query->rawFilter($filter);
}
}
}