Closed Strawpple closed 3 months ago
Hi @Strawpple,
Please only select one of the built in templates when creating an issue and fill out the requested version information.
I am also unable to assist you if you don't provide this, along with the code you've written.
<?php
use LdapRecord\Models\ActiveDirectory\User;
$user = (new User)->inside('ou=Users,dc=local,dc=com');
$user->cn = 'Test Data'; $user->unicodePwd = 'TestDataPassword!1'; $user->samaccountname = 'testdata'; $user->userPrincipalName = 'testdata@edu.com';
$user->save();
$user->refresh();
// Enable the user. $user->userAccountControl = 512;
try { if($user){ $user->save();
}
} catch (\LdapRecord\LdapRecordException $e) { }
.env
LDAP_HOST=samplehost; LDAP_USERNAME = 'sample'; LDAP_PASSWORD = 'password'; LDAP_BASE_DN = 'dc=local,dc=ph'; LDAP_PORT=636; LDAP_TLS = true; LDAP_SSL = false;
config/ldap.php default' => [ 'hosts' => [env('LDAP_HOST')], 'username' => env('LDAP_USERNAME'), 'password' => env('LDAP_PASSWORD'), 'port' => env('LDAP_PORT', 636), 'base_dn' => env('LDAP_BASE_DN'), // 'timeout' => env('LDAP_TIMEOUT', 5), // 'use_ssl' => env('LDAP_SSL', false), // 'use_tls' => env('LDAP_TLS', false), 'use_sasl' => env('LDAP_SASL', false), 'sasl_options' => [ // 'mech' => 'GSSAPI', ],
on run php artisan ldap:test it says connected
if i comment the $user->unicodePwd = 'passwordsample12!'; it will create account with the userAccountControl = 546( ACCOUNTDISABLE(2) + PASSWD_NOTREQD (32) + NORMAL_ACCOUNT(512))
if i uncomment the $user->unicodePwd = 'passwordsample12!'; it will error add: insufficient access.
the credentials on ldap is connected and the tls is true.
but when i tried creating new users it will error insufficient access.
the username and password is already proven that it is creating users on old systems and I'm implementing it on laravel