Closed dereknutile closed 3 years ago
Hi there @dereknutile!
Can you post your App\Ldap\Ccso\User
model code?
Hi @stevebauman, sure thing.
<?php
namespace App\Ldap\Ccso;
use LdapRecord\Models\Model;
class User extends Model
{
protected $connection = 'ccso';
/**
* The object classes of the LDAP model.
*
* @var array
*/
public static $objectClasses = [
'user',
'Person',
];
}
Thanks @dereknutile. Your model must extend the built-in ActiveDirectory\User
model so that LdapRecord knows the user is in-fact from Active Directory. This model implements an interface which is checked during import:
For example:
<?php
namespace App\Ldap\Ccso;
use LdapRecord\Models\ActiveDirectory\User as BaseUser;
class User extends BaseUser
{
protected $connection = 'ccso';
}
Give that a shot 👍
Ah, that makes perfect sense. It worked, thank you @stevebauman!
Awesome, happy to help @dereknutile! Glad you're up and running 🎉
Your model must extend the built-in
ActiveDirectory\User
model so that LdapRecord knows the user is in-fact from Active Directory. This model implements an interface which is checked during import:
Hi @stevebauman! What if I'm using FreeIPA
instead of ActiveDirectory
and my User
model looks like this?
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable implements LdapAuthenticatable, MustVerifyEmail, Auditable
{
use HasApiTokens, AuthenticatesWithLdap, HasLdapUser, HasFactory, Notifiable, SoftDeletes, HasRoles, \OwenIt\Auditing\Auditable;
Thanks, Ward
Environment:
Soft-deleting/restoring isn't working on import/sync. For example, choosing a user to import and including the -d and -r switches seems to successfully sync, even syncs attributes like a name change, but doesn't flag the user as soft-deleted or set deleted_at to NULL based on AD.
php artisan ldap:import ccso -d -r --filter "(samAccountName=fmulder)"
Additional Information
The User model does have SoftDeletes enabled I have 2 "providers" configured in config/auth - each using an AttributeHandler to prepare certain fields, e.g.:
The terminal output and the log don't suggest errors.
Is this something mis-configured on my end or is the soft-delete not working?
Thank you, Derek