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\Group; | |||||
use App\User; | use App\User; | ||||
class LDAP | class LDAP | ||||
{ | { | ||||
/** @const array UserSettings used by the backend */ | /** @const array UserSettings used by the backend */ | ||||
public const USER_SETTINGS = [ | public const USER_SETTINGS = [ | ||||
'first_name', | 'first_name', | ||||
'last_name', | 'last_name', | ||||
▲ Show 20 Lines • Show All 195 Lines • ▼ Show 20 Lines | public static function createDomain(Domain $domain): void | ||||
// TODO: Assign kolab-admin role to the owner? | // TODO: Assign kolab-admin role to the owner? | ||||
if (empty(self::$ldap)) { | if (empty(self::$ldap)) { | ||||
$ldap->close(); | $ldap->close(); | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Create a group in LDAP. | |||||
* | |||||
* @param \App\Group $group The group to create. | |||||
* | |||||
* @throws \Exception | |||||
*/ | |||||
public static function createGroup(Group $group): void | |||||
{ | |||||
// TODO | |||||
} | |||||
/** | |||||
* Create a user in LDAP. | * Create a user in LDAP. | ||||
* | * | ||||
* Only need to add user if in any of the local domains? Figure that out here for now. Should | * Only need to add user if in any of the local domains? Figure that out here for now. Should | ||||
* have Context-Based Access Controls before the job is queued though, probably. | * have Context-Based Access Controls before the job is queued though, probably. | ||||
* | * | ||||
* Use one of three modes; | * Use one of three modes; | ||||
* | * | ||||
* 1) The authenticated user account. | * 1) The authenticated user account. | ||||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | public static function createUser(User $user): void | ||||
if (empty(self::$ldap)) { | if (empty(self::$ldap)) { | ||||
$ldap->close(); | $ldap->close(); | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Delete a domain from LDAP. | * Delete a domain from LDAP. | ||||
* | * | ||||
* @param \App\Domain $domain The domain to update. | * @param \App\Domain $domain The domain to delete | ||||
* | * | ||||
* @throws \Exception | * @throws \Exception | ||||
*/ | */ | ||||
public static function deleteDomain(Domain $domain): void | public static function deleteDomain(Domain $domain): void | ||||
{ | { | ||||
$config = self::getConfig('admin'); | $config = self::getConfig('admin'); | ||||
$ldap = self::initLDAP($config); | $ldap = self::initLDAP($config); | ||||
Show All 27 Lines | public static function deleteDomain(Domain $domain): void | ||||
} | } | ||||
if (empty(self::$ldap)) { | if (empty(self::$ldap)) { | ||||
$ldap->close(); | $ldap->close(); | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Delete a group from LDAP. | |||||
* | |||||
* @param \App\Group $group The group to delete. | |||||
* | |||||
* @throws \Exception | |||||
*/ | |||||
public static function deleteGroup(Group $group): void | |||||
{ | |||||
// TODO | |||||
} | |||||
/** | |||||
* Delete a user from LDAP. | * Delete a user from LDAP. | ||||
* | * | ||||
* @param \App\User $user The user account to update. | * @param \App\User $user The user account to delete. | ||||
* | * | ||||
* @throws \Exception | * @throws \Exception | ||||
*/ | */ | ||||
public static function deleteUser(User $user): void | public static function deleteUser(User $user): void | ||||
{ | { | ||||
$config = self::getConfig('admin'); | $config = self::getConfig('admin'); | ||||
$ldap = self::initLDAP($config); | $ldap = self::initLDAP($config); | ||||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | public static function updateDomain(Domain $domain): void | ||||
} | } | ||||
if (empty(self::$ldap)) { | if (empty(self::$ldap)) { | ||||
$ldap->close(); | $ldap->close(); | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Update a group in LDAP. | |||||
* | |||||
* @param \App\Group $group The group to update | |||||
* | |||||
* @throws \Exception | |||||
*/ | |||||
public static function updateGroup(Group $group): void | |||||
{ | |||||
// TODO | |||||
} | |||||
/** | |||||
* Update a user in LDAP. | * Update a user in LDAP. | ||||
* | * | ||||
* @param \App\User $user The user account to update. | * @param \App\User $user The user account to update. | ||||
* | * | ||||
* @throws \Exception | * @throws \Exception | ||||
*/ | */ | ||||
public static function updateUser(User $user): void | public static function updateUser(User $user): void | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 281 Lines • Show Last 20 Lines |