2016-07-22 04:46:29 -04:00
|
|
|
<?php
|
2025-06-30 09:04:05 -04:00
|
|
|
|
2026-02-09 04:53:58 -05:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2016-07-22 04:46:29 -04:00
|
|
|
/**
|
2024-05-29 05:32:54 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2016-07-22 04:46:29 -04:00
|
|
|
*/
|
|
|
|
|
namespace OCA\User_LDAP;
|
|
|
|
|
|
2026-04-27 07:58:40 -04:00
|
|
|
use OCP\LDAP\Exceptions\MultipleUsersReturnedException;
|
|
|
|
|
|
2016-07-22 04:46:29 -04:00
|
|
|
interface IUserLDAP {
|
|
|
|
|
|
|
|
|
|
//Functions used by LDAPProvider
|
2025-06-30 09:04:05 -04:00
|
|
|
|
2016-07-22 04:46:29 -04:00
|
|
|
/**
|
|
|
|
|
* Return access for LDAP interaction.
|
|
|
|
|
* @param string $uid
|
|
|
|
|
* @return Access instance of Access for LDAP interaction
|
|
|
|
|
*/
|
|
|
|
|
public function getLDAPAccess($uid);
|
2025-06-30 09:04:05 -04:00
|
|
|
|
2016-07-22 04:46:29 -04:00
|
|
|
/**
|
|
|
|
|
* Return a new LDAP connection for the specified user.
|
|
|
|
|
* @param string $uid
|
2024-04-04 10:14:06 -04:00
|
|
|
* @return \LDAP\Connection of the LDAP connection
|
2016-07-22 04:46:29 -04:00
|
|
|
*/
|
|
|
|
|
public function getNewLDAPConnection($uid);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Return the username for the given LDAP DN, if available.
|
|
|
|
|
* @param string $dn
|
2016-07-27 03:10:35 -04:00
|
|
|
* @return string|false with the username
|
2016-07-22 04:46:29 -04:00
|
|
|
*/
|
|
|
|
|
public function dn2UserName($dn);
|
2026-04-27 07:58:40 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Fetches one user from LDAP based on a filter or a custom attribute and search term.
|
|
|
|
|
*
|
|
|
|
|
* @param string $attribute The LDAP attribute name to search against (e.g., 'mail', 'cn', 'uid').
|
|
|
|
|
* @param string $searchTerm The search term to match against the attribute. Will be escaped for LDAP filter safety.
|
|
|
|
|
* @return string|null Returns the username if found in LDAP using the configured LDAP filter, or null if no user is found.
|
|
|
|
|
* @throws MultipleUsersReturnedException if multiple users have been found (search query should not allow this)
|
|
|
|
|
*/
|
|
|
|
|
public function getUserFromCustomAttribute(string $attribute, string $searchTerm): ?string;
|
2016-07-22 04:46:29 -04:00
|
|
|
}
|