<commit_before><?php
declare(strict_types=1);

namespace FireflyIII\Ldap\Rules;

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

/**
 * Class UserDefinedRule
 */
class UserDefinedRule extends Rule
{
    /**
     * Check if the rule passes validation.
     *
     * @return bool
     */
    public function isValid()
    {
        // LDAP_GROUP_FILTER
        $groupFilter = config('ldap.group_filter');
        if (null !== $groupFilter && '' !== (string)$groupFilter) {
            $administrators = Group::find('cn=Administrators,dc=local,dc=com');

            return $this->user->groups()->recursive()->exists($administrators);
        }

        return true;
    }
}<commit_msg>Add log for #5133<commit_after><?php
declare(strict_types=1);

namespace FireflyIII\Ldap\Rules;

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

/**
 * Class UserDefinedRule
 */
class UserDefinedRule extends Rule
{
    /**
     * Check if the rule passes validation.
     *
     * @return bool
     */
    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) {
            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 $result;
        }
        Log::debug('Group filter is empty or NULL, so will return true.');

        return true;
    }
}
{'fraction_non_alphanumeric': 0.14189189189189189, 'fraction_numerical': 0.0033783783783783786, 'mean_word_length': 2.7568710359408035, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2867473', 'n_tokens_mistral': 524, 'n_tokens_neox': 521, 'n_words': 114}