Changeset View
Changeset View
Standalone View
Standalone View
src/app/Backends/LDAP.php
Show First 20 Lines • Show All 753 Lines • ▼ Show 20 Lines | class LDAP | ||||
/** | /** | ||||
* Set common user attributes | * Set common user attributes | ||||
*/ | */ | ||||
private static function setUserAttributes(User $user, array &$entry) | private static function setUserAttributes(User $user, array &$entry) | ||||
{ | { | ||||
$firstName = $user->getSetting('first_name'); | $firstName = $user->getSetting('first_name'); | ||||
$lastName = $user->getSetting('last_name'); | $lastName = $user->getSetting('last_name'); | ||||
$isDegraded = $user->isDegraded(true); | |||||
$cn = "unknown"; | $cn = "unknown"; | ||||
$displayname = ""; | $displayname = ""; | ||||
if ($firstName) { | if ($firstName) { | ||||
if ($lastName) { | if ($lastName) { | ||||
$cn = "{$firstName} {$lastName}"; | $cn = "{$firstName} {$lastName}"; | ||||
$displayname = "{$lastName}, {$firstName}"; | $displayname = "{$lastName}, {$firstName}"; | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | private static function setUserAttributes(User $user, array &$entry) | ||||
$hostedRootDN = \config('ldap.hosted.root_dn'); | $hostedRootDN = \config('ldap.hosted.root_dn'); | ||||
$entry['nsroledn'] = []; | $entry['nsroledn'] = []; | ||||
if (in_array("2fa", $roles)) { | if (in_array("2fa", $roles)) { | ||||
$entry['nsroledn'][] = "cn=2fa-user,{$hostedRootDN}"; | $entry['nsroledn'][] = "cn=2fa-user,{$hostedRootDN}"; | ||||
} | } | ||||
if ($isDegraded) { | |||||
$entry['nsroledn'][] = "cn=degraded-user,{$hostedRootDN}"; | |||||
$entry['mailquota'] = \config('app.storage.min_qty') * 1048576; | |||||
} else { | |||||
if (in_array("activesync", $roles)) { | if (in_array("activesync", $roles)) { | ||||
$entry['nsroledn'][] = "cn=activesync-user,{$hostedRootDN}"; | $entry['nsroledn'][] = "cn=activesync-user,{$hostedRootDN}"; | ||||
} | } | ||||
if (!in_array("groupware", $roles)) { | if (!in_array("groupware", $roles)) { | ||||
$entry['nsroledn'][] = "cn=imap-user,{$hostedRootDN}"; | $entry['nsroledn'][] = "cn=imap-user,{$hostedRootDN}"; | ||||
} | } | ||||
} | } | ||||
} | |||||
/** | /** | ||||
* Get LDAP configuration for specified access level | * Get LDAP configuration for specified access level | ||||
*/ | */ | ||||
private static function getConfig(string $privilege) | private static function getConfig(string $privilege) | ||||
{ | { | ||||
$config = [ | $config = [ | ||||
'domain_base_dn' => \config('ldap.domain_base_dn'), | 'domain_base_dn' => \config('ldap.domain_base_dn'), | ||||
▲ Show 20 Lines • Show All 146 Lines • Show Last 20 Lines |