Closed FrancescoD3V closed 8 months ago
Hi @FrancescoD3V,
For non-logged in users, you can retrieve the LdapRecord model using their synchronized Object GUID like so:
use App\Models\User;
use LdapRecord\Models\ActiveDirectory\User as LdapUser;
$eloquent = User::find(1);
$ldap = LdapUser::findByGuid($eloquent->guid);
if ($ldap->hasAttribute('jpegPhoto')) {
// ...
}
Let me know if this is what you're looking for 👍
Thanks, you are great!
Excellent, thanks @FrancescoD3V! Glad I could be of assistance.
Hi, I need your help to search for the 'jpegPhoto' attributes of my ldap users.
Currently I can download the image of the user logged into my app like this:
$user = Auth::user(); if ($user ->ldap->hasAttribute('jpegPhoto')) { $user ->ldap->getAttribute('jpegPhoto') }
Now I would like to be able to find the same attribute by being able to specify the ID of other users, for example $user = User::find($id);
What I get, however, is the data of my model but $User is not an object of type LdapRecord and therefore I cannot use $user->ldap->getAttribute
Can you give me some suggestions?
Environment: