Closed nerdalertdk closed 4 years ago
Hi @nerdalertdk,
If null
is passed into the exists()
method, then it simply checks if the relation contains any results.
I will patch this to ensure if a null
argument is passed into the method, then false
will be returned. 👍
Okay patched -- I'll have a release out shortly with this fix.
In the interim, I'd recommend using Group::findOrFail()
to ensure the group you are requiring to be checked can be found:
$group = Group::findOrFail('cn=donotexists,cn=groups,cn=accounts,dc=domain,dc=tld');
Or, use the group itself to determine if the authenticating user is a member of the group:
return Group::findOrFail('cn=donotexists,cn=groups,cn=accounts,dc=domain,dc=tld')
->members()
->recursive()
->exists($this->user);
v1.11.0 is now out with this patch. Thanks again for the report! 😄
I actually just copied you documentation code :)
It’s use for a rule
Environment (please complete the following information):
Describe the bug:
I'm trying to make an login Rule, base code is from your example
Why do this return true
Input:
Output:
it also returns true on
false
the only way I got it to return false was supplying an string such as'false'
How I fixed it but would call this a hack
$group = Group::find('cn=donotexists,cn=groups,cn=accounts,dc=domain,dc=tld') ?: 'false';
User Class
Group class