Fix for when the logged in user's details doesnt include an objectclass (because the query didnt have the ACLs to return them).

This should help #330 but doesnt allow the user to login even if they have the right objectclasses, but the query didnt return them.
This commit is contained in:
Deon George 2025-05-24 22:02:12 +10:00
parent 917a3c1a0d
commit c6e1640752

View File

@ -17,7 +17,10 @@ class LoginObjectclassRule implements Rule
public function passes(LdapRecord $user,?Eloquent $model=NULL): bool public function passes(LdapRecord $user,?Eloquent $model=NULL): bool
{ {
if ($x=config('pla.login.objectclass')) { if ($x=config('pla.login.objectclass')) {
return count(array_intersect($user->objectclass,$x)); return count(array_intersect(
array_map('strtolower',$user?->objectclass ?: []),
array_map('strtolower',$x)
));
// Otherwise allow the user to login // Otherwise allow the user to login
} else { } else {