[Pkg-owncloud-commits] [owncloud] 28/63: Only throw exception if on new LDAP setups

David Prévot taffit at moszumanska.debian.org
Tue Dec 22 16:50:56 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8.0
in repository owncloud.

commit 89fdca7748961bd88ddbb975566185d5690a6e67
Author: Morris Jobke <hey at morrisjobke.de>
Date:   Mon Jul 20 11:24:28 2015 +0200

    Only throw exception if on new LDAP setups
    
    * this is done by setting enforce_home_folder_naming_rule for the user_ldap
      app in the app settings
---
 apps/user_ldap/appinfo/update.php | 27 +++++++++++++++++++++++++++
 apps/user_ldap/appinfo/version    |  2 +-
 apps/user_ldap/user_ldap.php      |  6 ++++--
 3 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/apps/user_ldap/appinfo/update.php b/apps/user_ldap/appinfo/update.php
new file mode 100644
index 0000000..64ef0a1
--- /dev/null
+++ b/apps/user_ldap/appinfo/update.php
@@ -0,0 +1,27 @@
+<?php
+/**
+ * @author Morris Jobke <hey at morrisjobke.de>
+ *
+ * @copyright Copyright (c) 2015, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+$config = \OC::$server->getConfig();
+$installedVersion = $config->getAppValue('user_ldap', 'installed_version');
+
+if (version_compare($installedVersion, '0.5.2', '<')) {
+	$config->setAppValue('user_ldap', 'enforce_home_folder_naming_rule', false);
+}
diff --git a/apps/user_ldap/appinfo/version b/apps/user_ldap/appinfo/version
index 4b9fcbe..cb0c939 100644
--- a/apps/user_ldap/appinfo/version
+++ b/apps/user_ldap/appinfo/version
@@ -1 +1 @@
-0.5.1
+0.5.2
diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php
index 9c35ec9..6f00ba1 100644
--- a/apps/user_ldap/user_ldap.php
+++ b/apps/user_ldap/user_ldap.php
@@ -290,8 +290,10 @@ class USER_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
 				//TODO: if home directory changes, the old one needs to be removed.
 				return $homedir;
 			}
-			// a naming rule attribute is defined, but it doesn't exist for that LDAP user
-			throw new \Exception('Home dir attribute can\'t be read from LDAP for uid: ' . $uid);
+			if($this->ocConfig->getAppValue('user_ldap', 'enforce_home_folder_naming_rule', true)) {
+				// a naming rule attribute is defined, but it doesn't exist for that LDAP user
+				throw new \Exception('Home dir attribute can\'t be read from LDAP for uid: ' . $uid);
+			}
 		}
 
 		//false will apply default behaviour as defined and done by OC_User

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list