summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/User_LDAP.php
diff options
context:
space:
mode:
authorRoger Szabo <roger.szabo@web.de>2017-03-31 15:16:22 +0800
committerRoger Szabo <roger.szabo@web.de>2017-03-31 15:16:22 +0800
commit5e7723f15c7e4ba31b0a5d35d22fd3a22e45ec81 (patch)
tree9bdbf56d59b7eae1aa10718af5cf4642d17b9784 /apps/user_ldap/lib/User_LDAP.php
parent6a6300b1f20116088c3d7e09d5e4d8a6ed6fc57e (diff)
downloadnextcloud-server-5e7723f15c7e4ba31b0a5d35d22fd3a22e45ec81.tar.gz
nextcloud-server-5e7723f15c7e4ba31b0a5d35d22fd3a22e45ec81.zip
restore ldap_password_renew_pr
Signed-off-by: Roger Szabo <roger.szabo@web.de>
Diffstat (limited to 'apps/user_ldap/lib/User_LDAP.php')
-rw-r--r--apps/user_ldap/lib/User_LDAP.php23
1 files changed, 20 insertions, 3 deletions
diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php
index cfd2450a122..8fbbd4e3940 100644
--- a/apps/user_ldap/lib/User_LDAP.php
+++ b/apps/user_ldap/lib/User_LDAP.php
@@ -41,6 +41,7 @@ use OCA\User_LDAP\Exceptions\NotOnLDAP;
use OCA\User_LDAP\User\OfflineUser;
use OCA\User_LDAP\User\User;
use OCP\IConfig;
+use OCP\Notification\IManager as INotificationManager;
use OCP\Util;
class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserInterface, IUserLDAP {
@@ -50,13 +51,18 @@ class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
/** @var \OCP\IConfig */
protected $ocConfig;
+ /** @var INotificationManager */
+ protected $notificationManager;
+
/**
* @param Access $access
* @param \OCP\IConfig $ocConfig
+ * @param \OCP\Notification\IManager $notificationManager
*/
- public function __construct(Access $access, IConfig $ocConfig) {
+ public function __construct(Access $access, IConfig $ocConfig, INotificationManager $notificationManager) {
parent::__construct($access);
$this->ocConfig = $ocConfig;
+ $this->notificationManager = $notificationManager;
}
/**
@@ -190,8 +196,19 @@ class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
throw new \Exception('LDAP setPassword: Could not get user object for uid ' . $uid .
'. Maybe the LDAP entry has no set display name attribute?');
}
- if($user->getUsername() !== false) {
- return $this->access->setPassword($user->getDN(), $password);
+ if($user->getUsername() !== false && $this->access->setPassword($user->getDN(), $password)) {
+ $ldapDefaultPPolicyDN = $this->access->connection->ldapDefaultPPolicyDN;
+ $turnOnPasswordChange = $this->access->connection->turnOnPasswordChange;
+ if (!empty($ldapDefaultPPolicyDN) && (intval($turnOnPasswordChange) === 1)) {
+ //remove last password expiry warning if any
+ $notification = $this->notificationManager->createNotification();
+ $notification->setApp('user_ldap')
+ ->setUser($uid)
+ ->setObject('pwd_exp_warn', $uid)
+ ;
+ $this->notificationManager->markProcessed($notification);
+ }
+ return true;
}
return false;