Skip to content

Commit

Permalink
Add log for #5133
Browse files Browse the repository at this point in the history
  • Loading branch information
JC5 committed Oct 3, 2021
1 parent 10f8002 commit e60444c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/Ldap/Rules/UserDefinedRule.php
Expand Up @@ -5,6 +5,7 @@

use LdapRecord\Laravel\Auth\Rule;
use LdapRecord\Models\ActiveDirectory\Group;
use Log;

/**
* Class UserDefinedRule
Expand All @@ -20,11 +21,16 @@ public function isValid()
{
// LDAP_GROUP_FILTER
$groupFilter = config('ldap.group_filter');
Log::debug(sprintf('UserDefinedRule with group filter "%s"', $groupFilter));
if (null !== $groupFilter && '' !== (string)$groupFilter) {
$administrators = Group::find('cn=Administrators,dc=local,dc=com');
Log::debug('Group filter is not empty, will now apply it.');
$administrators = Group::find($groupFilter);
$result = $this->user->groups()->recursive()->exists($administrators);
Log::debug(sprintf('Search result is %s.', var_export($result, true)));

return $this->user->groups()->recursive()->exists($administrators);
return $result;
}
Log::debug('Group filter is empty or NULL, so will return true.');

return true;
}
Expand Down

0 comments on commit e60444c

Please sign in to comment.