summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorGeorg Ehrke <dev@georgswebsite.de>2012-04-23 19:56:07 +0200
committerGeorg Ehrke <dev@georgswebsite.de>2012-04-23 19:56:07 +0200
commit42a570788b22bcf28d2cc0124dbfa4cdeeb9ea04 (patch)
treef6a385649abba09d709e265c1ae5f2c25f83fff3 /apps
parent6d92ebca454ab2e6533d0b7a08bfe30d20005820 (diff)
parentf5c9fe9ece6fdfb35bab5eefdf83830b5045b5a8 (diff)
downloadnextcloud-server-42a570788b22bcf28d2cc0124dbfa4cdeeb9ea04.tar.gz
nextcloud-server-42a570788b22bcf28d2cc0124dbfa4cdeeb9ea04.zip
Merge branch 'master' into movable_apps
Diffstat (limited to 'apps')
-rw-r--r--apps/files/css/files.css2
-rw-r--r--apps/files_sharing/css/sharing.css6
-rw-r--r--apps/media/css/music.css4
-rw-r--r--apps/user_ldap/group_ldap.php28
-rw-r--r--apps/user_ldap/lib_ldap.php37
5 files changed, 57 insertions, 20 deletions
diff --git a/apps/files/css/files.css b/apps/files/css/files.css
index d50d9aa9c5a..445b50db09d 100644
--- a/apps/files/css/files.css
+++ b/apps/files/css/files.css
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, Jan-Christoph Borchardt
+/* Copyright (c) 2011, Jan-Christoph Borchardt, http://jancborchardt.net
This file is licensed under the Affero General Public License version 3 or later.
See the COPYING-README file. */
diff --git a/apps/files_sharing/css/sharing.css b/apps/files_sharing/css/sharing.css
index db59a3d340b..5acd9af589a 100644
--- a/apps/files_sharing/css/sharing.css
+++ b/apps/files_sharing/css/sharing.css
@@ -1,3 +1,7 @@
+/* Copyright (c) 2011, Jan-Christoph Borchardt, http://jancborchardt.net
+ This file is licensed under the Affero General Public License version 3 or later.
+ See the COPYING-README file. */
+
#dropdown { display:block; position:absolute; z-index:100; width:16em; right:0; margin-right:7em; background:#eee; padding:1em;
-moz-box-shadow:0 1px 1px #777; -webkit-box-shadow:0 1px 1px #777; box-shadow:0 1px 1px #777;
-moz-border-radius-bottomleft:1em; -webkit-border-bottom-left-radius:1em; border-bottom-left-radius:1em;
@@ -6,4 +10,4 @@
#public { border-top:1px solid #ddd; padding-top:0.5em; }
a.unshare { float:right; display:inline; margin:0 .5em; padding:.3em .3em 0 .3em !important; opacity:.5; }
a.unshare:hover { opacity:1; }
-#share_with { width: 16em; } \ No newline at end of file
+#share_with { width: 16em; }
diff --git a/apps/media/css/music.css b/apps/media/css/music.css
index 164a6c62ae6..c782e8afeeb 100644
--- a/apps/media/css/music.css
+++ b/apps/media/css/music.css
@@ -1,3 +1,7 @@
+/* Copyright (c) 2011, Jan-Christoph Borchardt, http://jancborchardt.net
+ This file is licensed under the Affero General Public License version 3 or later.
+ See the COPYING-README file. */
+
#controls ul.jp-controls { padding:0; }
#controls ul.jp-controls li { display:inline; }
#controls ul.jp-controls li a { position:absolute; padding:.8em 1em .8em 0; }
diff --git a/apps/user_ldap/group_ldap.php b/apps/user_ldap/group_ldap.php
index e5948459dd0..fe0789cdeb7 100644
--- a/apps/user_ldap/group_ldap.php
+++ b/apps/user_ldap/group_ldap.php
@@ -25,6 +25,7 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
// //group specific settings
protected $ldapGroupFilter;
protected $ldapGroupDisplayName;
+ protected $ldapGroupMemberAttr;
public function __construct() {
$this->ldapGroupFilter = OC_Appconfig::getValue('user_ldap', 'ldap_group_filter', '(objectClass=posixGroup)');
@@ -46,14 +47,12 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
LDAP_GROUP_MEMBER_ASSOC_ATTR.'='.$uid,
$this->ldapGroupDisplayName.'='.$gid
));
- $groups = OC_LDAP::search($filter, $this->ldapGroupDisplayName);
+ $groups = $this->retrieveList($filter, $this->ldapGroupDisplayName);
- if(count($groups) == 1) {
+ if(count($groups) > 0) {
return true;
- } else if(count($groups) < 1) {
- return false;
} else {
- throw new Exception('Too many groups of the same name!? – this exception should never been thrown :)');
+ return false;
}
}
@@ -84,7 +83,7 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
$this->ldapGroupDisplayName.'='.$gid
));
- return $this->retrieveList($filter, $this->ldapGroupMemberAttr);
+ return $this->retrieveList($filter, $this->ldapGroupMemberAttr, false);
}
/**
@@ -94,13 +93,7 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
* Returns a list with all groups
*/
public function getGroups() {
- $groups = OC_LDAP::search($this->ldapGroupFilter, $this->ldapGroupDisplayName);
-
- if(count($groups) == 0 )
- return array();
- else {
- return array_unique($groups, SORT_LOCALE_STRING);
- }
+ return $this->retrieveList($this->ldapGroupFilter, $this->ldapGroupDisplayName);
}
/**
@@ -112,8 +105,13 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
return in_array($gid, $this->getGroups());
}
- private function retrieveList($filter, $attr) {
- $list = OC_LDAP::search($filter, $attr);
+ private function retrieveList($filter, $attr, $searchForGroups = true) {
+ if($searchForGroups) {
+ $list = OC_LDAP::searchGroups($filter, $attr);
+ } else {
+ $list = OC_LDAP::searchUsers($filter, $attr);
+ }
+
if(is_array($list)) {
return array_unique($list, SORT_LOCALE_STRING);
diff --git a/apps/user_ldap/lib_ldap.php b/apps/user_ldap/lib_ldap.php
index eea4a82011c..752ac4f2289 100644
--- a/apps/user_ldap/lib_ldap.php
+++ b/apps/user_ldap/lib_ldap.php
@@ -38,6 +38,8 @@ class OC_LDAP {
static protected $ldapHost;
static protected $ldapPort;
static protected $ldapBase;
+ static protected $ldapBaseUsers;
+ static protected $ldapBaseGroups;
static protected $ldapAgentName;
static protected $ldapAgentPassword;
static protected $ldapTLS;
@@ -65,15 +67,40 @@ class OC_LDAP {
}
/**
+ * @brief executes an LDAP search, optimized for Users
+ * @param $filter the LDAP filter for the search
+ * @param $attr optional, when a certain attribute shall be filtered out
+ * @returns array with the search result
+ *
+ * Executes an LDAP search
+ */
+ static public function searchUsers($filter, $attr = null) {
+ return self::search($filter, self::$ldapBaseUsers, $attr);
+ }
+
+ /**
+ * @brief executes an LDAP search, optimized for Groups
+ * @param $filter the LDAP filter for the search
+ * @param $attr optional, when a certain attribute shall be filtered out
+ * @returns array with the search result
+ *
+ * Executes an LDAP search
+ */
+ static public function searchGroups($filter, $attr = null) {
+ return self::search($filter, self::$ldapBaseGroups, $attr);
+ }
+
+ /**
* @brief executes an LDAP search
* @param $filter the LDAP filter for the search
+ * @param $base the LDAP subtree that shall be searched
* @param $attr optional, when a certain attribute shall be filtered out
* @returns array with the search result
*
* Executes an LDAP search
*/
- static public function search($filter, $attr = null) {
- $sr = ldap_search(self::getConnectionResource(), self::$ldapBase, $filter);
+ static private function search($filter, $base, $attr = null) {
+ $sr = ldap_search(self::getConnectionResource(), $base, $filter, array($attr));
$findings = ldap_get_entries(self::getConnectionResource(), $sr );
if(!is_null($attr)) {
@@ -150,7 +177,9 @@ class OC_LDAP {
self::$ldapPort = OC_Appconfig::getValue('user_ldap', 'ldap_port', OC_USER_BACKEND_LDAP_DEFAULT_PORT);
self::$ldapAgentName = OC_Appconfig::getValue('user_ldap', 'ldap_dn','');
self::$ldapAgentPassword = OC_Appconfig::getValue('user_ldap', 'ldap_password','');
- self::$ldapBase = OC_Appconfig::getValue('user_ldap', 'ldap_base','');
+ self::$ldapBase = OC_Appconfig::getValue('user_ldap', 'ldap_base', '');
+ self::$ldapBaseUsers = OC_Appconfig::getValue('user_ldap', 'ldap_base_users',self::$ldapBase);
+ self::$ldapBaseGroups = OC_Appconfig::getValue('user_ldap', 'ldap_base_groups', self::$ldapBase);
self::$ldapTLS = OC_Appconfig::getValue('user_ldap', 'ldap_tls',0);
self::$ldapNoCase = OC_Appconfig::getValue('user_ldap', 'ldap_nocase', 0);
self::$ldapUserDisplayName = OC_Appconfig::getValue('user_ldap', 'ldap_display_name', OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME);
@@ -163,6 +192,8 @@ class OC_LDAP {
|| ( empty(self::$ldapAgentName) && empty(self::$ldapAgentPassword))
)
&& !empty(self::$ldapBase)
+ && !empty(self::$ldapBaseUsers)
+ && !empty(self::$ldapBaseGroups)
&& !empty(self::$ldapUserDisplayName)
)
{