summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/User_LDAP.php
diff options
context:
space:
mode:
authorroot <root@localhost.localdomain>2016-07-22 16:46:29 +0800
committerroot <root@localhost.localdomain>2016-07-22 16:46:29 +0800
commit02ec8b1726eb867e88dd2c31a74a080e451a31d1 (patch)
tree2ca1a1c490003ed8524cd71363b5e2f9c38a70f7 /apps/user_ldap/lib/User_LDAP.php
parent4b4990c48fd4c6841bde260b2b2e1bc665b46e1c (diff)
downloadnextcloud-server-02ec8b1726eb867e88dd2c31a74a080e451a31d1.tar.gz
nextcloud-server-02ec8b1726eb867e88dd2c31a74a080e451a31d1.zip
New LDAPProvider for user_ldap
Diffstat (limited to 'apps/user_ldap/lib/User_LDAP.php')
-rw-r--r--apps/user_ldap/lib/User_LDAP.php35
1 files changed, 33 insertions, 2 deletions
diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php
index a2a65bb8406..712cc9601dd 100644
--- a/apps/user_ldap/lib/User_LDAP.php
+++ b/apps/user_ldap/lib/User_LDAP.php
@@ -15,6 +15,7 @@
* @author Robin McCorkell <robin@mccorkell.me.uk>
* @author Thomas Müller <thomas.mueller@tmit.eu>
* @author Tom Needham <tom@owncloud.com>
+ * @author Roger Szabo <roger.szabo@web.de>
*
* @license AGPL-3.0
*
@@ -39,7 +40,7 @@ use OCA\User_LDAP\User\OfflineUser;
use OCA\User_LDAP\User\User;
use OCP\IConfig;
-class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserInterface {
+class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserInterface, IUserLDAP {
/** @var string[] $homesToKill */
protected $homesToKill = array();
@@ -90,6 +91,16 @@ class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
return false;
}
}
+
+ /**
+ * returns the username for the given LDAP DN, if available
+ *
+ * @param string $dn
+ * @return string|false with the name to use in ownCloud
+ */
+ public function dn2UserName($dn) {
+ return $this->access->dn2username($dn);
+ }
/**
* returns an LDAP record based on a given login name
@@ -462,5 +473,25 @@ class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
public function getBackendName(){
return 'LDAP';
}
-
+
+ /**
+ * Return access for LDAP interaction.
+ * @param string $uid
+ * @return Access instance of Access for LDAP interaction
+ */
+ public function getLDAPAccess($uid) {
+ return $this->access;
+ }
+
+ /**
+ * Return LDAP connection resource from a cloned connection.
+ * The cloned connection needs to be closed manually.
+ * of the current access.
+ * @param string $uid
+ * @return resource of the LDAP connection
+ */
+ public function getNewLDAPConnection($uid) {
+ $connection = clone $this->access->getConnection();
+ return $connection->getConnectionResource();
+ }
}