Changeset View
Changeset View
Standalone View
Standalone View
src/app/Backends/LDAP.php
<?php | <?php | ||||
namespace App\Backends; | namespace App\Backends; | ||||
use App\Domain; | use App\Domain; | ||||
use App\User; | use App\User; | ||||
class LDAP | class LDAP | ||||
{ | { | ||||
/** @const array UserSettings used by th backend */ | |||||
public const USER_SETTINGS = [ | |||||
'first_name', | |||||
'last_name', | |||||
'organization', | |||||
]; | |||||
/** | /** | ||||
* Create a domain in LDAP. | * Create a domain in LDAP. | ||||
* | * | ||||
* @param \App\Domain $domain The domain to create. | * @param \App\Domain $domain The domain to create. | ||||
* | * | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
public static function createDomain(Domain $domain) | public static function createDomain(Domain $domain) | ||||
▲ Show 20 Lines • Show All 345 Lines • ▼ Show 20 Lines | private static function setUserAttributes(User $user, array &$entry) | ||||
} | } | ||||
} | } | ||||
$entry['cn'] = $cn; | $entry['cn'] = $cn; | ||||
$entry['displayname'] = $displayname; | $entry['displayname'] = $displayname; | ||||
$entry['givenname'] = $firstName; | $entry['givenname'] = $firstName; | ||||
$entry['sn'] = $lastName; | $entry['sn'] = $lastName; | ||||
$entry['userpassword'] = $user->password_ldap; | $entry['userpassword'] = $user->password_ldap; | ||||
$entry['inetuserstatus'] = $user->status; | $entry['inetuserstatus'] = $user->status; | ||||
$entry['o'] = $user->getSetting('organization'); | |||||
$entry['mailquota'] = 0; | $entry['mailquota'] = 0; | ||||
$entry['alias'] = $user->aliases->pluck('alias')->toArray(); | $entry['alias'] = $user->aliases->pluck('alias')->toArray(); | ||||
$roles = []; | $roles = []; | ||||
foreach ($user->entitlements as $entitlement) { | foreach ($user->entitlements as $entitlement) { | ||||
\Log::debug("Examining {$entitlement->sku->title}"); | \Log::debug("Examining {$entitlement->sku->title}"); | ||||
switch ($entitlement->sku->title) { | switch ($entitlement->sku->title) { | ||||
▲ Show 20 Lines • Show All 151 Lines • Show Last 20 Lines |