nextcloud/apps/user_ldap/lib/IUserLDAP.php

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

48 lines
1.5 KiB
PHP
Raw Normal View History

2016-07-22 04:46:29 -04:00
<?php
declare(strict_types=1);
2016-07-22 04:46:29 -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;
use OCP\LDAP\Exceptions\MultipleUsersReturnedException;
2016-07-22 04:46:29 -04:00
interface IUserLDAP {
//Functions used by LDAPProvider
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);
2016-07-22 04:46:29 -04:00
/**
* Return a new LDAP connection for the specified user.
* @param string $uid
* @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);
/**
* 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
}